mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
addrenv: Ensure that the transmission parameter of addrenv_switch is not NULL
reason: avoid obtaining this_task multiple times. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -93,7 +93,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ uint32_t *arm_decodeirq(uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ uint32_t *arm_decodeirq(uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ uint32_t *arm_decodeirq(uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ uint64_t *arm64_doirq(int irq, uint64_t * regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
uint32_t *avr_doirq(int irq, uint32_t *regs)
|
uint32_t *avr_doirq(int irq, uint32_t *regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
if (*running_task != NULL)
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -93,6 +94,8 @@ uint32_t *avr_doirq(int irq, uint32_t *regs)
|
|||||||
|
|
||||||
if (regs != up_current_regs())
|
if (regs != up_current_regs())
|
||||||
{
|
{
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
/* Restore floating point registers */
|
/* Restore floating point registers */
|
||||||
|
|
||||||
@@ -106,7 +109,7 @@ uint32_t *avr_doirq(int irq, uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -114,7 +117,7 @@ uint32_t *avr_doirq(int irq, uint32_t *regs)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a context switch occurred while processing the interrupt then
|
/* If a context switch occurred while processing the interrupt then
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
uint8_t *hc_doirq(int irq, uint8_t *regs)
|
uint8_t *hc_doirq(int irq, uint8_t *regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
if (*running_task != NULL)
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -99,6 +100,8 @@ uint8_t *hc_doirq(int irq, uint8_t *regs)
|
|||||||
up_restorefpu(up_current_regs());
|
up_restorefpu(up_current_regs());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
* running task is closed down gracefully (data caches dump,
|
* running task is closed down gracefully (data caches dump,
|
||||||
@@ -106,7 +109,7 @@ uint8_t *hc_doirq(int irq, uint8_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -114,7 +117,7 @@ uint8_t *hc_doirq(int irq, uint8_t *regs)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a context switch occurred while processing the interrupt then
|
/* If a context switch occurred while processing the interrupt then
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
uint32_t *mips_doirq(int irq, uint32_t *regs)
|
uint32_t *mips_doirq(int irq, uint32_t *regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
if (*running_task != NULL)
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -99,6 +100,8 @@ uint32_t *mips_doirq(int irq, uint32_t *regs)
|
|||||||
|
|
||||||
if (regs != up_current_regs())
|
if (regs != up_current_regs())
|
||||||
{
|
{
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
/* Restore floating point registers */
|
/* Restore floating point registers */
|
||||||
|
|
||||||
@@ -112,7 +115,7 @@ uint32_t *mips_doirq(int irq, uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -120,7 +123,7 @@ uint32_t *mips_doirq(int irq, uint32_t *regs)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a context switch occurred while processing the interrupt then
|
/* If a context switch occurred while processing the interrupt then
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ uint32_t *pic32mx_decodeirq(uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(this_task());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ uint32_t *pic32mz_decodeirq(uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(this_task());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
uint32_t *lm32_doirq(int irq, uint32_t *regs)
|
uint32_t *lm32_doirq(int irq, uint32_t *regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
if (*running_task != NULL)
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -84,6 +85,8 @@ uint32_t *lm32_doirq(int irq, uint32_t *regs)
|
|||||||
|
|
||||||
if (regs != up_current_regs())
|
if (regs != up_current_regs())
|
||||||
{
|
{
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_FPU
|
#ifdef CONFIG_ARCH_FPU
|
||||||
/* Restore floating point registers */
|
/* Restore floating point registers */
|
||||||
|
|
||||||
@@ -97,7 +100,7 @@ uint32_t *lm32_doirq(int irq, uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -105,7 +108,7 @@ uint32_t *lm32_doirq(int irq, uint32_t *regs)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a context switch occurred while processing the interrupt then
|
/* If a context switch occurred while processing the interrupt then
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
uint32_t *minerva_doirq(int irq, uint32_t * regs)
|
uint32_t *minerva_doirq(int irq, uint32_t * regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
if (*running_task != NULL)
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -89,6 +90,8 @@ uint32_t *minerva_doirq(int irq, uint32_t * regs)
|
|||||||
up_restorefpu(up_current_regs());
|
up_restorefpu(up_current_regs());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously running
|
/* Make sure that the address environment for the previously running
|
||||||
* task is closed down gracefully (data caches dump, MMU flushed) and
|
* task is closed down gracefully (data caches dump, MMU flushed) and
|
||||||
@@ -96,7 +99,7 @@ uint32_t *minerva_doirq(int irq, uint32_t * regs)
|
|||||||
* the ready-to-run list.
|
* the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -104,7 +107,7 @@ uint32_t *minerva_doirq(int irq, uint32_t * regs)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a context switch occurred while processing the interrupt then
|
/* If a context switch occurred while processing the interrupt then
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
uint32_t *renesas_doirq(int irq, uint32_t * regs)
|
uint32_t *renesas_doirq(int irq, uint32_t * regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
if (*running_task != NULL)
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -102,6 +103,8 @@ uint32_t *renesas_doirq(int irq, uint32_t * regs)
|
|||||||
up_restorefpu(up_current_regs());
|
up_restorefpu(up_current_regs());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
* running task is closed down gracefully (data caches dump,
|
* running task is closed down gracefully (data caches dump,
|
||||||
@@ -109,7 +112,7 @@ uint32_t *renesas_doirq(int irq, uint32_t * regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -117,7 +120,7 @@ uint32_t *renesas_doirq(int irq, uint32_t * regs)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the current value of regs... it may have changed because
|
/* Get the current value of regs... it may have changed because
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void *riscv_perform_syscall(uintreg_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
uint32_t *sparc_doirq(int irq, uint32_t *regs)
|
uint32_t *sparc_doirq(int irq, uint32_t *regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
if (*running_task != NULL)
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -100,6 +101,8 @@ uint32_t *sparc_doirq(int irq, uint32_t *regs)
|
|||||||
up_restorefpu(up_current_regs());
|
up_restorefpu(up_current_regs());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
* running task is closed down gracefully (data caches dump,
|
* running task is closed down gracefully (data caches dump,
|
||||||
@@ -107,7 +110,7 @@ uint32_t *sparc_doirq(int irq, uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -115,7 +118,7 @@ uint32_t *sparc_doirq(int irq, uint32_t *regs)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a context switch occurred while processing the interrupt then
|
/* If a context switch occurred while processing the interrupt then
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255)
|
IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
#ifdef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
PANIC();
|
PANIC();
|
||||||
@@ -87,6 +88,8 @@ IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255)
|
|||||||
|
|
||||||
if (regs != up_current_regs())
|
if (regs != up_current_regs())
|
||||||
{
|
{
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
* running task is closed down gracefully (data caches dump,
|
* running task is closed down gracefully (data caches dump,
|
||||||
@@ -94,7 +97,7 @@ IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -102,7 +105,7 @@ IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
__mtcr(CPU_PCXI, (uintptr_t)up_current_regs());
|
__mtcr(CPU_PCXI, (uintptr_t)up_current_regs());
|
||||||
__isync();
|
__isync();
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ static void idt_outb(uint8_t val, uint16_t addr)
|
|||||||
static uint32_t *common_handler(int irq, uint32_t *regs)
|
static uint32_t *common_handler(int irq, uint32_t *regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
board_autoled_on(LED_INIRQ);
|
board_autoled_on(LED_INIRQ);
|
||||||
|
|
||||||
/* Current regs non-zero indicates that we are processing an interrupt;
|
/* Current regs non-zero indicates that we are processing an interrupt;
|
||||||
@@ -114,6 +115,7 @@ static uint32_t *common_handler(int irq, uint32_t *regs)
|
|||||||
up_restorefpu(up_current_regs());
|
up_restorefpu(up_current_regs());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
tcb = this_task();
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
* running task is closed down gracefully (data caches dump,
|
* running task is closed down gracefully (data caches dump,
|
||||||
@@ -121,20 +123,20 @@ static uint32_t *common_handler(int irq, uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
nxsched_suspend_scheduler(*running_task);
|
nxsched_suspend_scheduler(*running_task);
|
||||||
nxsched_resume_scheduler(this_task());
|
nxsched_resume_scheduler(tcb);
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
* g_running_tasks[] is only used by assertion logic for reporting
|
* g_running_tasks[] is only used by assertion logic for reporting
|
||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*running_task = this_task();
|
*running_task = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a context switch occurred while processing the interrupt then
|
/* If a context switch occurred while processing the interrupt then
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ static uint64_t *common_handler(int irq, uint64_t *regs)
|
|||||||
|
|
||||||
if (regs != up_current_regs())
|
if (regs != up_current_regs())
|
||||||
{
|
{
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
* running task is closed down gracefully (data caches dump,
|
* running task is closed down gracefully (data caches dump,
|
||||||
@@ -101,21 +103,20 @@ static uint64_t *common_handler(int irq, uint64_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
cpu = this_cpu();
|
cpu = this_cpu();
|
||||||
nxsched_suspend_scheduler(*running_task);
|
nxsched_suspend_scheduler(*running_task);
|
||||||
nxsched_resume_scheduler(this_task());
|
nxsched_resume_scheduler(tcb);
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
* g_running_tasks[] is only used by assertion logic for reporting
|
* g_running_tasks[] is only used by assertion logic for reporting
|
||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tcb = current_task(cpu);
|
|
||||||
g_running_tasks[cpu] = tcb;
|
g_running_tasks[cpu] = tcb;
|
||||||
|
|
||||||
/* Restore the cpu lock */
|
/* Restore the cpu lock */
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs)
|
|||||||
* thread at the head of the ready-to-run list.
|
* thread at the head of the ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update scheduler parameters */
|
/* Update scheduler parameters */
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
FAR chipreg_t *z80_doirq(uint8_t irq, FAR chipreg_t *regs)
|
FAR chipreg_t *z80_doirq(uint8_t irq, FAR chipreg_t *regs)
|
||||||
{
|
{
|
||||||
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
struct tcb_s **running_task = &g_running_tasks[this_cpu()];
|
||||||
|
struct tcb_s *tcb;
|
||||||
|
|
||||||
if (*running_task != NULL)
|
if (*running_task != NULL)
|
||||||
{
|
{
|
||||||
@@ -85,6 +86,8 @@ FAR chipreg_t *z80_doirq(uint8_t irq, FAR chipreg_t *regs)
|
|||||||
|
|
||||||
if (newregs != regs)
|
if (newregs != regs)
|
||||||
{
|
{
|
||||||
|
tcb = this_task();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously
|
/* Make sure that the address environment for the previously
|
||||||
* running task is closed down gracefully and set up the
|
* running task is closed down gracefully and set up the
|
||||||
@@ -92,7 +95,7 @@ FAR chipreg_t *z80_doirq(uint8_t irq, FAR chipreg_t *regs)
|
|||||||
* ready-to-run list.
|
* ready-to-run list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
addrenv_switch(NULL);
|
addrenv_switch(tcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Record the new "running" task when context switch occurred.
|
/* Record the new "running" task when context switch occurred.
|
||||||
@@ -100,7 +103,7 @@ FAR chipreg_t *z80_doirq(uint8_t irq, FAR chipreg_t *regs)
|
|||||||
* crashes.
|
* crashes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = this_task();
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
regs = newregs;
|
regs = newregs;
|
||||||
|
|||||||
@@ -129,16 +129,6 @@ int addrenv_switch(FAR struct tcb_s *tcb)
|
|||||||
int cpu;
|
int cpu;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* NULL for the tcb means to use the TCB of the task at the head of the
|
|
||||||
* ready to run list.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!tcb)
|
|
||||||
{
|
|
||||||
tcb = this_task();
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUGASSERT(tcb);
|
|
||||||
next = tcb->addrenv_curr;
|
next = tcb->addrenv_curr;
|
||||||
|
|
||||||
/* Does the group have an address environment? */
|
/* Does the group have an address environment? */
|
||||||
|
|||||||
Reference in New Issue
Block a user