From 88f5a209ce38811100184db0e89a85694191bf71 Mon Sep 17 00:00:00 2001 From: zhuyanlin Date: Mon, 10 Jan 2022 17:39:22 +0800 Subject: [PATCH] xtensa: move a3 save in handler instead of _xtensa_context_save As in _xtensa_syscall_handler, a3 was save and reused before _xtensa_context_save, a3 save in _xtensa_context_save will generate error. Signed-off-by: zhuyanlin --- arch/xtensa/src/common/xtensa_context.S | 1 - arch/xtensa/src/common/xtensa_int_handlers.S | 6 ++++++ arch/xtensa/src/common/xtensa_panic.S | 1 + arch/xtensa/src/common/xtensa_user_handler.S | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/xtensa/src/common/xtensa_context.S b/arch/xtensa/src/common/xtensa_context.S index 08c13fb8164..a733b3ab44b 100644 --- a/arch/xtensa/src/common/xtensa_context.S +++ b/arch/xtensa/src/common/xtensa_context.S @@ -115,7 +115,6 @@ _xtensa_context_save: - s32i a3, a2, (4 * REG_A3) s32i a4, a2, (4 * REG_A4) s32i a5, a2, (4 * REG_A5) s32i a6, a2, (4 * REG_A6) diff --git a/arch/xtensa/src/common/xtensa_int_handlers.S b/arch/xtensa/src/common/xtensa_int_handlers.S index c544b511132..928a9654026 100644 --- a/arch/xtensa/src/common/xtensa_int_handlers.S +++ b/arch/xtensa/src/common/xtensa_int_handlers.S @@ -312,6 +312,7 @@ _xtensa_level1_handler: s32i a2, sp, (4 * REG_A2) mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Save current SP before (possibly) overwriting it, it's the register save @@ -415,6 +416,7 @@ _xtensa_level2_handler: s32i a2, sp, (4 * REG_A2) mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Save current SP before (possibly) overwriting it, it's the register save @@ -493,6 +495,7 @@ _xtensa_level3_handler: s32i a2, sp, (4 * REG_A2) mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Save current SP before (possibly) overwriting it, it's the register save @@ -571,6 +574,7 @@ _xtensa_level4_handler: s32i a2, sp, (4 * REG_A2) mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Save current SP before (possibly) overwriting it, it's the register save @@ -649,6 +653,7 @@ _xtensa_level5_handler: s32i a2, sp, (4 * REG_A2) mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Save current SP before (possibly) overwriting it, it's the register save @@ -727,6 +732,7 @@ _xtensa_level6_handler: s32i a2, sp, (4 * REG_A2) mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Save current SP before (possibly) overwriting it, it's the register save diff --git a/arch/xtensa/src/common/xtensa_panic.S b/arch/xtensa/src/common/xtensa_panic.S index 8d0f0979462..d68567db2df 100644 --- a/arch/xtensa/src/common/xtensa_panic.S +++ b/arch/xtensa/src/common/xtensa_panic.S @@ -127,6 +127,7 @@ _xtensa_panic: */ mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Switch to an interrupt stack if we have one */ diff --git a/arch/xtensa/src/common/xtensa_user_handler.S b/arch/xtensa/src/common/xtensa_user_handler.S index d25d662b458..190d5098c78 100644 --- a/arch/xtensa/src/common/xtensa_user_handler.S +++ b/arch/xtensa/src/common/xtensa_user_handler.S @@ -223,6 +223,7 @@ _xtensa_user_handler: s32i a2, sp, (4 * REG_A2) mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Save current SP before (possibly) overwriting it, @@ -517,6 +518,7 @@ _xtensa_coproc_handler: s32i a2, sp, (4 * REG_A2) mov a2, sp /* Address of state save on stack */ + s32i a3, sp, (4 * REG_A3) call0 _xtensa_context_save /* Save full register state */ /* Switch to an interrupt stack if we have one */