Skip to content

Commit d5854b6

Browse files
committed
riscv/nsbi: halt upon sbi_mexception
This avoids endless restart if NuttSBI fails to enter S-mode. Signed-off-by: Yanfeng Liu <[email protected]>
1 parent 846581f commit d5854b6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arch/risc-v/src/nuttsbi/sbi_mexception.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <nuttx/config.h>
2626

27+
#include <debug.h>
2728
#include <stdint.h>
2829

2930
/****************************************************************************
@@ -32,7 +33,10 @@
3233

3334
void sbi_mexception(uintreg_t mcause, uintreg_t *mepc, uintreg_t tval)
3435
{
35-
UNUSED(mcause);
36-
UNUSED(mepc);
37-
UNUSED(tval);
36+
sinfo("cauz=%"PRIxREG" epc=%p tval=0x%"PRIxREG"\n", mcause, mepc, tval);
37+
38+
while (1)
39+
{
40+
__asm__ __volatile__("wfi");
41+
}
3842
}

0 commit comments

Comments
 (0)