From fb502a80733427fa0be657cda9181c8e70b4275f Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 26 May 2024 12:12:58 +0800 Subject: [PATCH] debug cleanup --- kernel/src/swap.rs | 6 +++--- kernel/src/syscall.rs | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/src/swap.rs b/kernel/src/swap.rs index fe95b91c2..fe3e09c4d 100644 --- a/kernel/src/swap.rs +++ b/kernel/src/swap.rs @@ -452,7 +452,7 @@ impl Swap { self.oom_thread_backing = Some(crate::arch::process::Process::with_current(|p| p.current_thread().clone())); - println!("Entering inline hard OOM handler"); + #[cfg(feature = "debug-swap")] crate::arch::process::Process::with_current(|p| { println!( "BEF HARD OOM HANDLER {}.{} sepc: {:x} sstatus: {:x?} satp: {:x?}", @@ -486,7 +486,7 @@ impl Swap { current_sp = out(reg) current_sp, ) } - println!(" --> SP extent d'{} bytes", EXCEPTION_STACK_TOP - current_sp); + println!(" --> HARD OOM SP extent d'{} bytes", EXCEPTION_STACK_TOP - current_sp); // make a backup copy of the stack let backup_stack_ptr: usize = self.oom_stack_backing.as_ptr() as usize; let working_stack_end: usize = EXCEPTION_STACK_TOP; @@ -545,6 +545,7 @@ impl Swap { ) } + #[cfg(feature = "debug-swap")] crate::arch::process::Process::with_current(|p| { println!( "AFT HARD OOM HANDLER {}.{} sepc: {:x} sstatus: {:x?} satp: {:x?}", @@ -558,7 +559,6 @@ impl Swap { // then restore the smashed thread backing state on return from the syscall crate::arch::process::Process::with_current_mut(|p| { - println!("Returned from hard OOM handler, current pid {}/tid {}", p.pid().get(), p.current_tid()); *p.current_thread_mut() = self.oom_thread_backing.take().expect("No thread backing was set prior to OOM handler") }); diff --git a/kernel/src/syscall.rs b/kernel/src/syscall.rs index 5d30a6706..2f0002784 100644 --- a/kernel/src/syscall.rs +++ b/kernel/src/syscall.rs @@ -1042,10 +1042,11 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR vaddr, ) { Ok(ptr) => Ok(xous_kernel::Result::Scalar5(ptr, 0, 0, 0, 0)), - Err(e) => { + Err(_e) => { + #[cfg(feature = "debug-swap")] println!( "steal_page rejecting request for pid{}/{:x}: {:?}", - target_pid, vaddr, e + target_pid, vaddr, _e ); Err(xous_kernel::Error::BadAddress) }