Skip to content

Commit b32c5e2

Browse files
ycsinaescolar
authored andcommitted
arch: riscv: only use z_riscv_fatal_error_csf if CONFIG_EXCEPTION_DEBUG
Use `z_riscv_fatal_error_csf` that expects the callee-saved-registers pointer only if `CONFIG_EXCEPTION_DEBUG` is enabled, otherwise use `z_riscv_fatal_error`, as there can be garbage in the `a2`. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
1 parent 6a0cdb4 commit b32c5e2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

arch/riscv/core/isr.S

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ GTEXT(__soc_save_context)
7878
GTEXT(__soc_restore_context)
7979
#endif /* CONFIG_RISCV_SOC_CONTEXT_SAVE */
8080

81+
#ifdef CONFIG_EXCEPTION_DEBUG
8182
GTEXT(z_riscv_fatal_error_csf)
83+
#else
84+
GTEXT(z_riscv_fatal_error)
85+
#endif /* CONFIG_EXCEPTION_DEBUG */
86+
8287
GTEXT(z_get_next_switch_handle)
8388
GTEXT(z_riscv_switch)
8489
GTEXT(z_riscv_thread_start)
@@ -411,9 +416,11 @@ do_fault:
411416
/* Save callee-saved registers to be passed as 3rd arg */
412417
STORE_CALLEE_SAVED() ;
413418
mv a2, sp
414-
#endif
415419

416420
tail z_riscv_fatal_error_csf
421+
#else
422+
tail z_riscv_fatal_error
423+
#endif
417424

418425
#if defined(CONFIG_IRQ_OFFLOAD)
419426
do_irq_offload:

0 commit comments

Comments
 (0)