summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-17 01:10:23 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-17 01:10:23 +0000
commitdb8769c0dbd3a9c33b60863a62f33cc5158bf7bd (patch)
tree24531e144c76b9766f17065c7acb87f6d183e5f8 /nuttx/arch
parente6dc1927ce61a16359477bb93a2292caade5df75 (diff)
downloadpx4-nuttx-db8769c0dbd3a9c33b60863a62f33cc5158bf7bd.tar.gz
px4-nuttx-db8769c0dbd3a9c33b60863a62f33cc5158bf7bd.tar.bz2
px4-nuttx-db8769c0dbd3a9c33b60863a62f33cc5158bf7bd.zip
There kernel-side signal handler trampoline needs to run in privileged mode
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5751 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c10
-rw-r--r--nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c b/nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c
index aa85d56f0..fa1232704 100644
--- a/nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c
+++ b/nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c
@@ -46,6 +46,7 @@
#include <nuttx/arch.h>
#include "psr.h"
+#include "exc_return.h"
#include "os_internal.h"
#include "up_internal.h"
#include "up_arch.h"
@@ -159,12 +160,16 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_xpsr = current_regs[REG_XPSR];
/* Then set up to vector to the trampoline with interrupts
- * disabled
+ * disabled. The kernel-space trampoline must run in
+ * privileged thread mode.
*/
current_regs[REG_PC] = (uint32_t)up_sigdeliver;
current_regs[REG_BASEPRI] = NVIC_SYSH_DISABLE_PRIORITY;
current_regs[REG_XPSR] = ARMV6M_XPSR_T;
+#ifdef CONFIG_NUTTX_KERNEL
+ current_regs[REG_XPSR] = EXC_RETURN_PRIVTHR;
+#endif
/* And make sure that the saved context in the TCB
* is the same as the interrupt return context.
@@ -193,7 +198,8 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR];
/* Then set up to vector to the trampoline with interrupts
- * disabled
+ * disabled. We must already be in privileged thread mode
+ * to be here.
*/
tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver;
diff --git a/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c b/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c
index 32f7082b3..f4cde206a 100644
--- a/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c
+++ b/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c
@@ -46,6 +46,7 @@
#include <nuttx/arch.h>
#include "psr.h"
+#include "exc_return.h"
#include "os_internal.h"
#include "up_internal.h"
#include "up_arch.h"
@@ -163,7 +164,8 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_xpsr = current_regs[REG_XPSR];
/* Then set up to vector to the trampoline with interrupts
- * disabled
+ * disabled. The kernel-space trampoline must run in
+ * privileged thread mode.
*/
current_regs[REG_PC] = (uint32_t)up_sigdeliver;
@@ -173,6 +175,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
current_regs[REG_PRIMASK] = 1;
#endif
current_regs[REG_XPSR] = ARMV7M_XPSR_T;
+#ifdef CONFIG_NUTTX_KERNEL
+ current_regs[REG_XPSR] = EXC_RETURN_PRIVTHR;
+#endif
/* And make sure that the saved context in the TCB
* is the same as the interrupt return context.
@@ -205,7 +210,8 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR];
/* Then set up to vector to the trampoline with interrupts
- * disabled
+ * disabled. We must already be in privileged thread mode
+ * to be here.
*/
tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver;