mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
quiet down warnings when debug-print is off
because the print! macro becomes a dummy when debug printing is off, we get a bunch of warnings about unused variables because the print! arguments aren't used. Add _ before variable names to quiet these warnings.
This commit is contained in:
parent
353f4d5f1b
commit
b7becf27e7
4 changed files with 26 additions and 23 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<usize> {
|
|||
}
|
||||
}
|
||||
|
||||
#[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<usize> {
|
||||
let l1_pt = unsafe { &mut (*((root << 12) as *mut PageTable)) };
|
||||
let l1_entry_va = (l1_pt.entries[(va & 0xFFC0_0000) >> 22] >> 10) << 12;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue