Skip to content

Commit

Permalink
xtensa_user_handler.S: Fix backtrace.
Browse files Browse the repository at this point in the history
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
  • Loading branch information
Ouss4 committed Apr 22, 2022
1 parent 51ea23a commit 897f1e2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions arch/xtensa/src/common/xtensa_user_handler.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 897f1e2

Please sign in to comment.