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 e5237d04ef
commit f8273e7484
3 changed files with 20 additions and 9 deletions

View File

@ -108,12 +108,17 @@
#ifndef __ASSEMBLY__
struct xcptcontext
{
/* The following function pointer is non-zero if there
* are pending signals to be processed.
/* The following function pointer is non-zero if there are pending signals
* to be processed.
*/
#ifndef CONFIG_DISABLE_SIGNALS
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
/* Register save area */

View File

@ -44,6 +44,7 @@
#include <debug.h>
#include <nuttx/arch.h>
#include <arch/avr32/avr32.h>
#include "os_internal.h"
#include "up_internal.h"
@ -152,14 +153,16 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
* the signal(s) have been delivered.
*/
tcb->xcp.sigdeliver = sigdeliver;
#warning "Not implemented"
tcb->xcp.sigdeliver = sigdeliver;
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
* 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
* 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;
#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
* disabled
*/
#warning "Not implemented"
tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver;
tcb->xcp.regs[REG_SR] |= AVR32_SR_GM_MASK;
}
irqrestore(flags);

View File

@ -100,7 +100,8 @@ void up_sigdeliver(void)
/* Save the real return state on the stack. */
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
* 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 */
#warning "Not Implemented"
irqrestore(regs[REG_SR]);
/* Deliver the signals */