Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions arch/arm/src/arm/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
addrenv_switch(NULL);
#endif

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/src/armv6-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

if (regs != tcb->xcp.regs)
{
/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/src/armv7-a/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
addrenv_switch(NULL);
#endif

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
10 changes: 8 additions & 2 deletions arch/arm/src/armv7-a/arm_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,18 @@ uint32_t *arm_syscall(uint32_t *regs)
addrenv_switch(NULL);
#endif

cpu = this_cpu();
tcb = current_task(cpu);

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[cpu]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task. g_running_tasks[] is only used by
* assertion logic for reporting crashes.
*/

cpu = this_cpu();
tcb = current_task(cpu);
g_running_tasks[cpu] = tcb;

/* Restore the cpu lock */
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/src/armv7-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

if (regs != tcb->xcp.regs)
{
/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/src/armv7-r/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

if (regs != tcb->xcp.regs)
{
/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
8 changes: 7 additions & 1 deletion arch/arm/src/armv7-r/arm_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,11 +566,17 @@ uint32_t *arm_syscall(uint32_t *regs)

if (regs != tcb->xcp.regs)
{
cpu = this_cpu();

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[cpu]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task. g_running_tasks[] is only used by
* assertion logic for reporting crashes.
*/

cpu = this_cpu();
g_running_tasks[cpu] = tcb;

/* Restore the cpu lock */
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/src/armv8-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

if (regs != tcb->xcp.regs)
{
/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
8 changes: 7 additions & 1 deletion arch/arm/src/armv8-r/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,16 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
/* Deliver the IRQ */

irq_dispatch(irq, regs);
tcb = this_task();

if (regs != tcb->xcp.regs)
{
tcb = this_task();

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
8 changes: 7 additions & 1 deletion arch/arm/src/armv8-r/arm_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,17 @@ uint32_t *arm_syscall(uint32_t *regs)

if (regs != tcb->xcp.regs)
{
cpu = this_cpu();

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[cpu]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task. g_running_tasks[] is only used by
* assertion logic for reporting crashes.
*/

cpu = this_cpu();
g_running_tasks[cpu] = tcb;

/* Restore the cpu lock */
Expand Down
19 changes: 1 addition & 18 deletions arch/arm/src/common/arm_switchcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,10 @@

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_interrupt_context())
if (!up_interrupt_context())
{
/* Update scheduler parameters */

nxsched_resume_scheduler(tcb);
}

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

else
{
/* Update scheduler parameters */

nxsched_resume_scheduler(tcb);

/* Switch context to the context of the task at the head of the
* ready to run list.
*/
Expand Down
5 changes: 5 additions & 0 deletions arch/arm64/src/common/arm64_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ uint64_t *arm64_doirq(int irq, uint64_t * regs)
addrenv_switch(NULL);
#endif

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
19 changes: 1 addition & 18 deletions arch/arm64/src/common/arm64_switchcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,10 @@

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_interrupt_context())
if (!up_interrupt_context())
{
/* Update scheduler parameters */

nxsched_resume_scheduler(tcb);
}

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

else
{
/* Update scheduler parameters */

nxsched_resume_scheduler(tcb);

/* Switch context to the context of the task at the head of the
* ready to run list.
*/
Expand Down
10 changes: 8 additions & 2 deletions arch/arm64/src/common/arm64_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ uint64_t *arm64_syscall_switch(uint64_t * regs)

if ((uint64_t *)f_regs != ret_regs)
{
cpu = this_cpu();
tcb = current_task(cpu);

#ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously
* running task is closed down gracefully (data caches dump,
Expand All @@ -246,12 +249,15 @@ uint64_t *arm64_syscall_switch(uint64_t * regs)
addrenv_switch(NULL);
#endif

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[cpu]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task. g_running_tasks[] is only used by
* assertion logic for reporting crashes.
*/

cpu = this_cpu();
tcb = current_task(cpu);
g_running_tasks[cpu] = tcb;

/* Restore the cpu lock */
Expand Down
5 changes: 5 additions & 0 deletions arch/ceva/src/common/ceva_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ uint32_t *ceva_doirq(int irq, uint32_t *regs)

if (regs != up_current_regs())
{
/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(this_task());

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
12 changes: 0 additions & 12 deletions arch/ceva/src/common/ceva_switchcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ void ceva_switchcontext(uint32_t **saveregs, uint32_t *restoreregs)

void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)
{
/* Update scheduler parameters */

sched_suspend_scheduler(rtcb);

/* Are we in an interrupt handler? */

if (up_current_regs())
Expand All @@ -83,10 +79,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)

rtcb->xcp.regs = up_current_regs();

/* Update scheduler parameters */

sched_resume_scheduler(tcb);

/* Then switch contexts */

up_set_current_regs(tcb->xcp.regs);
Expand All @@ -96,10 +88,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)

else
{
/* Update scheduler parameters */

sched_resume_scheduler(tcb);

/* Switch context to the context of the task at the head of the
* ready to run list.
*/
Expand Down
5 changes: 5 additions & 0 deletions arch/risc-v/src/common/riscv_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs)
addrenv_switch(NULL);
#endif

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(tcb);

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
12 changes: 0 additions & 12 deletions arch/risc-v/src/common/riscv_switchcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,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_interrupt_context())
Expand All @@ -71,10 +67,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)

riscv_savecontext(rtcb);

/* Update scheduler parameters */

nxsched_resume_scheduler(tcb);

/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
Expand All @@ -86,10 +78,6 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb)

else
{
/* Update scheduler parameters */

nxsched_resume_scheduler(tcb);

/* Then switch contexts */

riscv_switchcontext(rtcb, tcb);
Expand Down
5 changes: 5 additions & 0 deletions arch/x86/src/qemu/qemu_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ static uint32_t *common_handler(int irq, uint32_t *regs)
addrenv_switch(NULL);
#endif

/* Update scheduler parameters */

nxsched_suspend_scheduler(g_running_tasks[this_cpu()]);
nxsched_resume_scheduler(this_task());

/* Record the new "running" task when context switch occurred.
* g_running_tasks[] is only used by assertion logic for reporting
* crashes.
Expand Down
Loading