diff --git a/arch/mips/src/pic32mz/pic32mz_decodeirq.c b/arch/mips/src/pic32mz/pic32mz_decodeirq.c index f22d1fc6645..4f0ce0d2e57 100644 --- a/arch/mips/src/pic32mz/pic32mz_decodeirq.c +++ b/arch/mips/src/pic32mz/pic32mz_decodeirq.c @@ -36,6 +36,7 @@ #include #include #include +#include #include "mips_internal.h" #include "hardware/pic32mz_int.h" @@ -141,6 +142,12 @@ uint32_t *pic32mz_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