diff --git a/arch/avr/src/avr/avr_switchcontext.c b/arch/avr/src/avr/avr_switchcontext.c index 0b3bd586ed9..bd7194f3062 100644 --- a/arch/avr/src/avr/avr_switchcontext.c +++ b/arch/avr/src/avr/avr_switchcontext.c @@ -85,6 +85,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Switch context to the context of the task at the head of the * ready to run list. */ diff --git a/arch/avr/src/avr32/avr_switchcontext.c b/arch/avr/src/avr32/avr_switchcontext.c index ea150f66331..71316ed163f 100644 --- a/arch/avr/src/avr32/avr_switchcontext.c +++ b/arch/avr/src/avr32/avr_switchcontext.c @@ -99,6 +99,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ avr_switchcontext(rtcb->xcp.regs, tcb->xcp.regs); diff --git a/arch/hc/src/common/hc_switchcontext.c b/arch/hc/src/common/hc_switchcontext.c index 7ea2c275abd..f75ee8576b8 100644 --- a/arch/hc/src/common/hc_switchcontext.c +++ b/arch/hc/src/common/hc_switchcontext.c @@ -102,6 +102,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ hc_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/or1k/src/common/or1k_switchcontext.c b/arch/or1k/src/common/or1k_switchcontext.c index c19cf847ed9..1e0921e2512 100644 --- a/arch/or1k/src/common/or1k_switchcontext.c +++ b/arch/or1k/src/common/or1k_switchcontext.c @@ -106,6 +106,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ or1k_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/renesas/src/common/renesas_switchcontext.c b/arch/renesas/src/common/renesas_switchcontext.c index b4a79c922b2..9ff14868c91 100644 --- a/arch/renesas/src/common/renesas_switchcontext.c +++ b/arch/renesas/src/common/renesas_switchcontext.c @@ -102,6 +102,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ renesas_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/sim/src/sim/sim_switchcontext.c b/arch/sim/src/sim/sim_switchcontext.c index fc8d9d703df..83a845ad6f4 100644 --- a/arch/sim/src/sim/sim_switchcontext.c +++ b/arch/sim/src/sim/sim_switchcontext.c @@ -105,6 +105,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) restore_critical_section(tcb, this_cpu()); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ sim_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/x86/src/common/x86_switchcontext.c b/arch/x86/src/common/x86_switchcontext.c index 2ab1e358d2c..b1d7f1147c1 100644 --- a/arch/x86/src/common/x86_switchcontext.c +++ b/arch/x86/src/common/x86_switchcontext.c @@ -102,6 +102,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ x86_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/z16/src/common/z16_switchcontext.c b/arch/z16/src/common/z16_switchcontext.c index f076ba37011..e703b996ffb 100644 --- a/arch/z16/src/common/z16_switchcontext.c +++ b/arch/z16/src/common/z16_switchcontext.c @@ -93,6 +93,10 @@ void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ RESTORE_USERCONTEXT(tcb); diff --git a/arch/z80/src/common/z80_switchcontext.c b/arch/z80/src/common/z80_switchcontext.c index fde1cd3c0d1..08fdab13788 100644 --- a/arch/z80/src/common/z80_switchcontext.c +++ b/arch/z80/src/common/z80_switchcontext.c @@ -105,6 +105,10 @@ void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ RESTORE_USERCONTEXT(tcb);