diff --git a/arch/arm/src/armv6-m/arm_doirq.c b/arch/arm/src/armv6-m/arm_doirq.c index 80b076636f..22a89cb673 100644 --- a/arch/arm/src/armv6-m/arm_doirq.c +++ b/arch/arm/src/armv6-m/arm_doirq.c @@ -79,7 +79,6 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) g_running_tasks[this_cpu()] = this_task(); - restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; } diff --git a/arch/arm/src/armv6-m/arm_svcall.c b/arch/arm/src/armv6-m/arm_svcall.c index 2775079dca..c6b9801b56 100644 --- a/arch/arm/src/armv6-m/arm_svcall.c +++ b/arch/arm/src/armv6-m/arm_svcall.c @@ -34,6 +34,7 @@ #include #include +#include "sched/sched.h" #include "signal/signal.h" #include "exc_return.h" #include "arm_internal.h" @@ -473,5 +474,10 @@ int arm_svcall(int irq, void *context, void *arg) # endif #endif + if (regs != CURRENT_REGS) + { + restore_critical_section(); + } + return OK; } diff --git a/arch/arm/src/armv7-a/arm_doirq.c b/arch/arm/src/armv7-a/arm_doirq.c index 652de6a233..1dfa76983d 100644 --- a/arch/arm/src/armv7-a/arm_doirq.c +++ b/arch/arm/src/armv7-a/arm_doirq.c @@ -92,7 +92,6 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) g_running_tasks[this_cpu()] = this_task(); - restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; } diff --git a/arch/arm/src/armv7-m/arm_doirq.c b/arch/arm/src/armv7-m/arm_doirq.c index e7b6411faa..10faadf111 100644 --- a/arch/arm/src/armv7-m/arm_doirq.c +++ b/arch/arm/src/armv7-m/arm_doirq.c @@ -79,7 +79,6 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) g_running_tasks[this_cpu()] = this_task(); - restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; } diff --git a/arch/arm/src/armv7-m/arm_svcall.c b/arch/arm/src/armv7-m/arm_svcall.c index c761a972a6..51377d7d87 100644 --- a/arch/arm/src/armv7-m/arm_svcall.c +++ b/arch/arm/src/armv7-m/arm_svcall.c @@ -35,6 +35,7 @@ #include #include +#include "sched/sched.h" #include "signal/signal.h" #include "exc_return.h" #include "arm_internal.h" @@ -482,5 +483,10 @@ int arm_svcall(int irq, void *context, void *arg) # endif #endif + if (regs != CURRENT_REGS) + { + restore_critical_section(); + } + return OK; } diff --git a/arch/arm/src/armv7-r/arm_doirq.c b/arch/arm/src/armv7-r/arm_doirq.c index de5929dc9d..22299e999f 100644 --- a/arch/arm/src/armv7-r/arm_doirq.c +++ b/arch/arm/src/armv7-r/arm_doirq.c @@ -71,7 +71,6 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) g_running_tasks[this_cpu()] = this_task(); - restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; } diff --git a/arch/arm/src/armv8-m/arm_doirq.c b/arch/arm/src/armv8-m/arm_doirq.c index 5e942d7aa5..b4a921367b 100644 --- a/arch/arm/src/armv8-m/arm_doirq.c +++ b/arch/arm/src/armv8-m/arm_doirq.c @@ -128,7 +128,6 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) g_running_tasks[this_cpu()] = this_task(); - restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; } diff --git a/arch/arm/src/armv8-m/arm_svcall.c b/arch/arm/src/armv8-m/arm_svcall.c index 1d384392e5..8e87625768 100644 --- a/arch/arm/src/armv8-m/arm_svcall.c +++ b/arch/arm/src/armv8-m/arm_svcall.c @@ -34,6 +34,7 @@ #include #include +#include "sched/sched.h" #include "signal/signal.h" #include "exc_return.h" #include "arm_internal.h" @@ -483,5 +484,10 @@ int arm_svcall(int irq, void *context, void *arg) # endif #endif + if (regs != CURRENT_REGS) + { + restore_critical_section(); + } + return OK; } diff --git a/arch/arm/src/armv8-r/arm_doirq.c b/arch/arm/src/armv8-r/arm_doirq.c index c949d21b96..beb83fcccc 100644 --- a/arch/arm/src/armv8-r/arm_doirq.c +++ b/arch/arm/src/armv8-r/arm_doirq.c @@ -71,8 +71,6 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) */ g_running_tasks[this_cpu()] = this_task(); - - restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; } diff --git a/arch/arm/src/tlsr82/tc32/tc32_doirq.c b/arch/arm/src/tlsr82/tc32/tc32_doirq.c index d19cdfbb00..7c772d330a 100644 --- a/arch/arm/src/tlsr82/tc32/tc32_doirq.c +++ b/arch/arm/src/tlsr82/tc32/tc32_doirq.c @@ -98,7 +98,6 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) if (regs != CURRENT_REGS) { - restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; } diff --git a/arch/arm64/src/common/arm64_doirq.c b/arch/arm64/src/common/arm64_doirq.c index c7ece5b76d..264475dcad 100644 --- a/arch/arm64/src/common/arm64_doirq.c +++ b/arch/arm64/src/common/arm64_doirq.c @@ -99,9 +99,6 @@ uint64_t *arm64_doirq(int irq, uint64_t * regs) g_running_tasks[this_cpu()] = this_task(); - /* Restore the cpu lock */ - - restore_critical_section(); regs = (uint64_t *)CURRENT_REGS; } diff --git a/arch/ceva/src/common/ceva_doirq.c b/arch/ceva/src/common/ceva_doirq.c index 7a24a14671..81effb4a85 100644 --- a/arch/ceva/src/common/ceva_doirq.c +++ b/arch/ceva/src/common/ceva_doirq.c @@ -85,7 +85,6 @@ uint32_t *ceva_doirq(int irq, uint32_t *regs) g_running_tasks[this_cpu()] = this_task(); - restore_critical_section(); regs = CURRENT_REGS; } diff --git a/arch/risc-v/src/common/riscv_doirq.c b/arch/risc-v/src/common/riscv_doirq.c index 7ed1a1ebe0..c72fd21c8f 100644 --- a/arch/risc-v/src/common/riscv_doirq.c +++ b/arch/risc-v/src/common/riscv_doirq.c @@ -109,10 +109,6 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs) g_running_tasks[this_cpu()] = this_task(); - /* Restore the cpu lock */ - - restore_critical_section(); - /* If a context switch occurred while processing the interrupt then * CURRENT_REGS may have change value. If we return any value * different from the input regs, then the lower level will know diff --git a/arch/risc-v/src/common/riscv_swint.c b/arch/risc-v/src/common/riscv_swint.c index aebeef1cb9..66872cc157 100644 --- a/arch/risc-v/src/common/riscv_swint.c +++ b/arch/risc-v/src/common/riscv_swint.c @@ -40,6 +40,7 @@ # include #endif +#include "sched/sched.h" #include "signal/signal.h" #include "riscv_internal.h" #include "addrenv.h" @@ -498,5 +499,10 @@ int riscv_swint(int irq, void *context, void *arg) } #endif + if (regs != CURRENT_REGS) + { + restore_critical_section(); + } + return OK; } diff --git a/arch/sparc/src/sparc_v8/sparc_v8_doirq.c b/arch/sparc/src/sparc_v8/sparc_v8_doirq.c index d434e3c7e0..0733aace99 100644 --- a/arch/sparc/src/sparc_v8/sparc_v8_doirq.c +++ b/arch/sparc/src/sparc_v8/sparc_v8_doirq.c @@ -118,13 +118,6 @@ uint32_t *sparc_doirq(int irq, uint32_t *regs) regs = (uint32_t *)((uint32_t)CURRENT_REGS - CPU_MINIMUM_STACK_FRAME_SIZE); - /* Restore the cpu lock */ - - if (regs != CURRENT_REGS) - { - restore_critical_section(); - } - /* Set CURRENT_REGS to NULL to indicate that we are no longer in an * interrupt handler. */ diff --git a/arch/xtensa/src/common/xtensa_irqdispatch.c b/arch/xtensa/src/common/xtensa_irqdispatch.c index 17457147e0..be2c671b50 100644 --- a/arch/xtensa/src/common/xtensa_irqdispatch.c +++ b/arch/xtensa/src/common/xtensa_irqdispatch.c @@ -94,7 +94,6 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs) if (regs != CURRENT_REGS) { - restore_critical_section(); regs = (uint32_t *)CURRENT_REGS; } diff --git a/arch/xtensa/src/common/xtensa_swint.c b/arch/xtensa/src/common/xtensa_swint.c index 51bf2c1b79..702adfe2af 100644 --- a/arch/xtensa/src/common/xtensa_swint.c +++ b/arch/xtensa/src/common/xtensa_swint.c @@ -32,6 +32,7 @@ #include #include +#include "sched/sched.h" #include "chip.h" #include "signal/signal.h" #include "xtensa.h" @@ -439,5 +440,10 @@ int xtensa_swint(int irq, void *context, void *arg) } #endif + if (regs != CURRENT_REGS) + { + restore_critical_section(); + } + return OK; }