From ef6a73d3297dafab1a822397105590d8ef252f0d Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 3 May 2024 18:43:19 +0800 Subject: [PATCH] use the correct session key for swap ram and also call platform-specific swap init --- loader/src/phase2.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/loader/src/phase2.rs b/loader/src/phase2.rs index 3eeabd074..c9efcc93f 100644 --- a/loader/src/phase2.rs +++ b/loader/src/phase2.rs @@ -249,7 +249,7 @@ pub fn phase_2(cfg: &mut BootConfig, fs_prehash: &[u8; 64]) { // - SwapSpec is a Repr(C), and every element of the struct is valid with a 0's initialization. let swap_spec = unsafe { (swap_spec_ptr as *mut SwapSpec).as_mut().unwrap() }; if let Some(desc) = cfg.swap { - swap_spec.key.copy_from_slice(&desc.key); + swap_spec.key.copy_from_slice(&cfg.swap_hal.as_ref().unwrap().get_swap_key()); swap_spec.pid_count = cfg.init_process_count as u32 + 1; swap_spec.rpt_len_bytes = cfg.runtime_page_tracker.len() as u32; swap_spec.swap_base = desc.ram_offset; @@ -287,6 +287,9 @@ pub fn phase_2(cfg: &mut BootConfig, fs_prehash: &[u8; 64]) { dest[..rpt_page.len()].copy_from_slice(rpt_page); } } + + // map any hardware-specific pages into the userspace swapper + crate::platform::userspace_maps(cfg); } if VVDBG || SDBG {