Always set MBZ registers
When creating the register contents at an FF-A v1.2+ instance, we should
always handle 18 registers. However, when handling an interface which
already existed in FF-A v1.1, the code will fall back to pack_regs8(),
since the functionality is already implemented there. This function will
only set the contents of the first 8 registers, and zeroing the rest of
them was missing, so fix this now.
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: Ic658c7bae00c23550ac6bc6d1d73466eadab1eb8
diff --git a/src/lib.rs b/src/lib.rs
index 559d2c2..c6dbc59 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1363,10 +1363,13 @@
match reg_cnt {
8 => {
assert!(version <= Version(1, 1));
+ regs.fill(0);
+
self.pack_regs8(version, (&mut regs[..8]).try_into().unwrap());
}
18 => {
assert!(version >= Version(1, 2));
+ regs.fill(0);
match self {
Interface::ConsoleLog {
@@ -1392,7 +1395,6 @@
}
fn pack_regs8(&self, version: Version, a: &mut [u64; 8]) {
- a.fill(0);
if let Some(function_id) = self.function_id() {
a[0] = function_id as u64;
}
@@ -1767,7 +1769,6 @@
fn pack_regs18(&self, version: Version, a: &mut [u64; 18]) {
assert!(version >= Version(1, 2));
- a.fill(0);
if let Some(function_id) = self.function_id() {
a[0] = function_id as u64;
}