summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/include/armv7-m
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-17 00:40:49 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-17 00:40:49 +0000
commite6dc1927ce61a16359477bb93a2292caade5df75 (patch)
tree3b7ed6b971413d6423d6012fe593980ee8370429 /nuttx/arch/arm/include/armv7-m
parentc6e15be439a293e411a5ff571c48e0ca15dfaad5 (diff)
downloadpx4-nuttx-e6dc1927ce61a16359477bb93a2292caade5df75.tar.gz
px4-nuttx-e6dc1927ce61a16359477bb93a2292caade5df75.tar.bz2
px4-nuttx-e6dc1927ce61a16359477bb93a2292caade5df75.zip
Add support for calling to and returning from signal handlers in in user-mode threads
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5750 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/include/armv7-m')
-rw-r--r--nuttx/arch/arm/include/armv7-m/irq.h8
-rw-r--r--nuttx/arch/arm/include/armv7-m/syscall.h26
2 files changed, 34 insertions, 0 deletions
diff --git a/nuttx/arch/arm/include/armv7-m/irq.h b/nuttx/arch/arm/include/armv7-m/irq.h
index 7556d0747..afeebdb4f 100644
--- a/nuttx/arch/arm/include/armv7-m/irq.h
+++ b/nuttx/arch/arm/include/armv7-m/irq.h
@@ -124,6 +124,14 @@ struct xcptcontext
uint32_t saved_primask;
#endif
uint32_t saved_xpsr;
+
+# ifdef CONFIG_NUTTX_KERNEL
+ /* This is the saved address to use when returning from a user-space
+ * signal handler.
+ */
+
+ uint32_t sigreturn;
+# endif
#endif
#ifdef CONFIG_NUTTX_KERNEL
diff --git a/nuttx/arch/arm/include/armv7-m/syscall.h b/nuttx/arch/arm/include/armv7-m/syscall.h
index 4278c3a36..91220f359 100644
--- a/nuttx/arch/arm/include/armv7-m/syscall.h
+++ b/nuttx/arch/arm/include/armv7-m/syscall.h
@@ -54,8 +54,22 @@
* Pro-processor Definitions
****************************************************************************/
+/* This is the value used as the argument to the SVC instruction. It is not
+ * used.
+ */
+
#define SYS_syscall 0x00
+/* The SYS_signal_handler_return is executed here... its value is not always
+ * available in this context and so is assumed to be 7.
+ */
+
+#ifndef SYS_signal_handler_return
+# define SYS_signal_handler_return (7)
+#elif SYS_signal_handler_return != 7
+# error "SYS_signal_handler_return was assumed to be 7"
+#endif
+
/****************************************************************************
* Public Types
****************************************************************************/
@@ -218,6 +232,18 @@ static inline uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1,
return reg0;
}
+/* This inline function is used by user-space code in order to return from
+ * a signal handler.
+ */
+
+#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__)
+static inline void signal_handler_return(void) noreturn_function;
+static inline void signal_handler_return(void)
+{
+ sys_call0(SYS_signal_handler_return);
+}
+#endif
+
/****************************************************************************
* Public Variables
****************************************************************************/