arch32: Fix incorrect exc_exit sequence
The incorrect sequence will cause the thread cannot be aborted in the ISR context. The following test case failed: tests/kernel/fatal/exception/kernel.common.stack_sentinel. The stack sentinel detects the stack overflow as normal during a timer ISR exit. Note that, currently, the stack overflow detection is behind the context switch checking, and then the detection will call svc to raise a fatal error resulting in increasing the nested counter(+1). At this point, it needs a context switch to finally abort the thread. However, after the fatal error handling, the program cannot do a context switch either during the svc exit[1], or during the timer ISR exit[2]. [1] is because the svc context is in an interrupt nested state (the nested counter is 2). [2] is because the current point (after svc context pop out) is right behind the switch checking. Signed-off-by: Jaxson Han <jaxson.han@arm.com>
This commit is contained in:
parent
05512aaef2
commit
a7a8a64e9c
1 changed files with 4 additions and 4 deletions
|
@ -86,6 +86,10 @@ system_thread_exit\@:
|
||||||
*/
|
*/
|
||||||
SECTION_SUBSEC_FUNC(TEXT, _HandlerModeExit, z_arm_int_exit)
|
SECTION_SUBSEC_FUNC(TEXT, _HandlerModeExit, z_arm_int_exit)
|
||||||
|
|
||||||
|
#ifdef CONFIG_STACK_SENTINEL
|
||||||
|
bl z_check_stack_sentinel
|
||||||
|
#endif /* CONFIG_STACK_SENTINEL */
|
||||||
|
|
||||||
#ifdef CONFIG_PREEMPT_ENABLED
|
#ifdef CONFIG_PREEMPT_ENABLED
|
||||||
/* Do not context switch if exiting a nested interrupt */
|
/* Do not context switch if exiting a nested interrupt */
|
||||||
ldr r3, =_kernel
|
ldr r3, =_kernel
|
||||||
|
@ -100,10 +104,6 @@ SECTION_SUBSEC_FUNC(TEXT, _HandlerModeExit, z_arm_int_exit)
|
||||||
__EXIT_INT:
|
__EXIT_INT:
|
||||||
#endif /* CONFIG_PREEMPT_ENABLED */
|
#endif /* CONFIG_PREEMPT_ENABLED */
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_SENTINEL
|
|
||||||
bl z_check_stack_sentinel
|
|
||||||
#endif /* CONFIG_STACK_SENTINEL */
|
|
||||||
|
|
||||||
/* Disable nested interrupts while exiting */
|
/* Disable nested interrupts while exiting */
|
||||||
cpsid i
|
cpsid i
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue