Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the size of tcb #15345

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions arch/arm/src/arm/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#include "arm.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"

/****************************************************************************
Expand Down Expand Up @@ -90,8 +91,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
{
/* In this case just deliver the signal now. */

(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
}

/* Otherwise, we are (1) signaling a task is not running
Expand Down
13 changes: 8 additions & 5 deletions arch/arm/src/arm/arm_sigdeliver.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <arch/board/board.h>

#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"

/****************************************************************************
Expand All @@ -59,9 +60,9 @@ void arm_sigdeliver(void)

board_autoled_on(LED_SIGNAL);

sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);

#ifndef CONFIG_SUPPRESS_INTERRUPTS
/* Then make sure that interrupts are enabled. Signal handlers must always
Expand All @@ -73,7 +74,7 @@ void arm_sigdeliver(void)

/* Deliver the signal */

(rtcb->sigdeliver)(rtcb);
nxsig_deliver(rtcb);

/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
Expand All @@ -93,7 +94,9 @@ void arm_sigdeliver(void)
* could be modified by a hostile program.
*/

rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Allows next handler to be scheduled */

rtcb->flags &= ~TCB_FLAG_SIGDELIVER;

/* Then restore the correct state for this thread of execution. */

Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv6-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#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"
Expand Down Expand Up @@ -86,7 +87,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

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

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/armv6-m/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#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"
Expand Down Expand Up @@ -96,8 +97,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handle will run in a critical section!
*/

(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
}
else if (tcb == rtcb && ipsr != NVIC_IRQ_PENDSV)
{
Expand Down
13 changes: 8 additions & 5 deletions arch/arm/src/armv6-m/arm_sigdeliver.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <arch/board/board.h>

#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"

/****************************************************************************
Expand Down Expand Up @@ -69,9 +70,9 @@ void arm_sigdeliver(void)

board_autoled_on(LED_SIGNAL);

sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);

retry:
#ifdef CONFIG_SMP
Expand Down Expand Up @@ -103,7 +104,7 @@ void arm_sigdeliver(void)

/* Deliver the signal */

(rtcb->sigdeliver)(rtcb);
nxsig_deliver(rtcb);

/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
Expand Down Expand Up @@ -150,7 +151,9 @@ void arm_sigdeliver(void)
* could be modified by a hostile program.
*/

rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Allows next handler to be scheduled */

rtcb->flags &= ~TCB_FLAG_SIGDELIVER;

/* Then restore the correct state for this thread of
* execution.
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/armv7-a/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "arm.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"
#include "irq/irq.h"

Expand Down Expand Up @@ -94,8 +95,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/

(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
}
else
{
Expand Down
13 changes: 8 additions & 5 deletions arch/arm/src/armv7-a/arm_sigdeliver.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <arch/board/board.h>

#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"

/****************************************************************************
Expand Down Expand Up @@ -69,9 +70,9 @@ void arm_sigdeliver(void)

board_autoled_on(LED_SIGNAL);

sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);

retry:
#ifdef CONFIG_SMP
Expand Down Expand Up @@ -103,7 +104,7 @@ void arm_sigdeliver(void)

/* Deliver the signal */

(rtcb->sigdeliver)(rtcb);
nxsig_deliver(rtcb);

/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
Expand Down Expand Up @@ -150,7 +151,9 @@ void arm_sigdeliver(void)
* could be modified by a hostile program.
*/

rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Allows next handler to be scheduled */

rtcb->flags &= ~TCB_FLAG_SIGDELIVER;

/* Then restore the correct state for this thread of execution. */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-a/arm_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ uint32_t *arm_syscall(uint32_t *regs)

/* Copy "info" into user stack */

if (rtcb->sigdeliver)
if ((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0)
{
usp = rtcb->xcp.saved_regs[REG_SP];
}
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/src/armv7-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#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"
Expand Down Expand Up @@ -86,7 +87,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

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

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/armv7-m/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#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"
Expand Down Expand Up @@ -97,8 +98,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handle will run in a critical section!
*/

(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
}
else if (tcb == rtcb && ipsr != NVIC_IRQ_PENDSV)
{
Expand Down
13 changes: 8 additions & 5 deletions arch/arm/src/armv7-m/arm_sigdeliver.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <arch/board/board.h>

#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"

/****************************************************************************
Expand Down Expand Up @@ -69,9 +70,9 @@ void arm_sigdeliver(void)

board_autoled_on(LED_SIGNAL);

sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);

retry:
#ifdef CONFIG_SMP
Expand Down Expand Up @@ -103,7 +104,7 @@ void arm_sigdeliver(void)

/* Deliver the signal */

(rtcb->sigdeliver)(rtcb);
nxsig_deliver(rtcb);

/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
Expand Down Expand Up @@ -150,7 +151,9 @@ void arm_sigdeliver(void)
* could be modified by a hostile program.
*/

rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Allows next handler to be scheduled */

rtcb->flags &= ~TCB_FLAG_SIGDELIVER;

/* Then restore the correct state for this thread of
* execution.
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/armv7-r/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#include "arm.h"
#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"

/****************************************************************************
Expand Down Expand Up @@ -92,8 +93,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handler will run in a critical section!
*/

(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
}
else
{
Expand Down
13 changes: 8 additions & 5 deletions arch/arm/src/armv7-r/arm_sigdeliver.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <arch/board/board.h>

#include "sched/sched.h"
#include "signal/signal.h"
#include "arm_internal.h"

/****************************************************************************
Expand Down Expand Up @@ -69,9 +70,9 @@ void arm_sigdeliver(void)

board_autoled_on(LED_SIGNAL);

sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
sinfo("rtcb=%p sigpendactionq.head=%p\n",
rtcb, rtcb->sigpendactionq.head);
DEBUGASSERT((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0);

retry:
#ifdef CONFIG_SMP
Expand Down Expand Up @@ -103,7 +104,7 @@ void arm_sigdeliver(void)

/* Deliver the signal */

(rtcb->sigdeliver)(rtcb);
nxsig_deliver(rtcb);

/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
Expand Down Expand Up @@ -147,7 +148,9 @@ void arm_sigdeliver(void)
* could be modified by a hostile program.
*/

rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Allows next handler to be scheduled */

rtcb->flags &= ~TCB_FLAG_SIGDELIVER;

/* Then restore the correct state for this thread of execution. */

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv7-r/arm_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ uint32_t *arm_syscall(uint32_t *regs)

/* Copy "info" into user stack */

if (rtcb->sigdeliver)
if ((rtcb->flags & TCB_FLAG_SIGDELIVER) != 0)
{
usp = rtcb->xcp.saved_regs[REG_SP];
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/src/armv8-m/arm_doirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs)

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

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/armv8-m/arm_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#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"
Expand Down Expand Up @@ -97,8 +98,8 @@ void up_schedule_sigaction(struct tcb_s *tcb)
* REVISIT: Signal handle will run in a critical section!
*/

(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
nxsig_deliver(tcb);
tcb->flags &= ~TCB_FLAG_SIGDELIVER;
}
else if (tcb == rtcb && ipsr != NVIC_IRQ_PENDSV)
{
Expand Down
Loading
Loading