diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-22 21:59:05 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-22 21:59:05 +0000 |
commit | f4a74d79f3111b79f408eb4070e125cad78e9082 (patch) | |
tree | ad245c3f71a14d7f0e84e734ec201f08c9ddd87d | |
parent | f3427f57661698850483d9638892a7c25456078c (diff) | |
download | nuttx-f4a74d79f3111b79f408eb4070e125cad78e9082.tar.gz nuttx-f4a74d79f3111b79f408eb4070e125cad78e9082.tar.bz2 nuttx-f4a74d79f3111b79f408eb4070e125cad78e9082.zip |
A few fixes related to dispatched signals in kernel mode (there are still issues)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5777 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/arch/arm/include/armv6-m/syscall.h | 9 | ||||
-rw-r--r-- | nuttx/arch/arm/include/armv7-m/syscall.h | 9 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv6-m/up_svcall.c | 7 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv7-m/up_svcall.c | 7 | ||||
-rw-r--r-- | nuttx/arch/arm/src/common/up_signal_handler.c | 4 | ||||
-rw-r--r-- | nuttx/include/nuttx/arch.h | 2 |
6 files changed, 27 insertions, 11 deletions
diff --git a/nuttx/arch/arm/include/armv6-m/syscall.h b/nuttx/arch/arm/include/armv6-m/syscall.h index 863a7afec..75b9c4f8a 100644 --- a/nuttx/arch/arm/include/armv6-m/syscall.h +++ b/nuttx/arch/arm/include/armv6-m/syscall.h @@ -249,7 +249,14 @@ static inline uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1, static inline void signal_handler_return(void) noreturn_function; static inline void signal_handler_return(void) { - sys_call0(SYS_signal_handler_return); + __asm__ __volatile__ + ( + " mov r0, %0\n" + " svc %1\n" + : + : "i" (SYS_signal_handler_return), "i"(SYS_syscall) + : "memory" + ); } #endif diff --git a/nuttx/arch/arm/include/armv7-m/syscall.h b/nuttx/arch/arm/include/armv7-m/syscall.h index f6321fb4a..62bd5c324 100644 --- a/nuttx/arch/arm/include/armv7-m/syscall.h +++ b/nuttx/arch/arm/include/armv7-m/syscall.h @@ -249,7 +249,14 @@ static inline uintptr_t sys_call6(unsigned int nbr, uintptr_t parm1, static inline void signal_handler_return(void) noreturn_function; static inline void signal_handler_return(void) { - sys_call0(SYS_signal_handler_return); + __asm__ __volatile__ + ( + " mov r0, %0\n" + " svc %1\n" + : + : "i" (SYS_signal_handler_return), "i"(SYS_syscall) + : "memory" + ); } #endif diff --git a/nuttx/arch/arm/src/armv6-m/up_svcall.c b/nuttx/arch/arm/src/armv6-m/up_svcall.c index c917992ae..84f8712a5 100644 --- a/nuttx/arch/arm/src/armv6-m/up_svcall.c +++ b/nuttx/arch/arm/src/armv6-m/up_svcall.c @@ -404,8 +404,8 @@ int up_svcall(int irq, FAR void *context) regs[REG_R1] = regs[REG_R2]; /* signal */ regs[REG_R2] = regs[REG_R3]; /* info */ - /* The last parameter, arg, is trickier. The arg parameter will - * reside at an offset of 4 from the stack pointer. + /* The last parameter, ucontext, is trickier. The ucontext + * parameter will reside at an offset of 4 from the stack pointer. */ regs[REG_R3] = *(uint32_t*)(regs[REG_SP+4]); @@ -433,6 +433,7 @@ int up_svcall(int irq, FAR void *context) regs[REG_PC] = rtcb->xcp.sigreturn; regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR; + rtcb->xcp.sigreturn = 0; } break; #endif @@ -482,7 +483,7 @@ int up_svcall(int irq, FAR void *context) #if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) # ifndef CONFIG_DEBUG_SVCALL if (cmd > SYS_switch_context) -# elif +# else if (regs != current_regs) # endif { diff --git a/nuttx/arch/arm/src/armv7-m/up_svcall.c b/nuttx/arch/arm/src/armv7-m/up_svcall.c index 9f3a4ffaa..40abb41c8 100644 --- a/nuttx/arch/arm/src/armv7-m/up_svcall.c +++ b/nuttx/arch/arm/src/armv7-m/up_svcall.c @@ -403,8 +403,8 @@ int up_svcall(int irq, FAR void *context) regs[REG_R1] = regs[REG_R2]; /* signal */ regs[REG_R2] = regs[REG_R3]; /* info */ - /* The last parameter, arg, is trickier. The arg parameter will - * reside at an offset of 4 from the stack pointer. + /* The last parameter, ucontext, is trickier. The ucontext + * parameter will reside at an offset of 4 from the stack pointer. */ regs[REG_R3] = *(uint32_t*)(regs[REG_SP+4]); @@ -432,6 +432,7 @@ int up_svcall(int irq, FAR void *context) regs[REG_PC] = rtcb->xcp.sigreturn; regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR; + rtcb->xcp.sigreturn = 0; } break; #endif @@ -481,7 +482,7 @@ int up_svcall(int irq, FAR void *context) #if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) # ifndef CONFIG_DEBUG_SVCALL if (cmd > SYS_switch_context) -# elif +# else if (regs != current_regs) # endif { diff --git a/nuttx/arch/arm/src/common/up_signal_handler.c b/nuttx/arch/arm/src/common/up_signal_handler.c index 34407885e..b2a828479 100644 --- a/nuttx/arch/arm/src/common/up_signal_handler.c +++ b/nuttx/arch/arm/src/common/up_signal_handler.c @@ -93,8 +93,8 @@ void up_signal_handler(_sa_sigaction_t sighand, int signo, { /* Let sys_call4() do all of the work */ - sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo, - (uintptr_t)info, (uintptr_t)ucontext); + (void)sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo, + (uintptr_t)info, (uintptr_t)ucontext); } #endif /* CONFIG_NUTTX_KERNEL && __KERNEL__ && !CONFIG_DISABLE_SIGNALS */ diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index b8e62e6c2..d8b8438e8 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -534,7 +534,7 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) #if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_SIGNALS) void up_signal_handler(_sa_sigaction_t sighand, int signo, - FAR siginfo_t *info, FAR void *ucontext); + FAR siginfo_t *info, FAR void *ucontext) noreturn_function; #endif /**************************************************************************** |