Finish signal handling

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3025 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2010-10-16 21:04:20 +00:00
parent 32b4ad2e1c
commit b18f556344
3 changed files with 20 additions and 9 deletions
+7 -2
View File
@@ -108,12 +108,17 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
struct xcptcontext struct xcptcontext
{ {
/* The following function pointer is non-zero if there /* The following function pointer is non-zero if there are pending signals
* are pending signals to be processed. * to be processed.
*/ */
#ifndef CONFIG_DISABLE_SIGNALS #ifndef CONFIG_DISABLE_SIGNALS
void *sigdeliver; /* Actual type is sig_deliver_t */ void *sigdeliver; /* Actual type is sig_deliver_t */
/* These are saved copies of PC and SR used during signal processing.*/
uint32_t saved_pc;
uint32_t saved_sr;
#endif #endif
/* Register save area */ /* Register save area */
+9 -4
View File
@@ -44,6 +44,7 @@
#include <debug.h> #include <debug.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <arch/avr32/avr32.h>
#include "os_internal.h" #include "os_internal.h"
#include "up_internal.h" #include "up_internal.h"
@@ -153,13 +154,15 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
*/ */
tcb->xcp.sigdeliver = sigdeliver; tcb->xcp.sigdeliver = sigdeliver;
#warning "Not implemented" tcb->xcp.saved_pc = current_regs[REG_PC];
tcb->xcp.saved_sr = current_regs[REG_SR];
/* Then set up to vector to the trampoline with interrupts /* Then set up to vector to the trampoline with interrupts
* disabled * disabled
*/ */
#warning "Not implemented" current_regs[REG_PC] = (uint32_t)up_sigdeliver;
current_regs[REG_SR] |= AVR32_SR_GM_MASK;
/* And make sure that the saved context in the TCB /* And make sure that the saved context in the TCB
* is the same as the interrupt return context. * is the same as the interrupt return context.
@@ -183,13 +186,15 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
*/ */
tcb->xcp.sigdeliver = sigdeliver; tcb->xcp.sigdeliver = sigdeliver;
#warning "Not implemented" tcb->xcp.saved_pc = current_regs[REG_PC];
tcb->xcp.saved_sr = current_regs[REG_SR];
/* Then set up to vector to the trampoline with interrupts /* Then set up to vector to the trampoline with interrupts
* disabled * disabled
*/ */
#warning "Not implemented" tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver;
tcb->xcp.regs[REG_SR] |= AVR32_SR_GM_MASK;
} }
irqrestore(flags); irqrestore(flags);
+3 -2
View File
@@ -100,7 +100,8 @@ void up_sigdeliver(void)
/* Save the real return state on the stack. */ /* Save the real return state on the stack. */
up_copystate(regs, rtcb->xcp.regs); up_copystate(regs, rtcb->xcp.regs);
#warning "Not Implemented" regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_SR] = rtcb->xcp.saved_sr;
/* Get a local copy of the sigdeliver function pointer. We do this so tha /* Get a local copy of the sigdeliver function pointer. We do this so tha
* we can nullify the sigdeliver function point in the TCB and accept more * we can nullify the sigdeliver function point in the TCB and accept more
@@ -112,7 +113,7 @@ void up_sigdeliver(void)
/* Then restore the task interrupt state */ /* Then restore the task interrupt state */
#warning "Not Implemented" irqrestore(regs[REG_SR]);
/* Deliver the signals */ /* Deliver the signals */