diff --git a/loader/src/main.rs b/loader/src/main.rs index e90d8ecf3..043feb834 100644 --- a/loader/src/main.rs +++ b/loader/src/main.rs @@ -786,14 +786,19 @@ fn copy_processes(cfg: &mut BootConfig) { if VDBG {println!("Looping to the next section");} } - println!("Done with sections, zeroing out remaining data"); - // Zero-out the trailing bytes - unsafe { - bzero( - top.add(previous_addr as usize & (PAGE_SIZE - 1)), - top.add(PAGE_SIZE as usize), - ) - }; + println!("Done with sections"); + if previous_addr as usize & (PAGE_SIZE - 1) != 0 { + println!("Zeroing out remaining data"); + // Zero-out the trailing bytes + unsafe { + bzero( + top.add(previous_addr as usize & (PAGE_SIZE - 1)), + top.add(PAGE_SIZE as usize), + ) + }; + } else { + println!("Skipping zero step -- we ended on a page boundary"); + } } else if tag.name == u32::from_le_bytes(*b"XKrn") { let prog = unsafe { &*(tag.data.as_ptr() as *const ProgramDescription) };