diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-27 16:15:46 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-27 16:15:46 -0600 |
commit | dce98ad7cd0742cc258a2ed9200c6a76fbfb329f (patch) | |
tree | d188b9ab09e76dfd794de8268bdd324669323fa9 /nuttx/arch/avr/src | |
parent | ab0dbac1c5db6d0e53609e539686ae1c9024ec63 (diff) | |
download | px4-nuttx-dce98ad7cd0742cc258a2ed9200c6a76fbfb329f.tar.gz px4-nuttx-dce98ad7cd0742cc258a2ed9200c6a76fbfb329f.tar.bz2 px4-nuttx-dce98ad7cd0742cc258a2ed9200c6a76fbfb329f.zip |
Add ADDRENV support to ALL implementations of up_unblock_task()
Diffstat (limited to 'nuttx/arch/avr/src')
-rw-r--r-- | nuttx/arch/avr/src/avr32/up_unblocktask.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/nuttx/arch/avr/src/avr32/up_unblocktask.c b/nuttx/arch/avr/src/avr32/up_unblocktask.c index fbbd00c8e..20e6d3bdf 100644 --- a/nuttx/arch/avr/src/avr32/up_unblocktask.c +++ b/nuttx/arch/avr/src/avr32/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/avr/src/avr32/up_unblocktask.c * - * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -44,6 +44,7 @@ #include <nuttx/arch.h> #include "sched/sched.h" +#include "group/group.h" #include "clock/clock.h" #include "up_internal.h" @@ -75,7 +76,7 @@ * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority - * ready to run taks, executed. + * ready to run task, executed. * ****************************************************************************/ @@ -129,17 +130,40 @@ void up_unblock_task(struct tcb_s *tcb) /* Then switch contexts */ up_restorestate(rtcb->xcp.regs); + +#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(rtcb); +#endif } /* No, then we will need to perform the user context switch */ else { - /* Switch context to the context of the task at the head of the - * ready to run list. + /* Restore the exception context of the new task that is ready to + * run (probably tcb). This is the new rtcb at the head of the + * g_readytorun task list. */ 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 |