RT-Thread Version
master
Hardware Type/Architectures
RISC-V with CLIC Interrupt
Develop Toolchain
GCC
Describe the bug
The interrupt handling logic for risc-v, see as below
|
csrrw sp,mscratch,sp |
|
/* interrupt handle */ |
|
call rt_interrupt_enter |
|
/* Do the work after saving the above */ |
|
jal rt_hw_do_after_save_above |
|
|
|
call rt_interrupt_leave |
|
/* switch to from thread stack */ |
|
csrrw sp,mscratch,sp |
In line 101, if another higher priority interrupt is nested(since in rt_hw_do_after_save_above, it will re-enable interrupt to allow higher priority interrupt), then it will switch from interrupt stack to task stack. I think if interrupt nesting is supported, it is better to nest in the interrupt stack to avoid corrupting the task stack.
Maybe here it should check whether interrupt is nesting or not to determine whether switch between interrupt stack and task stack.
Thanks
Other additional context
No response
RT-Thread Version
master
Hardware Type/Architectures
RISC-V with CLIC Interrupt
Develop Toolchain
GCC
Describe the bug
The interrupt handling logic for risc-v, see as below
rt-thread/libcpu/risc-v/common/interrupt_gcc.S
Lines 101 to 109 in fcd0b1e
In line 101, if another higher priority interrupt is nested(since in
rt_hw_do_after_save_above, it will re-enable interrupt to allow higher priority interrupt), then it will switch frominterrupt stacktotask stack. I think if interrupt nesting is supported, it is better to nest in the interrupt stack to avoid corrupting thetask stack.Maybe here it should check whether interrupt is nesting or not to determine whether switch between
interrupt stackandtask stack.Thanks
Other additional context
No response