Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion arch/xtensa/src/common/xtensa_switchcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,24 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Are we in an interrupt handler? */

if (!up_current_regs())
if (up_current_regs())
{
/* Yes, then we have to do things differently.
* Just copy the current_regs into the OLD rtcb.
*/

xtensa_savestate(rtcb->xcp.regs);

/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/

xtensa_restorestate(tcb->xcp.regs);
}

/* No, then we will need to perform the user context switch */

else
{
/* Switch context to the context of the task at the head of the
* ready to run list.
Expand Down