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
This commit is contained in:
patacongo 2013-03-22 21:59:05 +00:00
parent eaee3fc423
commit 2a77c20228
6 changed files with 27 additions and 11 deletions

View File

@ -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) noreturn_function;
static inline void signal_handler_return(void) 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 #endif

View File

@ -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) noreturn_function;
static inline void signal_handler_return(void) 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 #endif

View File

@ -404,8 +404,8 @@ int up_svcall(int irq, FAR void *context)
regs[REG_R1] = regs[REG_R2]; /* signal */ regs[REG_R1] = regs[REG_R2]; /* signal */
regs[REG_R2] = regs[REG_R3]; /* info */ regs[REG_R2] = regs[REG_R3]; /* info */
/* The last parameter, arg, is trickier. The arg parameter will /* The last parameter, ucontext, is trickier. The ucontext
* reside at an offset of 4 from the stack pointer. * parameter will reside at an offset of 4 from the stack pointer.
*/ */
regs[REG_R3] = *(uint32_t*)(regs[REG_SP+4]); 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_PC] = rtcb->xcp.sigreturn;
regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR; regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR;
rtcb->xcp.sigreturn = 0;
} }
break; break;
#endif #endif
@ -482,7 +483,7 @@ int up_svcall(int irq, FAR void *context)
#if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) #if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL)
# ifndef CONFIG_DEBUG_SVCALL # ifndef CONFIG_DEBUG_SVCALL
if (cmd > SYS_switch_context) if (cmd > SYS_switch_context)
# elif # else
if (regs != current_regs) if (regs != current_regs)
# endif # endif
{ {

View File

@ -403,8 +403,8 @@ int up_svcall(int irq, FAR void *context)
regs[REG_R1] = regs[REG_R2]; /* signal */ regs[REG_R1] = regs[REG_R2]; /* signal */
regs[REG_R2] = regs[REG_R3]; /* info */ regs[REG_R2] = regs[REG_R3]; /* info */
/* The last parameter, arg, is trickier. The arg parameter will /* The last parameter, ucontext, is trickier. The ucontext
* reside at an offset of 4 from the stack pointer. * parameter will reside at an offset of 4 from the stack pointer.
*/ */
regs[REG_R3] = *(uint32_t*)(regs[REG_SP+4]); 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_PC] = rtcb->xcp.sigreturn;
regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR; regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR;
rtcb->xcp.sigreturn = 0;
} }
break; break;
#endif #endif
@ -481,7 +482,7 @@ int up_svcall(int irq, FAR void *context)
#if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL) #if defined(CONFIG_DEBUG_SYSCALL) || defined(CONFIG_DEBUG_SVCALL)
# ifndef CONFIG_DEBUG_SVCALL # ifndef CONFIG_DEBUG_SVCALL
if (cmd > SYS_switch_context) if (cmd > SYS_switch_context)
# elif # else
if (regs != current_regs) if (regs != current_regs)
# endif # endif
{ {

View File

@ -93,7 +93,7 @@ void up_signal_handler(_sa_sigaction_t sighand, int signo,
{ {
/* Let sys_call4() do all of the work */ /* Let sys_call4() do all of the work */
sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo, (void)sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo,
(uintptr_t)info, (uintptr_t)ucontext); (uintptr_t)info, (uintptr_t)ucontext);
} }

View File

@ -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) #if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_SIGNALS)
void up_signal_handler(_sa_sigaction_t sighand, int signo, 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 #endif
/**************************************************************************** /****************************************************************************