*** empty log message ***

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@597 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-01-31 22:19:53 +00:00
parent 94ef1222d8
commit 3dc0fee9ba
8 changed files with 133 additions and 145 deletions

5
TODO
View File

@ -383,6 +383,7 @@ o z16 (arch/z16)
Priority: Medium. A polled, write-only serial driver is used in the Priority: Medium. A polled, write-only serial driver is used in the
interim for system testing. interim for system testing.
Description: Signals are not functional Description: The system delays do not appear to be correct with the
examples/ostest/timedmqueue.c test.
Status: Open Status: Open
Priority: Medium Priority: Medium-High

View File

@ -73,7 +73,7 @@
#define IN_INTERRUPT (current_regs != NULL) #define IN_INTERRUPT (current_regs != NULL)
#define SAVE_IRQCONTEXT(tcb) up_copystate((tcb)->xcp.regs, current_regs) #define SAVE_IRQCONTEXT(tcb) up_copystate((tcb)->xcp.regs, current_regs)
#define SET_IRQCONTEXT(tcb) up_copystate(current_regs, (tcb)->xcp.regs) #define SET_IRQCONTEXT(tcb) do { current_regs = (tcb)->xcp.regs; } while (0)
#define SAVE_USERCONTEXT(tcb) up_saveusercontext((tcb)->xcp.regs) #define SAVE_USERCONTEXT(tcb) up_saveusercontext((tcb)->xcp.regs)
#define RESTORE_USERCONTEXT(tcb) up_restoreusercontext((tcb)->xcp.regs) #define RESTORE_USERCONTEXT(tcb) up_restoreusercontext((tcb)->xcp.regs)
#define SIGNAL_RETURN(regs) up_restoreusercontext(regs) #define SIGNAL_RETURN(regs) up_restoreusercontext(regs)

View File

@ -133,19 +133,19 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
sigdeliver(tcb); sigdeliver(tcb);
} }
/* CASE 2: We are in an interrupt handler AND the /* CASE 2: We are in an interrupt handler AND the interrupted
* interrupted task is the same as the one that * task is the same as the one that must receive the signal, then
* must receive the signal, then we will have to modify * we will have to modify the return state as well as the state
* the return state as well as the state in the TCB. * in the TCB.
*/ */
else else
{ {
FAR uint32 *current_pc = (FAR uint32*)&current_regs[REG_PC]; FAR uint32 *current_pc = (FAR uint32*)&current_regs[REG_PC];
/* Save the return address and interrupt state. /* Save the return address and interrupt state. These will be
* These will be restored by the signal trampoline after * restored by the signal trampoline after the signals have
* the signals have been delivered. * been delivered.
*/ */
tcb->xcp.sigdeliver = sigdeliver; tcb->xcp.sigdeliver = sigdeliver;
@ -159,23 +159,22 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
*current_pc = (uint32)up_sigdeliver; *current_pc = (uint32)up_sigdeliver;
current_regs[REG_FLAGS] = 0; current_regs[REG_FLAGS] = 0;
/* And make sure that the saved context in the TCB /* And make sure that the saved context in the TCB is the
* is the same as the interrupt return context. * same as the interrupt return context.
*/ */
up_copystate(tcb->xcp.regs, current_regs); up_copystate(tcb->xcp.regs, current_regs);
} }
} }
/* Otherwise, we are (1) signaling a task is not running /* Otherwise, we are (1) signaling a task is not running from an
* from an interrupt handler or (2) we are not in an * interrupt handler or (2) we are not in an interrupt handler
* interrupt handler and the running task is signalling * and the running task is signalling some non-running task.
* some non-running task.
*/ */
else else
{ {
uint32 *saved_pc = (uint32*)&tcb->xcp.regs[REG_PC]; FAR uint32 *saved_pc = (FAR uint32*)&tcb->xcp.regs[REG_PC];
/* Save the return lr and cpsr and one scratch register /* Save the return lr and cpsr and one scratch register
* These will be restored by the signal trampoline after * These will be restored by the signal trampoline after

View File

@ -72,10 +72,9 @@
* Name: up_sigdeliver * Name: up_sigdeliver
* *
* Description: * Description:
* This is the a signal handling trampoline. When a * This is the a signal handling trampoline. When a signal action was
* signal action was posted. The task context was mucked * posted. The task context was mucked with and forced to branch to this
* with and forced to branch to this location with interrupts * location with interrupts disabled.
* disabled.
* *
****************************************************************************/ ****************************************************************************/
@ -106,10 +105,9 @@ void up_sigdeliver(void)
regs32[REG_PC/2] = rtcb->xcp.saved_pc; regs32[REG_PC/2] = rtcb->xcp.saved_pc;
regs[REG_FLAGS] = rtcb->xcp.saved_i; regs[REG_FLAGS] = rtcb->xcp.saved_i;
/* Get a local copy of the sigdeliver function pointer. /* Get a local copy of the sigdeliver function pointer. We do this so
* we do this so that we can nullify the sigdeliver * that we can nullify the sigdeliver function point in the TCB and
* function point in the TCB and accept more signal * accept more signal deliveries while processing the current pending
* deliveries while processing the current pending
* signals. * signals.
*/ */
@ -127,10 +125,9 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoring errno /* Output any debug messaged BEFORE restoring errno (because they may
* (because they may alter errno), then restore the * alter errno), then restore the original errno that is needed by
* original errno that is needed by the user logic * the user logic (it is probably EINTR).
* (it is probably EINTR).
*/ */
dbg("Resuming\n"); dbg("Resuming\n");

View File

@ -71,42 +71,33 @@
_up_restoreusercontext: _up_restoreusercontext:
/* Disable interrupts while we are accessing the TCB's register /* Disable interrupts while we are accessing the TCB's register
* save structure * save structure. The correct interrupt state will be retored by
* the iret instruction below
*/ */
di di
/* Set up the stack for return */ /* Set up the stack for return from 'interrupt' */
ld sp, 2*REG_SP(r1) /* sp=Value of SP on return */ ld sp, 2*REG_SP(r1) /* sp=Value of SP on return */
ld.w r2, 2*REG_FLAGS(r1) /* r1=padded flags value */
push.w r2 /* Push padded flags value onto the stack */
ld r2, 2*REG_PC(r1) /* r2=return address */ ld r2, 2*REG_PC(r1) /* r2=return address */
push r2 /* Push the return address onto the stack */ push r2 /* Push the return address onto the stack */
ld r7, 2*REG_R7(r1) /* r7=saved value of r7 */ ld r7, 2*REG_R7(r1) /* r7=saved value of r7 */
push r7 /* Save this so that we can use r7 */ push r7 /* Save this so that we can use r7 */
ld r7, sp /* r7=saved SP value */ ld r7, sp /* r7=saved SP value */
/* Retore r8-r14 */ /* Restore registers and return from interrupt */
ld sp, r1 /* sp=Points to register save structure */ ld sp, r1 /* sp=Pointer to register save structure */
popmhi <r8-r14> /* Restore r8-r14 */ popmhi <r8-r14> /* Restore r8-r14 */
add sp, #4 /* Skip over r15=sp */ add sp, #4 /* Skip over restore of r15=sp */
popmlo <r0-r6> /* Restore r0-r6 */
ld sp, r7 /* Switch to the correct stack for return */
pop r7 /* Recover the saved value of r7 from the stack */
iret2 /* Return from interrupt */
/* Test if interrupts should be enabled upon return */
ld.w r2, 2*REG_FLAGS(r1) /* r2=padded flags value */
tm r2, #Z16F_CNTRL_FLAGS_IRQE /* Test IRQE bit (Z-bit == 0 if disabled) */
popmlo <r0-r6> /* Restore r0-r6 (retains Z-bit) */
ld sp, r7 /* Recover the correct SP value (retains Z-bit) */
pop r7 /* Get the saved value of r7 (retains Z-bit)*/
jp z, _up_returndisabled /* Jump if interrupts should remain disabled */
/* Return with interrupts enabled. Note that at this point in the logic,
* we are finished accessing the TCB. Therefore, any interrupt level context
* switches that may modify the TCB should be OK
*/
ei /* Enable interrupts */
_up_returndisabled:
ret
end end

View File

@ -1,5 +1,5 @@
/************************************************************************** /**************************************************************************
* mqueue.c * examples/ostest/mqueue.c
* *
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -380,7 +380,7 @@ void timedmqueue_test(void)
/* Wait for the receiving thread to complete */ /* Wait for the receiving thread to complete */
printf("timedmqueue_test: Waiting for sender to complete\n"); printf("timedmqueue_test: Waiting for receiver to complete\n");
pthread_join(receiver, &result); pthread_join(receiver, &result);
if (result != (void*)0) if (result != (void*)0)
{ {

View File

@ -263,7 +263,7 @@
# define FAR _Far # define FAR _Far
# define NEAR _Near # define NEAR _Near
# define DSEG _Far # define DSEG _Far
# define CODE _Far # define CODE _Erom
/* Select the large, 32-bit addressing model */ /* Select the large, 32-bit addressing model */