diff --git a/loader/src/main.rs b/loader/src/main.rs index de5ab0e69..6dce704e5 100644 --- a/loader/src/main.rs +++ b/loader/src/main.rs @@ -217,10 +217,10 @@ fn boot_sequence(args: KernelArguments, _signature: u32, fs_prehash: [u8; 64]) - if SDBG && VDBG { // activate to debug stack smashes. RPT should be 0's here (or at least valid PIDs) if stack did // not overflow. - for (i, r) in + for (_i, _r) in cfg.runtime_page_tracker[cfg.runtime_page_tracker.len() - 1024..].chunks(32).enumerate() { - println!(" rpt {:08x}: {:02x?}", cfg.runtime_page_tracker.len() - 1024 + i * 32, r); + println!(" rpt {:08x}: {:02x?}", cfg.runtime_page_tracker.len() - 1024 + _i * 32, _r); } } // Add a static check for stack overflow, using a heuristic that the last 64 bytes of the RPT diff --git a/loader/src/minielf.rs b/loader/src/minielf.rs index 29b7f9cfb..da8721707 100644 --- a/loader/src/minielf.rs +++ b/loader/src/minielf.rs @@ -424,13 +424,13 @@ impl MiniElf { let tt = { allocator.processes[pid as usize - 1].ttbr0 }; let mut section_offset = 0; - for (index, section) in self.sections.iter().enumerate() { + for (_index, section) in self.sections.iter().enumerate() { match ini_type { IniType::IniE | IniType::IniF => { if let Some(dest_offset) = pt_walk(tt, section.virt as usize) { println!( " Section {} start 0x{:x}(PA src), 0x{:x}(VA dst), 0x{:x}(PA dst) len {}/0x{:x}", - index, + _index, section_offset + image_phys_base, section.virt as usize, dest_offset, @@ -458,7 +458,7 @@ impl MiniElf { } else { println!( " Section {} start 0x{:x}(PA src), 0x{:x}(VA dst), ERR UNMAPPED!!", - index, + _index, section_offset + image_phys_base, section.virt as usize + section_offset ); @@ -473,7 +473,7 @@ impl MiniElf { ) { println!( " Section {} start 0x{:x}(PA src), 0x{:x}(VA dst), 0x{:x}(PA dst) len {}/0x{:x}", - index, + _index, section_offset + image_phys_base, section.virt as usize, dest_offset, @@ -530,7 +530,7 @@ impl MiniElf { } else { println!( " Section {} start 0x{:x}(PA src), 0x{:x}(VA dst), ERR UNMAPPED!!", - index, + _index, section_offset + image_phys_base, section.virt as usize + section_offset ); @@ -543,21 +543,23 @@ impl MiniElf { } #[cfg(any(feature = "debug-print", feature = "swap"))] -fn dump_addr(addr: usize, label: &str) { - print!("{}", label); +fn dump_addr(addr: usize, _label: &str) { + // A lot of variables are _'d because when debug-print is turned off, the variable resolves + // as unused (because the print macros are dummies). + print!("{}", _label); let slice = unsafe { core::slice::from_raw_parts(addr as *const u8, 20) }; - for &b in slice { - print!("{:02x}", b); + for &_b in slice { + print!("{:02x}", _b); } print!("\n\r"); } #[cfg(feature = "swap")] -fn dump_slice(slice: &[u8], label: &str) { - print!("{}", label); +fn dump_slice(slice: &[u8], _label: &str) { + print!("{}", _label); // handle case that our decrypt region isn't 20 bytes long... let len = slice.len().min(20); - for &b in &slice[..len] { - print!("{:02x}", b); + for &_b in &slice[..len] { + print!("{:02x}", _b); } print!("\n\r"); } @@ -580,7 +582,7 @@ pub fn pt_walk(root: usize, va: usize) -> Option { } } -#[cfg(all(feature = "debug-print", feature = "swap", not(feature = "atsama5d27")))] +#[cfg(all(any(feature = "debug-print", feature = "swap"), not(feature = "atsama5d27")))] pub fn pt_walk_swap(root: usize, va: usize, swap_root: usize) -> Option { let l1_pt = unsafe { &mut (*((root << 12) as *mut PageTable)) }; let l1_entry_va = (l1_pt.entries[(va & 0xFFC0_0000) >> 22] >> 10) << 12; diff --git a/loader/src/phase1.rs b/loader/src/phase1.rs index 6474caa9f..e3fc37b43 100644 --- a/loader/src/phase1.rs +++ b/loader/src/phase1.rs @@ -85,9 +85,10 @@ pub fn phase_1(cfg: &mut BootConfig) { // smashed if the stack overflows! It should be all 0's if the stack did not overrun. #[cfg(feature = "swap")] if SDBG && VDBG { - for (i, r) in cfg.runtime_page_tracker[cfg.runtime_page_tracker.len() - 1024..].chunks(32).enumerate() + for (_i, _r) in + cfg.runtime_page_tracker[cfg.runtime_page_tracker.len() - 1024..].chunks(32).enumerate() { - println!(" rpt {:08x}: {:02x?}", cfg.runtime_page_tracker.len() - 1024 + i * 32, r); + println!(" rpt {:08x}: {:02x?}", cfg.runtime_page_tracker.len() - 1024 + _i * 32, _r); } } diff --git a/loader/src/phase2.rs b/loader/src/phase2.rs index 03a41b49f..bd736c89a 100644 --- a/loader/src/phase2.rs +++ b/loader/src/phase2.rs @@ -162,9 +162,9 @@ pub fn phase_2(cfg: &mut BootConfig, fs_prehash: &[u8; 64]) { #[cfg(feature = "swap")] if SDBG && VDBG { // dumps the page with kernel struct data, so we can correlate offsets to data. - for i in (0..4096).step_by(32) { - println!("{:08x}: {:02x?}", krn_struct_start + i, unsafe { - core::slice::from_raw_parts((krn_struct_start + i) as *const u8, 32) + for _i in (0..4096).step_by(32) { + println!("{:08x}: {:02x?}", krn_struct_start + _i, unsafe { + core::slice::from_raw_parts((krn_struct_start + _i) as *const u8, 32) }); } } @@ -341,9 +341,9 @@ pub fn phase_2(cfg: &mut BootConfig, fs_prehash: &[u8; 64]) { #[cfg(feature = "swap")] if SDBG && VVDBG { println!("Occupied RPT entries:"); - for (i, entry) in cfg.runtime_page_tracker.iter().enumerate() { + for (_i, entry) in cfg.runtime_page_tracker.iter().enumerate() { if entry.raw_vpn() != 0 { - println!(" {:x}: {:x} [{}]", i, entry.raw_vpn(), entry.timestamp()); + println!(" {:x}: {:x} [{}]", _i, entry.raw_vpn(), entry.timestamp()); } } }