Skip to content

Commit 981fd0c

Browse files
GUIDINGLIxiaoxiang781216
authored andcommitted
xtesa: fix lost save & restore states caused by merge code
this is caused by: 35c8c80 Signed-off-by: ligd <[email protected]>
1 parent 8829f38 commit 981fd0c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

arch/xtensa/src/common/xtensa_switchcontext.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,24 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
5959
{
6060
/* Are we in an interrupt handler? */
6161

62-
if (!up_current_regs())
62+
if (up_current_regs())
63+
{
64+
/* Yes, then we have to do things differently.
65+
* Just copy the current_regs into the OLD rtcb.
66+
*/
67+
68+
xtensa_savestate(rtcb->xcp.regs);
69+
70+
/* Then switch contexts. Any necessary address environment
71+
* changes will be made when the interrupt returns.
72+
*/
73+
74+
xtensa_restorestate(tcb->xcp.regs);
75+
}
76+
77+
/* No, then we will need to perform the user context switch */
78+
79+
else
6380
{
6481
/* Switch context to the context of the task at the head of the
6582
* ready to run list.

0 commit comments

Comments
 (0)