Fix a signal trampoline bug

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3053 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2010-10-27 01:46:08 +00:00
parent ddb9e4a774
commit 13ac4eb82d
19 changed files with 130 additions and 146 deletions
+4 -3
View File
@@ -1,7 +1,7 @@
/************************************************************************** /**************************************************************************
* arch/arm/src/arm/up_fullcontextrestore.S * arch/arm/src/arm/up_fullcontextrestore.S
* *
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -95,8 +95,9 @@ up_fullcontextrestore:
/* Now we can restore the CPSR. We wait until we are completely /* Now we can restore the CPSR. We wait until we are completely
* finished with the context save data to do this. Restore the CPSR * finished with the context save data to do this. Restore the CPSR
* may re-enable and interrupts and we couldt be in a context * may re-enable and interrupts and we could be in a context
* where save structure is only protected by interrupts being disabled. * where the save structure is only protected by interrupts being
* disabled.
*/ */
ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */ ldr r1, [r0, #(4*REG_CPSR)] /* Fetch the stored CPSR value */
+1 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/arm/up_schedulesigaction.c * arch/arm/src/arm/up_schedulesigaction.c
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
+15 -20
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/arm/up_sigdeliver.c * arch/arm/src/arm/up_sigdeliver.c
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -73,10 +73,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.
* *
****************************************************************************/ ****************************************************************************/
@@ -86,9 +85,9 @@ void up_sigdeliver(void)
uint32_t regs[XCPTCONTEXT_REGS]; uint32_t regs[XCPTCONTEXT_REGS];
sig_deliver_t sigdeliver; sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the /* Save the errno. This must be preserved throughout the signal handling
* signal handling so that the user code final gets * so that the user code final gets the correct errno value (probably
* the correct errno value (probably EINTR). * EINTR).
*/ */
int saved_errno = rtcb->pterrno; int saved_errno = rtcb->pterrno;
@@ -105,11 +104,9 @@ void up_sigdeliver(void)
regs[REG_PC] = rtcb->xcp.saved_pc; regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_CPSR] = rtcb->xcp.saved_cpsr; regs[REG_CPSR] = rtcb->xcp.saved_cpsr;
/* Get a local copy of the sigdeliver function pointer. /* Get a local copy of the sigdeliver function pointer. we do this so that
* we do this so that we can nullify the sigdeliver * we can nullify the sigdeliver function pointer in the TCB and accept
* function point in the TCB and accept more signal * more signal deliveries while processing the current pending signals.
* deliveries while processing the current pending
* signals.
*/ */
sigdeliver = rtcb->xcp.sigdeliver; sigdeliver = rtcb->xcp.sigdeliver;
@@ -123,18 +120,16 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoreing errno /* Output any debug messages BEFORE restoring errno (because they may
* (becuase they may alter errno), then restore the * alter errno), then disable interrupts again and restore the original
* original errno that is needed by the user logic * errno that is needed by the user logic (it is probably EINTR).
* (it is probably EINTR).
*/ */
sdbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of execution. */
* execution.
*/
up_ledoff(LED_SIGNAL); up_ledoff(LED_SIGNAL);
up_fullcontextrestore(regs); up_fullcontextrestore(regs);
+1 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/cortexm3/up_schedulesigaction.c * arch/arm/src/cortexm3/up_schedulesigaction.c
* *
* Copyright (C) 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
+14 -17
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/cortexm3/up_sigdeliver.c * arch/arm/src/cortexm3/up_sigdeliver.c
* *
* Copyright (C) 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -73,10 +73,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.
* *
****************************************************************************/ ****************************************************************************/
@@ -86,9 +85,9 @@ void up_sigdeliver(void)
uint32_t regs[XCPTCONTEXT_REGS]; uint32_t regs[XCPTCONTEXT_REGS];
sig_deliver_t sigdeliver; sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the /* Save the errno. This must be preserved throughout the signal handling
* signal handling so that the user code final gets * so that the user code final gets the correct errno value (probably
* the correct errno value (probably EINTR). * EINTR).
*/ */
int saved_errno = rtcb->pterrno; int saved_errno = rtcb->pterrno;
@@ -106,11 +105,9 @@ void up_sigdeliver(void)
regs[REG_PRIMASK] = rtcb->xcp.saved_primask; regs[REG_PRIMASK] = rtcb->xcp.saved_primask;
regs[REG_XPSR] = rtcb->xcp.saved_xpsr; regs[REG_XPSR] = rtcb->xcp.saved_xpsr;
/* Get a local copy of the sigdeliver function pointer. /* Get a local copy of the sigdeliver function pointer. We do this so that
* we do this so that we can nullify the sigdeliver * we can nullify the sigdeliver function pointer in the TCB and accept
* function point in the TCB and accept more signal * more signal deliveries while processing the current pending signals.
* deliveries while processing the current pending
* signals.
*/ */
sigdeliver = rtcb->xcp.sigdeliver; sigdeliver = rtcb->xcp.sigdeliver;
@@ -124,13 +121,13 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoreing errno /* Output any debug messages BEFORE restoring errno (because they may
* (becuase they may alter errno), then restore the * alter errno), then disable interrupts again and restore the original
* original errno that is needed by the user logic * errno that is needed by the user logic (it is probably EINTR).
* (it is probably EINTR).
*/ */
sdbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of
+8 -9
View File
@@ -103,9 +103,9 @@ void up_sigdeliver(void)
regs[REG_PC] = rtcb->xcp.saved_pc; regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_SR] = rtcb->xcp.saved_sr; 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 that
* we can nullify the sigdeliver function point in the TCB and accept more * we can nullify the sigdeliver function pointer in the TCB and accept
* signal deliveries while processing the current pending signals. * more signal deliveries while processing the current pending signals.
*/ */
sigdeliver = rtcb->xcp.sigdeliver; sigdeliver = rtcb->xcp.sigdeliver;
@@ -119,17 +119,16 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoring errno (becuase they may /* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then restore the original errno that is needed by * alter errno), then disable interrupts again and restore the original
* the user logic (it is probably EINTR). * errno that is needed by the user logic (it is probably EINTR).
*/ */
sdbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of execution. */
* execution.
*/
up_ledoff(LED_SIGNAL); up_ledoff(LED_SIGNAL);
up_fullcontextrestore(regs); up_fullcontextrestore(regs);
+1 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/sh/src/m16c/m16c_schedulesigaction.c * arch/sh/src/m16c/m16c_schedulesigaction.c
* *
* Copyright (C) 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
+14 -16
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/sh/src/m16c/m16c_sigdeliver.c * arch/sh/src/m16c/m16c_sigdeliver.c
* *
* Copyright (C) 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -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.
* *
****************************************************************************/ ****************************************************************************/
@@ -86,9 +85,9 @@ void up_sigdeliver(void)
uint8_t regs[XCPTCONTEXT_SIZE]; uint8_t regs[XCPTCONTEXT_SIZE];
sig_deliver_t sigdeliver; sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the /* Save the errno. This must be preserved throughout the signal handling
* signal handling so that the user code final gets * so that the user code final gets the correct errno value (probably
* the correct errno value (probably EINTR). * EINTR).
*/ */
int saved_errno = rtcb->pterrno; int saved_errno = rtcb->pterrno;
@@ -106,10 +105,9 @@ void up_sigdeliver(void)
regs[REG_PC+1] = rtcb->xcp.saved_pc[1]; regs[REG_PC+1] = rtcb->xcp.saved_pc[1];
regs[REG_FLG] = rtcb->xcp.saved_flg; regs[REG_FLG] = rtcb->xcp.saved_flg;
/* 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 pointer 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.
*/ */
@@ -124,13 +122,13 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoreing errno /* Output any debug messages BEFORE restoring errno (because they may
* (becuase they may alter errno), then restore the * alter errno), then disable interrupts again and restore the original
* original errno that is needed by the user logic * errno that is needed by the user logic (it is probably EINTR).
* (it is probably EINTR).
*/ */
sdbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of
+1 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/sh/src/sh1/sh1_schedulesigaction.c * arch/sh/src/sh1/sh1_schedulesigaction.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
+16 -20
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* common/up_sigdeliver.c * common/up_sigdeliver.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -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.
* *
****************************************************************************/ ****************************************************************************/
@@ -86,9 +85,9 @@ void up_sigdeliver(void)
uint32_t regs[XCPTCONTEXT_REGS]; uint32_t regs[XCPTCONTEXT_REGS];
sig_deliver_t sigdeliver; sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the /* Save the errno. This must be preserved throughout the signal handling
* signal handling so that the user code final gets * so that the user code final gets the correct errno value (probably
* the correct errno value (probably EINTR). * EINTR).
*/ */
int saved_errno = rtcb->pterrno; int saved_errno = rtcb->pterrno;
@@ -105,17 +104,16 @@ void up_sigdeliver(void)
regs[REG_PC] = rtcb->xcp.saved_pc; regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_SR] = rtcb->xcp.saved_sr; regs[REG_SR] = rtcb->xcp.saved_sr;
/* 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 pointer 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.
*/ */
sigdeliver = rtcb->xcp.sigdeliver; sigdeliver = rtcb->xcp.sigdeliver;
rtcb->xcp.sigdeliver = NULL; rtcb->xcp.sigdeliver = NULL;
/* Then restore the task interrupt statat. */ /* Then restore the task interrupt state. */
irqrestore(regs[REG_SR] & 0x000000f0); irqrestore(regs[REG_SR] & 0x000000f0);
@@ -123,18 +121,16 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoreing errno /* Output any debug messages BEFORE restoring errno (because they may
* (becuase they may alter errno), then restore the * alter errno), then disable interrupts again and restore the original
* original errno that is needed by the user logic * errno that is needed by the user logic (it is probably EINTR).
* (it is probably EINTR).
*/ */
sdbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of execution. */
* execution.
*/
up_ledoff(LED_SIGNAL); up_ledoff(LED_SIGNAL);
up_fullcontextrestore(regs); up_fullcontextrestore(regs);
+2 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* up_schedulesigaction.c * up_schedulesigaction.c
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -98,7 +98,7 @@
void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver) void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
{ {
/* We don't have to anything complex of the simulated target */ /* We don't have to anything complex for the simulated target */
if (tcb == (_TCB*)g_readytorun.head) if (tcb == (_TCB*)g_readytorun.head)
{ {
+1 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* common/up_schedulesigaction.c * common/up_schedulesigaction.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
+8 -9
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* common/up_sigdeliver.c * common/up_sigdeliver.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -95,7 +95,7 @@ void up_sigdeliver(void)
up_ledon(LED_SIGNAL); up_ledon(LED_SIGNAL);
dbg("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", sdbg("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head); rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
ASSERT(rtcb->xcp.sigdeliver != NULL); ASSERT(rtcb->xcp.sigdeliver != NULL);
@@ -125,17 +125,16 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoring errno (because they may /* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then restore the original errno that is needed by * alter errno), then disable interrupts again and restore the original
* the user logic (it is probably EINTR). * errno that is needed by the user logic (it is probably EINTR).
*/ */
dbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of execution. */
* execution.
*/
up_ledoff(LED_SIGNAL); up_ledoff(LED_SIGNAL);
SIGNAL_RETURN(regs); SIGNAL_RETURN(regs);
+1 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/z80/src/ez80/ez80_schedulesigaction.c * arch/z80/src/ez80/ez80_schedulesigaction.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
+11 -10
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/z80/src/ez80/ez80_sigdeliver.c * arch/z80/src/ez80/ez80_sigdeliver.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -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,8 +105,9 @@ void up_sigdeliver(void)
regs[XCPT_I] = rtcb->xcp.saved_i; regs[XCPT_I] = rtcb->xcp.saved_i;
/* Get a local copy of the sigdeliver function pointer. We do this so /* Get a local copy of the sigdeliver function pointer. We do this so
* that we can nullify the sigdeliver function point in the TCB and accept * that we can nullify the sigdeliver function pointer in the TCB and
* more signal deliveries while processing the current pending signals. * accept more signal deliveries while processing the current pending
* signals.
*/ */
sigdeliver = rtcb->xcp.sigdeliver; sigdeliver = rtcb->xcp.sigdeliver;
@@ -121,12 +121,13 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoring errno (because they may alter /* Output any debug messages BEFORE restoring errno (because they may
* errno), then restore the original errno that is needed by the user logic * alter errno), then disable interrupts again and restore the original
* (it is probably EINTR). * errno that is needed by the user logic (it is probably EINTR).
*/ */
sdbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of
+1 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/z80/src/z8/z8_schedulesigaction.c * arch/z80/src/z8/z8_schedulesigaction.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
+14 -15
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/z80/src/z8/z8_sigdeliver.c * arch/z80/src/z8/z8_sigdeliver.c
* *
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -86,10 +86,9 @@ static void z8_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src)
* 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.
* *
****************************************************************************/ ****************************************************************************/
@@ -109,7 +108,7 @@ void up_sigdeliver(void)
up_ledon(LED_SIGNAL); up_ledon(LED_SIGNAL);
dbg("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", sdbg("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head); rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
ASSERT(rtcb->xcp.sigdeliver != NULL); ASSERT(rtcb->xcp.sigdeliver != NULL);
@@ -120,8 +119,9 @@ void up_sigdeliver(void)
regs[XCPT_IRQCTL] = rtcb->xcp.saved_irqctl; regs[XCPT_IRQCTL] = rtcb->xcp.saved_irqctl;
/* Get a local copy of the sigdeliver function pointer. We do this so /* Get a local copy of the sigdeliver function pointer. We do this so
* that we can nullify the sigdeliver function point in the TCB and accept * that we can nullify the sigdeliver function pointer in the TCB and
* more signal deliveries while processing the current pending signals. * accept more signal deliveries while processing the current pending
* signals.
*/ */
sigdeliver = rtcb->xcp.sigdeliver; sigdeliver = rtcb->xcp.sigdeliver;
@@ -135,17 +135,16 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoring errno (because they may alter /* Output any debug messages BEFORE restoring errno (because they may
* errno), then restore the original errno that is needed by the user logic * alter errno), then disable interrupts again and restore the original
* (it is probably EINTR). * errno that is needed by the user logic (it is probably EINTR).
*/ */
dbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of execution. */
* execution.
*/
up_ledoff(LED_SIGNAL); up_ledoff(LED_SIGNAL);
z8_restorecontext(regs); z8_restorecontext(regs);
+1 -1
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/z80/src/z80/z80_schedulesigaction.c * arch/z80/src/z80/z80_schedulesigaction.c
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
+14 -15
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/z80/src/z80/z80_sigdeliver.c * arch/z80/src/z80/z80_sigdeliver.c
* *
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -71,10 +71,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.
* *
****************************************************************************/ ****************************************************************************/
@@ -94,7 +93,7 @@ void up_sigdeliver(void)
up_ledon(LED_SIGNAL); up_ledon(LED_SIGNAL);
dbg("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n", sdbg("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head); rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
ASSERT(rtcb->xcp.sigdeliver != NULL); ASSERT(rtcb->xcp.sigdeliver != NULL);
@@ -105,8 +104,9 @@ void up_sigdeliver(void)
regs[XCPT_I] = rtcb->xcp.saved_i; regs[XCPT_I] = rtcb->xcp.saved_i;
/* Get a local copy of the sigdeliver function pointer. We do this so /* Get a local copy of the sigdeliver function pointer. We do this so
* that we can nullify the sigdeliver function point in the TCB and accept * that we can nullify the sigdeliver function pointer in the TCB and
* more signal deliveries while processing the current pending signals. * accept more signal deliveries while processing the current pending
* signals.
*/ */
sigdeliver = rtcb->xcp.sigdeliver; sigdeliver = rtcb->xcp.sigdeliver;
@@ -120,17 +120,16 @@ void up_sigdeliver(void)
sigdeliver(rtcb); sigdeliver(rtcb);
/* Output any debug messaged BEFORE restoring errno (because they may alter /* Output any debug messages BEFORE restoring errno (because they may
* errno), then restore the original errno that is needed by the user logic * alter errno), then disable interrupts again and restore the original
* (it is probably EINTR). * errno that is needed by the user logic (it is probably EINTR).
*/ */
dbg("Resuming\n"); sdbg("Resuming\n");
(void)irqsave();
rtcb->pterrno = saved_errno; rtcb->pterrno = saved_errno;
/* Then restore the correct state for this thread of /* Then restore the correct state for this thread of execution. */
* execution.
*/
up_ledoff(LED_SIGNAL); up_ledoff(LED_SIGNAL);
z80_restoreusercontext(regs); z80_restoreusercontext(regs);