Revert "Reduce the size of tcb by four bytes."

This reverts commit 893c5e92c2.
This commit is contained in:
wangzhi16 2025-05-27 10:56:42 +08:00 committed by Xiang Xiao
parent 17476346d1
commit 35a62b7d5e
70 changed files with 267 additions and 369 deletions

View file

@ -35,7 +35,6 @@
#include "arm.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -91,8 +90,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* Otherwise, we are (1) signaling a task is not running

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -60,9 +59,9 @@ void arm_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* Then make sure that interrupts are enabled. Signal handlers must always
@ -74,7 +73,7 @@ void arm_sigdeliver(void)
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -94,9 +93,7 @@ void arm_sigdeliver(void)
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -34,7 +34,6 @@
#include <nuttx/board.h>
#include <arch/board/board.h>
#include <sched/sched.h>
#include <signal/signal.h>
#include "arm_internal.h"
#include "exc_return.h"
@ -87,7 +86,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
irq_dispatch(irq, regs);
#endif
if ((tcb->flags & TCB_FLAG_SIGDELIVER) != 0)
if (tcb->sigdeliver)
{
/* Pendsv able to access running tcb with no critical section */

View file

@ -37,7 +37,6 @@
#include "psr.h"
#include "exc_return.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
#include "irq/irq.h"
#include "nvic.h"
@ -97,8 +96,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handle will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else if (tcb == rtcb && ipsr != NVIC_IRQ_PENDSV)
{

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -70,9 +69,9 @@ void arm_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -104,7 +103,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -151,9 +150,7 @@ retry:
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of
* execution.

View file

@ -36,7 +36,6 @@
#include "arm.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
#include "irq/irq.h"
@ -95,8 +94,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
{

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -70,9 +69,9 @@ void arm_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -104,7 +103,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -151,9 +150,7 @@ retry:
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -411,7 +411,7 @@ uint32_t *arm_syscall(uint32_t *regs)
/* Copy "info" into user stack */
if ((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0)
if (rtcb->sigdeliver)
{
usp = rtcb->xcp.saved_regs[REG_SP];
}

View file

@ -34,7 +34,6 @@
#include <nuttx/board.h>
#include <arch/board/board.h>
#include <sched/sched.h>
#include <signal/signal.h>
#include "arm_internal.h"
#include "exc_return.h"
@ -87,7 +86,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
irq_dispatch(irq, regs);
#endif
if ((tcb->flags & TCB_FLAG_SIGDELIVER) != 0)
if (tcb->sigdeliver)
{
/* Pendsv able to access running tcb with no critical section */

View file

@ -38,7 +38,6 @@
#include "psr.h"
#include "exc_return.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
#include "irq/irq.h"
#include "nvic.h"
@ -98,8 +97,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handle will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else if (tcb == rtcb && ipsr != NVIC_IRQ_PENDSV)
{

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -70,9 +69,9 @@ void arm_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -104,7 +103,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -151,9 +150,7 @@ retry:
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of
* execution.

View file

@ -35,7 +35,6 @@
#include "arm.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -93,8 +92,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
{

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -70,9 +69,9 @@ void arm_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -104,7 +103,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -148,9 +147,7 @@ retry:
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -405,7 +405,7 @@ uint32_t *arm_syscall(uint32_t *regs)
/* Copy "info" into user stack */
if ((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0)
if (rtcb->sigdeliver)
{
usp = rtcb->xcp.saved_regs[REG_SP];
}

View file

@ -97,7 +97,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)
irq_dispatch(irq, regs);
#endif
if ((tcb->flags & TCB_FLAG_SIGDELIVER) != 0)
if (tcb->sigdeliver)
{
/* Pendsv able to access running tcb with no critical section */

View file

@ -38,7 +38,6 @@
#include "psr.h"
#include "exc_return.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
#include "irq/irq.h"
#include "nvic.h"
@ -98,8 +97,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handle will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else if (tcb == rtcb && ipsr != NVIC_IRQ_PENDSV)
{

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -70,9 +69,9 @@ void arm_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -104,7 +103,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -151,9 +150,7 @@ retry:
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of
* execution.

View file

@ -35,7 +35,6 @@
#include "arm.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -93,8 +92,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
{

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -70,9 +69,9 @@ void arm_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -104,7 +103,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -148,9 +147,7 @@ retry:
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -408,7 +408,7 @@ uint32_t *arm_syscall(uint32_t *regs)
/* Copy "info" into user stack */
if ((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0)
if (rtcb->sigdeliver)
{
usp = rtcb->xcp.saved_regs[REG_SP];
}

View file

@ -35,7 +35,6 @@
#include "tc32.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
/****************************************************************************
@ -91,8 +90,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* Otherwise, we are (1) signaling a task is not running

View file

@ -35,7 +35,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm64_internal.h"
#include "arm64_arch.h"
#include "irq/irq.h"
@ -131,8 +130,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
{

View file

@ -35,7 +35,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm64_internal.h"
#include "arm64_arch.h"
#include "irq/irq.h"
@ -70,9 +69,9 @@ void arm64_sigdeliver(void)
flags = (rtcb->xcp.saved_regs[REG_SPSR] & SPSR_DAIF_MASK);
#endif
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -104,7 +103,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -151,9 +150,7 @@ retry:
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
rtcb->xcp.regs = rtcb->xcp.saved_regs;
/* Then restore the correct state for this thread of execution. */

View file

@ -35,7 +35,6 @@
#include <avr/io.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "avr_internal.h"
/****************************************************************************
@ -99,8 +98,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "avr_internal.h"
/****************************************************************************
@ -61,9 +60,9 @@ void avr_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -79,7 +78,7 @@ void avr_sigdeliver(void)
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -99,19 +98,17 @@ void avr_sigdeliver(void)
* could be modified by a hostile program.
*/
regs[REG_PC0] = rtcb->xcp.saved_pc0;
regs[REG_PC1] = rtcb->xcp.saved_pc1;
regs[REG_PC0] = rtcb->xcp.saved_pc0;
regs[REG_PC1] = rtcb->xcp.saved_pc1;
#if defined(REG_PC2)
regs[REG_PC2] = rtcb->xcp.saved_pc2;
regs[REG_PC2] = rtcb->xcp.saved_pc2;
#endif
#if defined(REG_RAMPZ)
regs[REG_RAMPZ] = rtcb->xcp.saved_rampz;
#endif
regs[REG_SREG] = rtcb->xcp.saved_sreg;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
regs[REG_SREG] = rtcb->xcp.saved_sreg;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. This is an
* unusual case that must be handled by up_fullcontextresore. This case is

View file

@ -89,7 +89,7 @@ void up_initial_state(struct tcb_s *tcb)
#else
/* No pending signal delivery */
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
tcb->sigdeliver = NULL;
/* Clear the frame pointer and link register since this is the outermost
* frame.

View file

@ -35,7 +35,6 @@
#include <arch/avr32/avr32.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "avr_internal.h"
/****************************************************************************
@ -97,8 +96,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "avr_internal.h"
/****************************************************************************
@ -65,9 +64,9 @@ void avr_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -83,7 +82,7 @@ void avr_sigdeliver(void)
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -103,12 +102,9 @@ void avr_sigdeliver(void)
* could be modified by a hostile program.
*/
regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_SR] = rtcb->xcp.saved_sr;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_SR] = rtcb->xcp.saved_sr;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. This is an
* unusual case that must be handled by up_fullcontextresore. This case is

View file

@ -33,7 +33,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "ceva_internal.h"
#ifndef CONFIG_DISABLE_SIGNALS
@ -101,8 +100,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: The task that needs to receive the signal is running.

View file

@ -54,6 +54,7 @@ void ceva_sigdeliver(void)
{
struct tcb_s *rtcb = this_task();
uint32_t *regs = rtcb->xcp.saved_regs;
sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the signal handling
* so that the user code final gets the correct errno value (probably
@ -62,20 +63,21 @@ void ceva_sigdeliver(void)
int saved_errno = rtcb->pterrno;
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* We do this so that we can nullify the TCB_FLAG_SIGDELIVER in the TCB
* and accept more signal deliveries while processing the current pending
* signals.
/* Get a local copy of the sigdeliver function pointer. We do this so that
* we can nullify the sigdeliver function pointer in the TCB and accept
* more signal deliveries while processing the current pending signals.
*/
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
sigdeliver = rtcb->sigdeliver;
rtcb->sigdeliver = NULL;
/* Deliver the signal */
nxsig_deliver(rtcb);
sigdeliver(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original

View file

@ -36,7 +36,6 @@
#include <arch/mips32/cp0.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "mips_internal.h"
/****************************************************************************
@ -100,8 +99,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -39,7 +39,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "mips_internal.h"
/****************************************************************************
@ -63,9 +62,9 @@ void mips_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -81,7 +80,7 @@ void mips_sigdeliver(void)
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -105,10 +104,7 @@ void mips_sigdeliver(void)
regs[REG_EPC] = rtcb->xcp.saved_epc;
regs[REG_STATUS] = rtcb->xcp.saved_status;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of
* execution.

View file

@ -35,7 +35,6 @@
#include <arch/lm32/irq.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "lm32.h"
/****************************************************************************
@ -97,8 +96,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -38,7 +38,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "lm32.h"
/****************************************************************************
@ -62,9 +61,9 @@ void lm32_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -80,7 +79,7 @@ void lm32_sigdeliver(void)
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -104,10 +103,7 @@ void lm32_sigdeliver(void)
regs[REG_EPC] = rtcb->xcp.saved_epc;
regs[REG_INT_CTX] = rtcb->xcp.saved_int_ctx;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of
* execution.

View file

@ -36,7 +36,6 @@
#include <arch/minerva/csrdefs.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "minerva.h"
/****************************************************************************
@ -98,8 +97,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the interrupted task

View file

@ -59,12 +59,13 @@ void minerva_sigdeliver(void)
{
struct tcb_s *rtcb = this_task();
uint32_t regs[XCPTCONTEXT_REGS];
sig_deliver_t sigdeliver;
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the real return state on the stack. */
@ -72,12 +73,13 @@ void minerva_sigdeliver(void)
regs[REG_CSR_MEPC] = rtcb->xcp.saved_epc;
regs[REG_CSR_MSTATUS] = rtcb->xcp.saved_int_ctx;
/* We do this so that we can nullify the TCB_FLAG_SIGDELIVER in the TCB
* and accept more signal deliveries while processing the current pending
* signals.
/* Get a local copy of the sigdeliver function pointer. We do this so that
* we can nullify the sigdeliver function pointer in the TCB and accept
* more signal deliveries while processing the current pending signals.
*/
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
sigdeliver = rtcb->sigdeliver;
rtcb->sigdeliver = NULL;
# ifndef CONFIG_SUPPRESS_INTERRUPTS
/* Then make sure that interrupts are enabled. Signal handlers must always
@ -89,7 +91,7 @@ void minerva_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
sigdeliver(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original

View file

@ -34,7 +34,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "or1k_internal.h"
/****************************************************************************
@ -96,8 +95,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -34,7 +34,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "renesas_internal.h"
/****************************************************************************
@ -96,8 +95,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -36,7 +36,6 @@
#include <nuttx/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "renesas_internal.h"
/****************************************************************************
@ -60,9 +59,9 @@ void renesas_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -78,7 +77,7 @@ void renesas_sigdeliver(void)
/* Deliver the signal */
nxsig_deliver(rtcb);
(sig_rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -101,10 +100,7 @@ void renesas_sigdeliver(void)
regs[REG_PC] = rtcb->xcp.saved_pc[0];
regs[REG_PC + 1] = rtcb->xcp.saved_pc[1];
regs[REG_FLG] = rtcb->xcp.saved_flg;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of
* execution.

View file

@ -34,7 +34,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "renesas_internal.h"
/****************************************************************************
@ -96,8 +95,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "renesas_internal.h"
/****************************************************************************
@ -58,12 +57,13 @@ void renesas_sigdeliver(void)
{
struct tcb_s *rtcb = this_task();
uint32_t regs[XCPTCONTEXT_REGS];
sig_deliver_t sigdeliver;
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the real return state on the stack. */
@ -77,7 +77,8 @@ void renesas_sigdeliver(void)
* signals.
*/
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
sigdeliver = rtcb->sigdeliver;
rtcb->sigdeliver = NULL;
#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* Then make sure that interrupts are enabled. Signal handlers must always
@ -89,7 +90,7 @@ void renesas_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
sigdeliver(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original

View file

@ -34,7 +34,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "renesas_internal.h"
/****************************************************************************
@ -96,8 +95,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -36,7 +36,6 @@
#include <nuttx/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "renesas_internal.h"
/****************************************************************************
@ -60,9 +59,9 @@ void renesas_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -78,7 +77,7 @@ void renesas_sigdeliver(void)
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -98,12 +97,9 @@ void renesas_sigdeliver(void)
* could be modified by a hostile program.
*/
regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_SR] = rtcb->xcp.saved_sr;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_SR] = rtcb->xcp.saved_sr;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -36,7 +36,6 @@
#include <nuttx/spinlock.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "riscv_internal.h"
/****************************************************************************
@ -96,8 +95,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
{

View file

@ -39,7 +39,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "riscv_internal.h"
/****************************************************************************
* Public Functions
@ -71,9 +70,9 @@ void riscv_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -105,7 +104,7 @@ retry:
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -150,7 +149,7 @@ retry:
* could be modified by a hostile program.
*/
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of
* execution.

View file

@ -32,7 +32,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
/****************************************************************************
* Public Functions
@ -82,7 +81,7 @@ void up_schedule_sigaction(struct tcb_s *tcb)
if (tcb == this_task())
{
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
}

View file

@ -35,7 +35,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "sim_internal.h"
/****************************************************************************
@ -64,7 +63,7 @@ void sim_sigdeliver(void)
int16_t saved_irqcount;
irqstate_t flags;
#endif
if ((rtcb->flags & TCB_FLAG_SIGDELIVER) == 0)
if (NULL == (rtcb->sigdeliver))
{
return;
}
@ -77,9 +76,9 @@ void sim_sigdeliver(void)
flags = enter_critical_section();
#endif
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* NOTE: we do not save the return state for sim */
@ -106,7 +105,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -138,7 +137,7 @@ retry:
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL;
/* NOTE: we leave a critical section here for sim */

View file

@ -34,7 +34,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "sparc_internal.h"
/****************************************************************************
@ -94,8 +93,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the
@ -193,8 +192,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: The task that needs to receive the signal is running.

View file

@ -38,7 +38,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "sparc_internal.h"
/****************************************************************************
@ -79,9 +78,9 @@ void sparc_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -117,7 +116,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -169,7 +168,7 @@ retry:
regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_NPC] = rtcb->xcp.saved_npc;
regs[REG_PSR] = rtcb->xcp.saved_status;
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
#ifdef CONFIG_SMP
/* Restore the saved 'irqcount' and recover the critical section

View file

@ -36,7 +36,6 @@
#include <nuttx/spinlock.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "tricore_internal.h"
/****************************************************************************
@ -95,8 +94,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "tricore_internal.h"
/****************************************************************************
@ -61,9 +60,9 @@ void tricore_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
@ -77,7 +76,7 @@ retry:
/* Deliver the signal */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -109,7 +108,7 @@ retry:
* could be modified by a hostile program.
*/
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of
* execution.

View file

@ -34,7 +34,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "x86_internal.h"
/****************************************************************************
@ -92,8 +91,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the interrupted task

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "x86_internal.h"
/****************************************************************************
@ -61,9 +60,9 @@ void x86_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -79,7 +78,7 @@ void x86_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -101,10 +100,7 @@ void x86_sigdeliver(void)
regs[REG_EIP] = rtcb->xcp.saved_eip;
regs[REG_EFLAGS] = rtcb->xcp.saved_eflags;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -34,7 +34,6 @@
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "x86_64_internal.h"
/****************************************************************************
@ -84,8 +83,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
if (tcb == this_task() && !up_interrupt_context())
{
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* Otherwise, we are (1) signaling a task is not running from an

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "x86_64_internal.h"
/****************************************************************************
@ -71,9 +70,9 @@ void x86_64_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Align regs to 64 byte boundary for XSAVE */
@ -116,7 +115,7 @@ void x86_64_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -144,10 +143,7 @@ void x86_64_sigdeliver(void)
regs[REG_RIP] = rtcb->xcp.saved_rip;
regs[REG_RSP] = rtcb->xcp.saved_rsp;
regs[REG_RFLAGS] = rtcb->xcp.saved_rflags;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
#ifdef CONFIG_SMP
/* Restore the saved 'irqcount' and recover the critical section

View file

@ -36,7 +36,6 @@
#include "irq/irq.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "chip.h"
#include "xtensa.h"
@ -96,8 +95,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
{

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "xtensa.h"
/****************************************************************************
@ -70,9 +69,9 @@ void xtensa_sig_deliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
retry:
#ifdef CONFIG_SMP
@ -105,7 +104,7 @@ retry:
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -149,9 +148,7 @@ retry:
* could be modified by a hostile program.
*/
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution.
*/

View file

@ -34,7 +34,6 @@
#include <nuttx/irq.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "z16_internal.h"
/****************************************************************************
@ -96,8 +95,8 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the interrupted

View file

@ -37,7 +37,6 @@
#include <arch/board/board.h>
#include "sched/sched.h"
#include "signal/signal.h"
#include "z16_internal.h"
/****************************************************************************
@ -62,9 +61,9 @@ void z16_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -80,7 +79,7 @@ void z16_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -102,7 +101,7 @@ void z16_sigdeliver(void)
regs32[REG_PC / 2] = rtcb->xcp.saved_pc;
regs[REG_FLAGS] = rtcb->xcp.saved_i;
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -35,7 +35,6 @@
#include "chip/switch.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "z80_internal.h"
/****************************************************************************
@ -120,8 +119,8 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the interrupted task

View file

@ -39,7 +39,6 @@
#include "chip/switch.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "z80_internal.h"
/****************************************************************************
@ -63,9 +62,9 @@ void z80_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -81,7 +80,7 @@ void z80_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -101,12 +100,9 @@ void z80_sigdeliver(void)
* could be modified by a hostile program.
*/
regs[XCPT_PC] = rtcb->xcp.saved_pc;
regs[XCPT_I] = rtcb->xcp.saved_i;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
regs[XCPT_PC] = rtcb->xcp.saved_pc;
regs[XCPT_I] = rtcb->xcp.saved_i;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Modify the saved return state with the actual saved values in the
* TCB. This depends on the fact that nested signal handling is

View file

@ -38,7 +38,6 @@
#include "switch.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "z80_internal.h"
/****************************************************************************
@ -123,8 +122,8 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the interrupted task

View file

@ -36,7 +36,6 @@
#include "chip/switch.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "z80_internal.h"
/****************************************************************************
@ -60,9 +59,9 @@ void z80_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -78,7 +77,7 @@ void z80_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -98,12 +97,9 @@ void z80_sigdeliver(void)
* could be modified by a hostile program.
*/
regs[XCPT_PC] = rtcb->xcp.saved_pc;
regs[XCPT_I] = rtcb->xcp.saved_i;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
regs[XCPT_PC] = rtcb->xcp.saved_pc;
regs[XCPT_I] = rtcb->xcp.saved_i;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -35,7 +35,6 @@
#include "chip/switch.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "z80_internal.h"
/****************************************************************************
@ -120,8 +119,8 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the interrupted task

View file

@ -36,7 +36,6 @@
#include "chip/switch.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "z80_internal.h"
/****************************************************************************
@ -79,9 +78,9 @@ void z80_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -97,7 +96,7 @@ void z80_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -119,10 +118,7 @@ void z80_sigdeliver(void)
regs[XCPT_PC] = rtcb->xcp.saved_pc;
regs[XCPT_IRQCTL] = rtcb->xcp.saved_irqctl;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -36,7 +36,6 @@
#include "chip/switch.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "z80_internal.h"
/****************************************************************************
@ -121,8 +120,8 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the interrupted task

View file

@ -36,7 +36,6 @@
#include "chip/switch.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "z80_internal.h"
/****************************************************************************
@ -60,9 +59,9 @@ void z80_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@ -78,7 +77,7 @@ void z80_sigdeliver(void)
/* Deliver the signals */
nxsig_deliver(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@ -98,12 +97,9 @@ void z80_sigdeliver(void)
* could be modified by a hostile program.
*/
regs[XCPT_PC] = rtcb->xcp.saved_pc;
regs[XCPT_I] = rtcb->xcp.saved_i;
/* Allows next handler to be scheduled */
rtcb->flags &= ~TCB_FLAG_SIGDELIVER;
regs[XCPT_PC] = rtcb->xcp.saved_pc;
regs[XCPT_I] = rtcb->xcp.saved_i;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */

View file

@ -68,7 +68,7 @@ static bool syslog_safe_to_block(void)
/* It's not safe to block if a signal is being delivered */
rtcb = nxsched_self();
if ((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0)
if (rtcb->sigdeliver != NULL)
{
return false;
}

View file

@ -93,23 +93,22 @@
# define TCB_FLAG_TTYPE_TASK (0 << TCB_FLAG_TTYPE_SHIFT) /* Normal user task */
# define TCB_FLAG_TTYPE_PTHREAD (1 << TCB_FLAG_TTYPE_SHIFT) /* User pthread */
# define TCB_FLAG_TTYPE_KERNEL (2 << TCB_FLAG_TTYPE_SHIFT) /* Kernel thread */
#define TCB_FLAG_POLICY_SHIFT (2) /* Bit 2-3: Scheduling policy */
#define TCB_FLAG_POLICY_SHIFT (3) /* Bit 3-4: Scheduling policy */
#define TCB_FLAG_POLICY_MASK (3 << TCB_FLAG_POLICY_SHIFT)
# define TCB_FLAG_SCHED_FIFO (0 << TCB_FLAG_POLICY_SHIFT) /* FIFO scheding policy */
# define TCB_FLAG_SCHED_RR (1 << TCB_FLAG_POLICY_SHIFT) /* Round robin scheding policy */
# define TCB_FLAG_SCHED_SPORADIC (2 << TCB_FLAG_POLICY_SHIFT) /* Sporadic scheding policy */
#define TCB_FLAG_CPU_LOCKED (1 << 4) /* Bit 4: Locked to this CPU */
#define TCB_FLAG_SIGNAL_ACTION (1 << 5) /* Bit 5: In a signal handler */
#define TCB_FLAG_SYSCALL (1 << 6) /* Bit 6: In a system call */
#define TCB_FLAG_EXIT_PROCESSING (1 << 7) /* Bit 7: Exiting */
#define TCB_FLAG_FREE_STACK (1 << 8) /* Bit 8: Free stack after exit */
#define TCB_FLAG_HEAP_CHECK (1 << 9) /* Bit 9: Heap check */
#define TCB_FLAG_HEAP_DUMP (1 << 10) /* Bit 10: Heap dump */
#define TCB_FLAG_DETACHED (1 << 11) /* Bit 11: Pthread detached */
#define TCB_FLAG_FORCED_CANCEL (1 << 12) /* Bit 12: Pthread cancel is forced */
#define TCB_FLAG_JOIN_COMPLETED (1 << 13) /* Bit 13: Pthread join completed */
#define TCB_FLAG_FREE_TCB (1 << 14) /* Bit 14: Free tcb after exit */
#define TCB_FLAG_SIGDELIVER (1 << 15) /* Bit 15: Deliver pending signals */
#define TCB_FLAG_CPU_LOCKED (1 << 5) /* Bit 5: Locked to this CPU */
#define TCB_FLAG_SIGNAL_ACTION (1 << 6) /* Bit 6: In a signal handler */
#define TCB_FLAG_SYSCALL (1 << 7) /* Bit 7: In a system call */
#define TCB_FLAG_EXIT_PROCESSING (1 << 8) /* Bit 8: Exiting */
#define TCB_FLAG_FREE_STACK (1 << 9) /* Bit 9: Free stack after exit */
#define TCB_FLAG_HEAP_CHECK (1 << 10) /* Bit 10: Heap check */
#define TCB_FLAG_HEAP_DUMP (1 << 11) /* Bit 11: Heap dump */
#define TCB_FLAG_DETACHED (1 << 12) /* Bit 12: Pthread detached */
#define TCB_FLAG_FORCED_CANCEL (1 << 13) /* Bit 13: Pthread cancel is forced */
#define TCB_FLAG_JOIN_COMPLETED (1 << 14) /* Bit 14: Pthread join completed */
#define TCB_FLAG_FREE_TCB (1 << 15) /* Bit 15: Free tcb after exit */
#define TCB_FLAG_PREEMPT_SCHED (1 << 16) /* Bit 16: tcb is PREEMPT_SCHED */
/* Values for struct task_group tg_flags */
@ -284,6 +283,7 @@ typedef enum tstate_e tstate_t;
/* The following is the form of a thread start-up function */
typedef CODE void (*start_t)(void);
typedef CODE void (*sig_deliver_t)(FAR struct tcb_s *tcb);
/* This is the entry point into the main thread of the task or into a created
* pthread within the task.
@ -697,6 +697,11 @@ struct tcb_s
struct xcptcontext xcp; /* Interrupt register save area */
/* The following function pointer is non-zero if there are pending signals
* to be processed.
*/
sig_deliver_t sigdeliver;
#if CONFIG_TASK_NAME_SIZE > 0
char name[CONFIG_TASK_NAME_SIZE + 1]; /* Task name (with NUL terminator) */
#endif

View file

@ -86,7 +86,7 @@ static int sig_handler(FAR void *cookie)
tcb->flags &= ~TCB_FLAG_CPU_LOCKED;
}
if ((tcb->flags & TCB_FLAG_SIGDELIVER) != 0)
if (tcb->sigdeliver)
{
up_schedule_sigaction(tcb);
}
@ -158,13 +158,13 @@ static int nxsig_queue_action(FAR struct tcb_s *stcb,
* up_schedule_sigaction()
*/
if ((stcb->flags & TCB_FLAG_SIGDELIVER) == 0)
if (!stcb->sigdeliver)
{
#ifdef CONFIG_SMP
int cpu = stcb->cpu;
int me = this_cpu();
stcb->flags |= TCB_FLAG_SIGDELIVER;
stcb->sigdeliver = nxsig_deliver;
if (cpu != me && stcb->task_state == TSTATE_TASK_RUNNING)
{
struct sig_arg_s arg;
@ -189,7 +189,7 @@ static int nxsig_queue_action(FAR struct tcb_s *stcb,
else
#endif
{
stcb->flags |= TCB_FLAG_SIGDELIVER;
stcb->sigdeliver = nxsig_deliver;
up_schedule_sigaction(stcb);
}
}