From 665c4bf764eb07e58e70393c08671a2dfcd834bb Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 27 Oct 2010 01:46:08 +0000 Subject: Fix a signal trampoline bug git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3053 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/z80/src/ez80/ez80_schedulesigaction.c | 2 +- nuttx/arch/z80/src/ez80/ez80_sigdeliver.c | 21 +++++++++-------- nuttx/arch/z80/src/z8/z8_schedulesigaction.c | 2 +- nuttx/arch/z80/src/z8/z8_sigdeliver.c | 29 ++++++++++++------------ nuttx/arch/z80/src/z80/z80_schedulesigaction.c | 2 +- nuttx/arch/z80/src/z80/z80_sigdeliver.c | 29 ++++++++++++------------ 6 files changed, 42 insertions(+), 43 deletions(-) (limited to 'nuttx/arch/z80') diff --git a/nuttx/arch/z80/src/ez80/ez80_schedulesigaction.c b/nuttx/arch/z80/src/ez80/ez80_schedulesigaction.c index 8c9a84260..ce48fe987 100644 --- a/nuttx/arch/z80/src/ez80/ez80_schedulesigaction.c +++ b/nuttx/arch/z80/src/ez80/ez80_schedulesigaction.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/arch/z80/src/ez80/ez80_sigdeliver.c b/nuttx/arch/z80/src/ez80/ez80_sigdeliver.c index 90fdf4c6b..86aaad2d5 100644 --- a/nuttx/arch/z80/src/ez80/ez80_sigdeliver.c +++ b/nuttx/arch/z80/src/ez80/ez80_sigdeliver.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without @@ -72,10 +72,9 @@ * Name: up_sigdeliver * * Description: - * This is the a signal handling trampoline. When a - * signal action was posted. The task context was mucked - * with and forced to branch to this location with interrupts - * disabled. + * This is the a signal handling trampoline. When a signal action was + * posted. The task context was mucked with and forced to branch to this + * location with interrupts disabled. * ****************************************************************************/ @@ -106,8 +105,9 @@ void up_sigdeliver(void) regs[XCPT_I] = rtcb->xcp.saved_i; /* 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 signal deliveries while processing the current pending signals. + * that we can nullify the sigdeliver function pointer in the TCB and + * accept more signal deliveries while processing the current pending + * signals. */ sigdeliver = rtcb->xcp.sigdeliver; @@ -121,12 +121,13 @@ void up_sigdeliver(void) sigdeliver(rtcb); - /* Output any debug messaged BEFORE restoring errno (because they may alter - * errno), then restore the original errno that is needed by the user logic - * (it is probably EINTR). + /* Output any debug messages BEFORE restoring errno (because they may + * alter errno), then disable interrupts again and restore the original + * errno that is needed by the user logic (it is probably EINTR). */ sdbg("Resuming\n"); + (void)irqsave(); rtcb->pterrno = saved_errno; /* Then restore the correct state for this thread of diff --git a/nuttx/arch/z80/src/z8/z8_schedulesigaction.c b/nuttx/arch/z80/src/z8/z8_schedulesigaction.c index 0a5b9c095..1f1a35471 100644 --- a/nuttx/arch/z80/src/z8/z8_schedulesigaction.c +++ b/nuttx/arch/z80/src/z8/z8_schedulesigaction.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/arch/z80/src/z8/z8_sigdeliver.c b/nuttx/arch/z80/src/z8/z8_sigdeliver.c index badb8a328..c5cf30aa6 100644 --- a/nuttx/arch/z80/src/z8/z8_sigdeliver.c +++ b/nuttx/arch/z80/src/z8/z8_sigdeliver.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * 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 * * Description: - * This is the a signal handling trampoline. When a - * signal action was posted. The task context was mucked - * with and forced to branch to this location with interrupts - * disabled. + * This is the a signal handling trampoline. When a signal action was + * posted. The task context was mucked with and forced to branch to this + * location with interrupts disabled. * ****************************************************************************/ @@ -109,7 +108,7 @@ void up_sigdeliver(void) 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); ASSERT(rtcb->xcp.sigdeliver != NULL); @@ -120,8 +119,9 @@ void up_sigdeliver(void) regs[XCPT_IRQCTL] = rtcb->xcp.saved_irqctl; /* 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 signal deliveries while processing the current pending signals. + * that we can nullify the sigdeliver function pointer in the TCB and + * accept more signal deliveries while processing the current pending + * signals. */ sigdeliver = rtcb->xcp.sigdeliver; @@ -135,17 +135,16 @@ void up_sigdeliver(void) sigdeliver(rtcb); - /* Output any debug messaged BEFORE restoring errno (because they may alter - * errno), then restore the original errno that is needed by the user logic - * (it is probably EINTR). + /* Output any debug messages BEFORE restoring errno (because they may + * alter errno), then disable interrupts again and restore the original + * errno that is needed by the user logic (it is probably EINTR). */ - dbg("Resuming\n"); + sdbg("Resuming\n"); + (void)irqsave(); rtcb->pterrno = saved_errno; - /* Then restore the correct state for this thread of - * execution. - */ + /* Then restore the correct state for this thread of execution. */ up_ledoff(LED_SIGNAL); z8_restorecontext(regs); diff --git a/nuttx/arch/z80/src/z80/z80_schedulesigaction.c b/nuttx/arch/z80/src/z80/z80_schedulesigaction.c index 19ea6d6bc..24b12731c 100644 --- a/nuttx/arch/z80/src/z80/z80_schedulesigaction.c +++ b/nuttx/arch/z80/src/z80/z80_schedulesigaction.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/arch/z80/src/z80/z80_sigdeliver.c b/nuttx/arch/z80/src/z80/z80_sigdeliver.c index 884a5c4b6..c6aa5ff3c 100644 --- a/nuttx/arch/z80/src/z80/z80_sigdeliver.c +++ b/nuttx/arch/z80/src/z80/z80_sigdeliver.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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 * * Redistribution and use in source and binary forms, with or without @@ -71,10 +71,9 @@ * Name: up_sigdeliver * * Description: - * This is the a signal handling trampoline. When a - * signal action was posted. The task context was mucked - * with and forced to branch to this location with interrupts - * disabled. + * This is the a signal handling trampoline. When a signal action was + * posted. The task context was mucked with and forced to branch to this + * location with interrupts disabled. * ****************************************************************************/ @@ -94,7 +93,7 @@ void up_sigdeliver(void) 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); ASSERT(rtcb->xcp.sigdeliver != NULL); @@ -105,8 +104,9 @@ void up_sigdeliver(void) regs[XCPT_I] = rtcb->xcp.saved_i; /* 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 signal deliveries while processing the current pending signals. + * that we can nullify the sigdeliver function pointer in the TCB and + * accept more signal deliveries while processing the current pending + * signals. */ sigdeliver = rtcb->xcp.sigdeliver; @@ -120,17 +120,16 @@ void up_sigdeliver(void) sigdeliver(rtcb); - /* Output any debug messaged BEFORE restoring errno (because they may alter - * errno), then restore the original errno that is needed by the user logic - * (it is probably EINTR). + /* Output any debug messages BEFORE restoring errno (because they may + * alter errno), then disable interrupts again and restore the original + * errno that is needed by the user logic (it is probably EINTR). */ - dbg("Resuming\n"); + sdbg("Resuming\n"); + (void)irqsave(); rtcb->pterrno = saved_errno; - /* Then restore the correct state for this thread of - * execution. - */ + /* Then restore the correct state for this thread of execution. */ up_ledoff(LED_SIGNAL); z80_restoreusercontext(regs); -- cgit v1.2.3