summaryrefslogtreecommitdiff
path: root/nuttx/arch/avr
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-27 15:36:52 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-27 15:36:52 -0600
commit7bda7a5e0cf009da5d0ace3d23efe7a2a2f70dc5 (patch)
treeb07288035e690f4dc36943e4e5795e98f8a23fe2 /nuttx/arch/avr
parent3bca5b16412b62536ce746774c4482871fae7852 (diff)
downloadnuttx-7bda7a5e0cf009da5d0ace3d23efe7a2a2f70dc5.tar.gz
nuttx-7bda7a5e0cf009da5d0ace3d23efe7a2a2f70dc5.tar.bz2
nuttx-7bda7a5e0cf009da5d0ace3d23efe7a2a2f70dc5.zip
Add ADDRENV support to all implementations of up_block_task()
Diffstat (limited to 'nuttx/arch/avr')
-rw-r--r--nuttx/arch/avr/src/avr32/up_blocktask.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/nuttx/arch/avr/src/avr32/up_blocktask.c b/nuttx/arch/avr/src/avr32/up_blocktask.c
index 2889addde..0013cedff 100644
--- a/nuttx/arch/avr/src/avr32/up_blocktask.c
+++ b/nuttx/arch/avr/src/avr32/up_blocktask.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/avr/src/avr32/up_blocktask.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"
/****************************************************************************
@@ -139,17 +140,39 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
/* 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.
+ /* Get the context of the task at the head of the ready to
+ * run 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