From 56ef1419dd3484c72a3285d7c05b7ee65f0a88cf Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Tue, 14 Dec 2021 18:16:07 +0800 Subject: [PATCH] arch/xtensa: set the current reg before print syslog ensure the semantics of the up_interrupt_context() works as expected Signed-off-by: chao.an --- arch/xtensa/src/common/xtensa_assert.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/xtensa/src/common/xtensa_assert.c b/arch/xtensa/src/common/xtensa_assert.c index 25460342961..b9542b97289 100644 --- a/arch/xtensa/src/common/xtensa_assert.c +++ b/arch/xtensa/src/common/xtensa_assert.c @@ -189,6 +189,8 @@ void up_assert(const char *filename, int lineno) void xtensa_panic(int xptcode, uint32_t *regs) { + CURRENT_REGS = regs; + /* We get here when a un-dispatch-able, irrecoverable exception occurs */ board_autoled_on(LED_ASSERTION); @@ -203,7 +205,6 @@ void xtensa_panic(int xptcode, uint32_t *regs) _alert("Unhandled Exception %d\n", xptcode); #endif - CURRENT_REGS = regs; xtensa_assert(); /* Should not return */ for (; ; ); } @@ -290,6 +291,8 @@ void xtensa_panic(int xptcode, uint32_t *regs) void xtensa_user_panic(int exccause, uint32_t *regs) { + CURRENT_REGS = regs; + /* We get here when a un-dispatch-able, irrecoverable exception occurs */ board_autoled_on(LED_ASSERTION); @@ -305,7 +308,6 @@ void xtensa_user_panic(int exccause, uint32_t *regs) _alert("User Exception: EXCCAUSE=%04x\n", exccause); #endif - CURRENT_REGS = regs; xtensa_assert(); /* Should not return */ for (; ; ); }