mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
arch: replace all nxsched_suspend/resume_*** with nxsched_switch_context
Complete the missing scheduling information in some architectures In these architectures (riscv, avr, tricor) context switching can occur in both up_switch_context and xx_doirq Co-authored-by: yinshengkai <yinshengkai@xiaomi.com> Signed-off-by: guoshengyuan1 <guoshengyuan1@xiaomi.com>
This commit is contained in:
@@ -96,12 +96,18 @@ uint8_t *avr_doirq(uint8_t irq, uint8_t *regs)
|
||||
|
||||
if (regs != up_current_regs())
|
||||
{
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
*/
|
||||
|
||||
*running_task = this_task();
|
||||
*running_task = tcb;
|
||||
}
|
||||
|
||||
regs = up_current_regs(); /* Cast removes volatile attribute */
|
||||
|
||||
@@ -56,10 +56,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -70,10 +66,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
avr_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
avr_restorestate(tcb->xcp.regs);
|
||||
@@ -85,7 +77,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Record the new "running" task */
|
||||
|
||||
|
||||
@@ -109,6 +109,10 @@ uint32_t *avr_doirq(int irq, uint32_t *regs)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -72,10 +68,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
avr_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any new address environment needed by
|
||||
* the new thread will be instantiated before the return from
|
||||
* interrupt.
|
||||
@@ -99,7 +91,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Record the new "running" task */
|
||||
|
||||
|
||||
@@ -87,17 +87,18 @@ uint32_t *ceva_doirq(int irq, uint32_t *regs)
|
||||
|
||||
if (regs != up_current_regs())
|
||||
{
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(*running_task);
|
||||
nxsched_resume_scheduler(this_task());
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
*/
|
||||
|
||||
g_running_tasks[this_cpu()] = this_task();
|
||||
*running_task = tcb;
|
||||
regs = up_current_regs();
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
else
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Switch context to the context of the task at the head of the
|
||||
* ready to run list.
|
||||
*/
|
||||
|
||||
@@ -109,6 +109,10 @@ uint8_t *hc_doirq(int irq, uint8_t *regs)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -72,10 +68,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
hc_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -102,7 +94,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Record the new "running" task */
|
||||
|
||||
|
||||
@@ -118,12 +118,16 @@ uint32_t *mips_doirq(int irq, uint32_t *regs)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
*/
|
||||
|
||||
g_running_tasks[this_cpu()] = tcb;
|
||||
*running_task = tcb;
|
||||
}
|
||||
|
||||
/* If a context switch occurred while processing the interrupt then
|
||||
|
||||
@@ -59,10 +59,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -73,10 +69,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
mips_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -90,7 +82,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
||||
@@ -103,6 +103,10 @@ uint32_t *lm32_doirq(int irq, uint32_t *regs)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
|
||||
@@ -59,10 +59,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -73,10 +69,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
misoc_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -90,7 +82,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
||||
@@ -102,12 +102,16 @@ uint32_t *minerva_doirq(int irq, uint32_t * regs)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
*/
|
||||
|
||||
g_running_tasks[this_cpu()] = tcb;
|
||||
*running_task = tcb;
|
||||
}
|
||||
|
||||
/* If a context switch occurred while processing the interrupt then
|
||||
|
||||
@@ -59,10 +59,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -73,10 +69,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
misoc_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment changes
|
||||
* will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -90,7 +82,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
||||
@@ -78,6 +78,10 @@ uint32_t *or1k_doirq(int irq, uint32_t *regs)
|
||||
|
||||
if (regs != up_current_regs())
|
||||
{
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
#if 0 /* REVISIT */
|
||||
@@ -76,10 +72,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
or1k_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -106,7 +98,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Record the new "running" task */
|
||||
|
||||
|
||||
@@ -112,6 +112,10 @@ uint32_t *renesas_doirq(int irq, uint32_t * regs)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -72,10 +68,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
renesas_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -102,7 +94,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Record the new "running" task */
|
||||
|
||||
|
||||
@@ -128,12 +128,7 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs)
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
if (!restore_context)
|
||||
{
|
||||
nxsched_suspend_scheduler(*running_task);
|
||||
}
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
|
||||
@@ -80,6 +80,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
else
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
riscv_switchcontext();
|
||||
|
||||
@@ -73,11 +73,9 @@ void *riscv_perform_syscall(uintreg_t *regs)
|
||||
|
||||
if (!restore_context)
|
||||
{
|
||||
nxsched_suspend_scheduler(*running_task);
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
}
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Record the new "running" task. g_running_tasks[] is only used by
|
||||
* assertion logic for reporting crashes.
|
||||
*/
|
||||
|
||||
@@ -83,12 +83,18 @@ void *sim_doirq(int irq, void *context)
|
||||
|
||||
if (regs != up_current_regs())
|
||||
{
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
*/
|
||||
|
||||
*running_task = this_task();
|
||||
*running_task = tcb;
|
||||
}
|
||||
|
||||
regs = up_current_regs();
|
||||
|
||||
@@ -60,10 +60,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
sinfo("Unblocking TCB=%p\n", tcb);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_interrupt_context())
|
||||
@@ -74,10 +70,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
sim_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Restore the cpu lock */
|
||||
|
||||
restore_critical_section(tcb, this_cpu());
|
||||
@@ -101,7 +93,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Restore the cpu lock */
|
||||
|
||||
|
||||
@@ -113,12 +113,16 @@ uint32_t *sparc_doirq(int irq, uint32_t *regs)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
*/
|
||||
|
||||
g_running_tasks[this_cpu()] = tcb;
|
||||
*running_task = tcb;
|
||||
}
|
||||
|
||||
/* If a context switch occurred while processing the interrupt then
|
||||
|
||||
@@ -59,10 +59,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -73,10 +69,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
sparc_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -90,7 +82,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
||||
@@ -99,6 +99,10 @@ IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
|
||||
@@ -59,10 +59,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -73,10 +69,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
tricore_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -90,7 +82,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
|
||||
void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (up_current_regs())
|
||||
@@ -72,10 +68,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
x86_savestate(rtcb->xcp.regs);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
*/
|
||||
@@ -102,7 +94,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
#endif
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Record the new "running" task */
|
||||
|
||||
|
||||
@@ -125,8 +125,7 @@ static uint32_t *common_handler(int irq, uint32_t *regs)
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(*running_task);
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
|
||||
@@ -84,6 +84,7 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
else if (!up_saveusercontext(rtcb->xcp.regs))
|
||||
{
|
||||
struct tcb_s **running_task;
|
||||
cpu = this_cpu();
|
||||
|
||||
x86_64_restore_auxstate(tcb);
|
||||
@@ -104,14 +105,15 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(g_running_tasks[cpu]);
|
||||
nxsched_resume_scheduler(current_task(cpu));
|
||||
running_task = &g_running_tasks[cpu];
|
||||
tcb = current_task(cpu);
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task. g_running_tasks[] is only used by
|
||||
* assertion logic for reporting crashes.
|
||||
*/
|
||||
|
||||
g_running_tasks[cpu] = current_task(cpu);
|
||||
*running_task = tcb;
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
||||
@@ -106,8 +106,7 @@ static uint64_t *common_handler(int irq, uint64_t *regs)
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(*running_task);
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
|
||||
@@ -97,8 +97,7 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs)
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(*running_task);
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
|
||||
@@ -92,12 +92,18 @@ FAR chipreg_t *z16_doirq(int irq, FAR chipreg_t *regs)
|
||||
|
||||
if (regs != up_current_regs())
|
||||
{
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Update scheduler parameters. */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
*/
|
||||
|
||||
*running_task = this_task();
|
||||
*running_task = tcb;
|
||||
}
|
||||
|
||||
/* Restore the previous value of g_current_regs. NULL would indicate
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
|
||||
void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (IN_INTERRUPT)
|
||||
@@ -72,10 +68,6 @@ void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
|
||||
|
||||
SAVE_IRQCONTEXT(rtcb);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then setup so that the context will be performed on exit
|
||||
* from the interrupt.
|
||||
*/
|
||||
@@ -93,7 +85,7 @@ void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Record the new "running" task */
|
||||
|
||||
|
||||
@@ -95,6 +95,10 @@ FAR chipreg_t *z80_doirq(uint8_t irq, FAR chipreg_t *regs)
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_switch_context(*running_task, tcb);
|
||||
|
||||
/* Record the new "running" task when context switch occurred.
|
||||
* g_running_tasks[] is only used by assertion logic for reporting
|
||||
* crashes.
|
||||
|
||||
@@ -60,10 +60,6 @@
|
||||
|
||||
void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
|
||||
{
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_suspend_scheduler(rtcb);
|
||||
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (IN_INTERRUPT())
|
||||
@@ -74,10 +70,6 @@ void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
|
||||
|
||||
SAVE_IRQCONTEXT(rtcb);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
|
||||
/* Then setup so that the context will be performed on exit
|
||||
* from the interrupt. Any necessary address environment
|
||||
* changes will be made when the interrupt returns.
|
||||
@@ -103,9 +95,10 @@ void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb)
|
||||
|
||||
addrenv_switch(tcb);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(tcb);
|
||||
nxsched_switch_context(rtcb, tcb);
|
||||
|
||||
/* Record the new "running" task */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user