From ecf2396d0cf20103d94e21d1c6bf0f279b37ee8b Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 28 Apr 2024 02:41:29 +0800 Subject: [PATCH] put debug prints behind debug flags --- kernel/src/arch/riscv/irq.rs | 1 + kernel/src/arch/riscv/syscall.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/src/arch/riscv/irq.rs b/kernel/src/arch/riscv/irq.rs index 8af51eb92..3f4c79964 100644 --- a/kernel/src/arch/riscv/irq.rs +++ b/kernel/src/arch/riscv/irq.rs @@ -190,6 +190,7 @@ pub extern "C" fn trap_handler( { let pid = current_pid(); let ex = RiscvException::from_regs(sc.bits(), sepc::read(), stval::read()); + #[cfg(feature = "debug-print")] println!("IRQ -- KERNEL({}): RISC-V fault: {}", pid, ex); } match ex { diff --git a/kernel/src/arch/riscv/syscall.rs b/kernel/src/arch/riscv/syscall.rs index 1265d4582..dd0e9187e 100644 --- a/kernel/src/arch/riscv/syscall.rs +++ b/kernel/src/arch/riscv/syscall.rs @@ -33,7 +33,7 @@ pub fn resume(supervisor: bool, thread: &Thread) -> ! { // Return to the appropriate CPU mode set_supervisor(supervisor); - + #[cfg(feature = "debug-print")] println!( "Switching to PID {}, SP: {:08x}, PC: {:08x}", crate::arch::current_pid(),