diff --git a/arch/avr/src/avr/avr_switchcontext.c b/arch/avr/src/avr/avr_switchcontext.c index 0b3bd586ed..bd7194f306 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 ea150f6633..71316ed163 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 7ea2c275ab..f75ee8576b 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 c19cf847ed..1e0921e251 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 b4a79c922b..9ff14868c9 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 fc8d9d703d..83a845ad6f 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 2ab1e358d2..b1d7f1147c 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 f076ba3701..e703b996ff 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 fde1cd3c0d..08fdab1378 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);