summaryrefslogtreecommitdiff
path: root/nuttx/arch/sh
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-08-28 08:10:19 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-08-28 08:10:19 -0600
commit8840883bda397389b96654b3637f8549fd7af226 (patch)
tree65114106c4e2ccb506d58e9ea2dc3dedbbf8097f /nuttx/arch/sh
parent4226c6c8e4f1feadfd3b084b48681a63d48a9af4 (diff)
downloadpx4-nuttx-8840883bda397389b96654b3637f8549fd7af226.tar.gz
px4-nuttx-8840883bda397389b96654b3637f8549fd7af226.tar.bz2
px4-nuttx-8840883bda397389b96654b3637f8549fd7af226.zip
Add address environment support to ALL implementatins of up_release_pending()
Diffstat (limited to 'nuttx/arch/sh')
-rw-r--r--nuttx/arch/sh/src/common/up_releasepending.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/nuttx/arch/sh/src/common/up_releasepending.c b/nuttx/arch/sh/src/common/up_releasepending.c
index b4685ded9..d76ca4a11 100644
--- a/nuttx/arch/sh/src/common/up_releasepending.c
+++ b/nuttx/arch/sh/src/common/up_releasepending.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/sh/src/common/up_releasepending.c
*
- * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2009, 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 "up_internal.h"
/****************************************************************************
@@ -104,7 +105,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.
+ */
current_regs = rtcb->xcp.regs;
}
@@ -124,6 +127,15 @@ void up_release_pending(void)
rtcb = (struct tcb_s*)g_readytorun.head;
slldbg("New Active Task TCB=%p\n", rtcb);
+#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
/* Then switch contexts */
up_fullcontextrestore(rtcb->xcp.regs);