diff --git a/arch/mips/src/pic32mx/pic32mx_decodeirq.c b/arch/mips/src/pic32mx/pic32mx_decodeirq.c index f2ff17c53b2..98eceebae99 100644 --- a/arch/mips/src/pic32mx/pic32mx_decodeirq.c +++ b/arch/mips/src/pic32mx/pic32mx_decodeirq.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "mips_internal.h" #include "pic32mx_int.h" @@ -141,6 +142,12 @@ uint32_t *pic32mx_decodeirq(uint32_t *regs) regs = up_current_regs(); + /* Record the task that will run when the interrupt returns. Its state + * is saved to its TCB on the next interrupt entry (see above). + */ + + *running_task = this_task(); + #if defined(CONFIG_ARCH_FPU) || defined(CONFIG_ARCH_ADDRENV) /* Check for a context switch. If a context switch occurred, then * g_current_regs will have a different value than it did on entry. If an