vmbase: Enter clients with dynamic PTs live
The layout and linker sections of clients are controlled by a linker
script provided by vmbase so the library should know how to replicate
the client-specific static PTs to generate the dynamic PTs. Therefore,
teach vmbase to use the information it gets from the linker to replicate
the client static PTs, with client-agnostic code, and switch to the
dynamic PTs before entering its clients.
Bug: 377276983
Test: m {pvmfw,rialto,vmbase_example_{bios,kernel}}_bin
Test: atest rialto_test vmbase_example.integration_test
Change-Id: I90fa0e62e6e4cb8474f3294633cee775b1191c71
diff --git a/guest/pvmfw/src/entry.rs b/guest/pvmfw/src/entry.rs
index 1da0513..2f0b391 100644
--- a/guest/pvmfw/src/entry.rs
+++ b/guest/pvmfw/src/entry.rs
@@ -28,9 +28,8 @@
arch::aarch64::min_dcache_line_size,
configure_heap, console_writeln, layout, limit_stack_size, main,
memory::{
- deactivate_dynamic_page_tables, map_image_footer, switch_to_dynamic_page_tables,
- unshare_all_memory, unshare_all_mmio_except_uart, unshare_uart, MemoryTrackerError,
- SIZE_128KB, SIZE_4KB,
+ deactivate_dynamic_page_tables, map_image_footer, unshare_all_memory,
+ unshare_all_mmio_except_uart, unshare_uart, MemoryTrackerError, SIZE_128KB, SIZE_4KB,
},
power::reboot,
};
@@ -109,13 +108,6 @@
log::set_max_level(LevelFilter::Info);
- let page_table = memory::init_page_table().map_err(|e| {
- error!("Failed to set up the dynamic page tables: {e}");
- RebootReason::InternalError
- })?;
- // Up to this point, we were using the built-in static (from .rodata) page tables.
- switch_to_dynamic_page_tables(page_table);
-
let appended_data = get_appended_data_slice().map_err(|e| {
error!("Failed to map the appended data: {e}");
RebootReason::InternalError