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
+2 -3
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
+5 -8
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. */
+1 -2
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 */
+2 -3
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)
{
+5 -8
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.
+2 -3
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
{
+5 -8
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. */
+1 -1
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];
}
+1 -2
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 */
+2 -3
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)
{
+5 -8
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.
+2 -3
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
{
+5 -8
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. */
+1 -1
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];
}
+1 -1
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 */
+2 -3
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)
{
+5 -8
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.
+2 -3
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
{
+5 -8
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. */
+1 -1
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];
}
@@ -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
@@ -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
{
+5 -8
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. */
+2 -3
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
+10 -13
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
+1 -1
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.
+2 -3
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
+7 -11
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
@@ -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.
+10 -8
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
@@ -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
+5 -9
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.
+2 -3
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
+5 -9
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.
@@ -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
+10 -8
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
@@ -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
@@ -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
+5 -9
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.
@@ -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
+7 -6
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
+2 -3
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
+7 -11
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. */
@@ -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
{
+5 -6
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.
+2 -3
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;
}
}
+6 -7
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 */
@@ -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.
@@ -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
@@ -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

Some files were not shown because too many files have changed in this diff Show More