From 8840883bda397389b96654b3637f8549fd7af226 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 28 Aug 2014 08:10:19 -0600 Subject: Add address environment support to ALL implementatins of up_release_pending() --- nuttx/arch/mips/src/mips32/up_releasepending.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'nuttx/arch/mips/src/mips32') diff --git a/nuttx/arch/mips/src/mips32/up_releasepending.c b/nuttx/arch/mips/src/mips32/up_releasepending.c index 8823d3493..cbfe9dba3 100644 --- a/nuttx/arch/mips/src/mips32/up_releasepending.c +++ b/nuttx/arch/mips/src/mips32/up_releasepending.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/mips32/up_releasepending.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -106,7 +107,9 @@ void up_release_pending(void) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); - /* Then switch contexts */ + /* Then switch contexts. Any necessary address environment + * changes will be made when the interrupt returns. + */ up_restorestate(rtcb->xcp.regs); } @@ -120,6 +123,18 @@ void up_release_pending(void) */ struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head; + +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(nexttcb); +#endif + /* Then switch contexts */ + up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs); /* up_switchcontext forces a context switch to the task at the -- cgit v1.2.3