summaryrefslogtreecommitdiff
path: root/nuttx/arch/avr
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-28 07:54:07 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-28 07:54:07 -0600
commit4226c6c8e4f1feadfd3b084b48681a63d48a9af4 (patch)
tree794fd8016b8666350343db513f921acab5aeb891 /nuttx/arch/avr
parente3df43d45273609e6cee0a1b1a38f64c218d37c2 (diff)
downloadnuttx-4226c6c8e4f1feadfd3b084b48681a63d48a9af4.tar.gz
nuttx-4226c6c8e4f1feadfd3b084b48681a63d48a9af4.tar.bz2
nuttx-4226c6c8e4f1feadfd3b084b48681a63d48a9af4.zip
Add address environment support to ALL implementatins of up_reprioritize_rtr()
Diffstat (limited to 'nuttx/arch/avr')
-rw-r--r--nuttx/arch/avr/src/avr32/up_reprioritizertr.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/nuttx/arch/avr/src/avr32/up_reprioritizertr.c b/nuttx/arch/avr/src/avr32/up_reprioritizertr.c
index 535134d51..9ddafe37c 100644
--- a/nuttx/arch/avr/src/avr32/up_reprioritizertr.c
+++ b/nuttx/arch/avr/src/avr32/up_reprioritizertr.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/avr/src/avr32/up_reprioritizertr.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
@@ -46,6 +46,7 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
+#include "group/group.h"
#include "up_internal.h"
/****************************************************************************
@@ -159,7 +160,9 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
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);
}
@@ -173,6 +176,18 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
*/
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