From 19f68edbb444f0fbe5095089e0649b63577a4fc0 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 6 Aug 2021 11:34:50 +0800 Subject: [PATCH] kernel: riscv: allow exceptions with NULL pc When the program counter is NULL, we can still get exceptions. This happens when we jump to an invalid address, for example. Signed-off-by: Sean Cross --- kernel/src/arch/riscv/exception.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/src/arch/riscv/exception.rs b/kernel/src/arch/riscv/exception.rs index fbe668069..7b795df53 100644 --- a/kernel/src/arch/riscv/exception.rs +++ b/kernel/src/arch/riscv/exception.rs @@ -177,7 +177,7 @@ impl RiscvException { pub fn from_regs(cause: usize, epc: usize, tval: usize) -> RiscvException { use RiscvException::*; - if epc == 0 && tval == 0 { + if epc == 0 && tval == 0 && cause == 0 { return NoException; }