xtensa_user_handler.S: Fix backtrace.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2022-04-22 15:42:59 +02:00 committed by Xiang Xiao
parent 7a3ad4b224
commit f130d8c143

View File

@ -220,6 +220,10 @@ _xtensa_user_handler:
s32i a0, sp, (4 * REG_A0)
s32i a2, sp, (4 * REG_A2)
#ifdef CONFIG_XTENSA_INTBACKTRACE
wsr sp, EXCSAVE_1
#endif
/* Save EXCCAUSE and EXCVADDR into the user frame */
rsr a0, EXCCAUSE
@ -252,10 +256,12 @@ _xtensa_user_handler:
*/
#ifdef CONFIG_XTENSA_INTBACKTRACE
l32i a3, sp, (4 * REG_A0) /* Copy pre-exception a0 (return address) */
rsr a0, EXCSAVE_1 /* Get exception frame pointer stored in EXCSAVE_1 */
l32i a3, a0, (4 * REG_A0) /* Copy pre-exception a0 (return address) */
s32e a3, sp, -16
l32i a3, sp, (4 * REG_A1) /* Copy pre-exception a1 (stack pointer) */
l32i a3, a0, (4 * REG_A1) /* Copy pre-exception a1 (stack pointer) */
s32e a3, sp, -12
rsr a0, EPC_1 /* return address for debug backtrace */
movi a4, 0xc0000000 /* constant with top 2 bits set (call size) */
or a0, a0, a4 /* set top 2 bits */