[vmbase] Add page table parameters to vmbase for reuse
in both pvmfw and rialto.
Bug: 284462758
Test: m pvmfw_img
Change-Id: I389e538ec23b8775a39847ff1735b67fd45a6bb4
diff --git a/pvmfw/src/memory.rs b/pvmfw/src/memory.rs
index f259776..989120d 100644
--- a/pvmfw/src/memory.rs
+++ b/pvmfw/src/memory.rs
@@ -17,7 +17,6 @@
#![deny(unsafe_op_in_unsafe_fn)]
use crate::helpers::PVMFW_PAGE_SIZE;
-use aarch64_paging::idmap::IdMap;
use aarch64_paging::paging::{Attributes, Descriptor, MemoryRegion as VaRange};
use aarch64_paging::MapError;
use alloc::alloc::handle_alloc_error;
@@ -40,7 +39,7 @@
dsb, isb, layout,
memory::{
flush_dirty_range, is_leaf_pte, page_4kb_of, set_dbm_enabled, MemorySharer, PageTable,
- MMIO_LAZY_MAP_FLAG, SIZE_2MB, SIZE_4KB,
+ MMIO_LAZY_MAP_FLAG, PT_ASID, SIZE_2MB, SIZE_4KB,
},
tlbi,
util::{align_up, RangeExt as _},
@@ -49,9 +48,6 @@
/// First address that can't be translated by a level 1 TTBR0_EL1.
pub const MAX_ADDR: usize = 1 << 40;
-const PT_ROOT_LEVEL: usize = 1;
-const PT_ASID: usize = 1;
-
pub type MemoryRange = Range<usize>;
pub static MEMORY: SpinMutex<Option<MemoryTracker>> = SpinMutex::new(None);
@@ -520,7 +516,7 @@
}
pub fn init_page_table() -> result::Result<PageTable, MapError> {
- let mut page_table: PageTable = IdMap::new(PT_ASID, PT_ROOT_LEVEL).into();
+ let mut page_table = PageTable::default();
// Stack and scratch ranges are explicitly zeroed and flushed before jumping to payload,
// so dirty state management can be omitted.