pvmfw: Zero all scratch memory before guest runs
Zero any memory that could still hold secrets before executing the guest
OS, to reduce as much as possible the risk of leaking them.
Note that this only covers memory that can't be zeroed from high-level
compiled code (i.e. the .bss and .data sections and stack regions) and
doesn't zero the received configuration data, which contains the
BccHandover holding the secret CDIs as that is (and must still be)
zeroed from Rust.
Furthermore, no other region is flushed so data such as the DT or BCC
that must be made available to the guest OS (even if it doesn't
immediately re-enable the MMU) should still be flushed from Rust.
Remove unnecessary ISB in jump_to_payload().
Bug: 270684188
Test: atest MicrodroidHostTests
Change-Id: I8e923a468d1826c00ce1d0b07e1a91f5d2909f99
diff --git a/pvmfw/src/helpers.rs b/pvmfw/src/helpers.rs
index 933a6aa..a6f0dd5 100644
--- a/pvmfw/src/helpers.rs
+++ b/pvmfw/src/helpers.rs
@@ -112,7 +112,8 @@
}
#[inline]
-fn min_dcache_line_size() -> usize {
+/// Read the number of words in the smallest cache line of all the data caches and unified caches.
+pub fn min_dcache_line_size() -> usize {
const DMINLINE_SHIFT: usize = 16;
const DMINLINE_MASK: usize = 0xf;
let ctr_el0 = read_sysreg!("ctr_el0");