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 <sean@xobs.io>
This commit is contained in:
Sean Cross 2021-08-06 11:34:50 +08:00
parent 08b787a03e
commit 19f68edbb4

View file

@ -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;
}