if swap is turned on bodge a extra page buffer on the memory clear

this prevents some key loader constants from being zeroed out
This commit is contained in:
bunnie 2025-05-15 11:54:26 +08:00
parent 75fbcd5be8
commit c8b3fa9aad

View file

@ -512,6 +512,9 @@ fn clear_ram(cfg: &mut BootConfig) {
// stay there forever, if not explicitly cleared. This clear adds a couple seconds
// to a cold boot, but it's probably worth it. Note that it doesn't happen on a suspend/resume.
let ram: *mut u32 = cfg.sram_start as *mut u32;
#[cfg(feature = "swap")]
let clear_limit = ((2 * 4096 + core::mem::size_of::<BootConfig>()) + 4095) & !4095;
#[cfg(not(feature = "swap"))]
let clear_limit = ((4096 + core::mem::size_of::<BootConfig>()) + 4095) & !4095;
if VDBG {
println!("Stack clearing limit: {:x}", clear_limit);