pvmfw: helpers: Introduce SIZE_2MB
Test: atest MicrodroidTestApp
Change-Id: I7175d7c166937d546beef0d7818deb7b2ca0e509
diff --git a/pvmfw/src/entry.rs b/pvmfw/src/entry.rs
index 99c67fb..1ea95bc 100644
--- a/pvmfw/src/entry.rs
+++ b/pvmfw/src/entry.rs
@@ -14,7 +14,7 @@
//! Low-level entry and exit points of pvmfw.
-use crate::helpers::FDT_MAX_SIZE;
+use crate::helpers;
use crate::mmio_guard;
use core::arch::asm;
use core::slice;
@@ -54,6 +54,7 @@
// - only access non-pvmfw memory once (and while) it has been mapped
logger::init(LevelFilter::Info).map_err(|_| RebootReason::InternalError)?;
+ const FDT_MAX_SIZE: usize = helpers::SIZE_2MB;
// TODO: Check that the FDT is fully contained in RAM.
// SAFETY - We trust the VMM, for now.
let fdt = unsafe { slice::from_raw_parts_mut(fdt as *mut u8, FDT_MAX_SIZE) };
diff --git a/pvmfw/src/helpers.rs b/pvmfw/src/helpers.rs
index cade62e..adfc189 100644
--- a/pvmfw/src/helpers.rs
+++ b/pvmfw/src/helpers.rs
@@ -14,8 +14,8 @@
//! Miscellaneous helper functions.
-pub const FDT_MAX_SIZE: usize = 2 << 20;
pub const SIZE_4KB: usize = 4 << 10;
+pub const SIZE_2MB: usize = 2 << 20;
/// Computes the address of the page containing a given address.
pub const fn page_of(addr: usize, page_size: usize) -> usize {