mirror of
https://github.com/apache/nuttx.git
synced 2025-12-17 10:16:49 +08:00
arch: move sigdeliver to common code
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -127,12 +127,6 @@
|
|||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there
|
|
||||||
* are pending signals to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -152,12 +152,6 @@ struct xcpt_syscall_s
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there
|
|
||||||
* are pending signals to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -253,12 +253,6 @@ struct xcpt_syscall_s
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -212,12 +212,6 @@ struct xcpt_syscall_s
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there
|
|
||||||
* are pending signals to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -253,12 +253,6 @@ struct xcpt_syscall_s
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -223,12 +223,6 @@ struct xcpt_syscall_s
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there
|
|
||||||
* are pending signals to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -253,12 +253,6 @@ struct xcpt_syscall_s
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -158,12 +158,6 @@
|
|||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there
|
|
||||||
* are pending signals to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved register array pointer used during
|
/* These are saved register array pointer used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is
|
/* First, handle some special cases when the signal is
|
||||||
* being delivered to the currently executing task.
|
* being delivered to the currently executing task.
|
||||||
@@ -97,7 +97,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
/* In this case just deliver the signal now. */
|
/* In this case just deliver the signal now. */
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, we are (1) signaling a task is not running
|
/* Otherwise, we are (1) signaling a task is not running
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ void arm_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
/* Then make sure that interrupts are enabled. Signal handlers must always
|
/* Then make sure that interrupts are enabled. Signal handlers must always
|
||||||
@@ -72,7 +72,7 @@ void arm_sigdeliver(void)
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -92,7 +92,7 @@ void arm_sigdeliver(void)
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of execution. */
|
/* Then restore the correct state for this thread of execution. */
|
||||||
|
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (tcb->xcp.sigdeliver == NULL)
|
if (tcb->sigdeliver == NULL)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to the currently executing task.
|
* to the currently executing task.
|
||||||
@@ -103,7 +103,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ void arm_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
@@ -101,7 +101,7 @@ retry:
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -148,7 +148,7 @@ retry:
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of
|
/* Then restore the correct state for this thread of
|
||||||
* execution.
|
* execution.
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to task that is currently executing on this CPU.
|
* to task that is currently executing on this CPU.
|
||||||
@@ -101,7 +101,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ void arm_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
@@ -101,7 +101,7 @@ retry:
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -148,7 +148,7 @@ retry:
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of execution. */
|
/* Then restore the correct state for this thread of execution. */
|
||||||
|
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ uint32_t *arm_syscall(uint32_t *regs)
|
|||||||
|
|
||||||
/* Copy "info" into user stack */
|
/* Copy "info" into user stack */
|
||||||
|
|
||||||
if (rtcb->xcp.sigdeliver)
|
if (rtcb->sigdeliver)
|
||||||
{
|
{
|
||||||
usp = rtcb->xcp.saved_regs[REG_SP];
|
usp = rtcb->xcp.saved_regs[REG_SP];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,9 +86,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (tcb->xcp.sigdeliver == NULL)
|
if (tcb->sigdeliver == NULL)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to the currently executing task.
|
* to the currently executing task.
|
||||||
@@ -104,7 +104,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ void arm_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
@@ -105,7 +105,7 @@ retry:
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -156,7 +156,7 @@ retry:
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of
|
/* Then restore the correct state for this thread of
|
||||||
* execution.
|
* execution.
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to task that is currently executing on any CPU.
|
* to task that is currently executing on any CPU.
|
||||||
@@ -99,7 +99,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ void arm_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
@@ -101,7 +101,7 @@ retry:
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -145,7 +145,7 @@ retry:
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of execution. */
|
/* Then restore the correct state for this thread of execution. */
|
||||||
|
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ uint32_t *arm_syscall(uint32_t *regs)
|
|||||||
|
|
||||||
/* Copy "info" into user stack */
|
/* Copy "info" into user stack */
|
||||||
|
|
||||||
if (rtcb->xcp.sigdeliver)
|
if (rtcb->sigdeliver)
|
||||||
{
|
{
|
||||||
usp = rtcb->xcp.saved_regs[REG_SP];
|
usp = rtcb->xcp.saved_regs[REG_SP];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,9 +86,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (tcb->xcp.sigdeliver == NULL)
|
if (tcb->sigdeliver == NULL)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to the currently executing task.
|
* to the currently executing task.
|
||||||
@@ -104,7 +104,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ void arm_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
@@ -105,7 +105,7 @@ retry:
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -156,7 +156,7 @@ retry:
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of
|
/* Then restore the correct state for this thread of
|
||||||
* execution.
|
* execution.
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to task that is currently executing on any CPU.
|
* to task that is currently executing on any CPU.
|
||||||
@@ -99,7 +99,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ void arm_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
@@ -101,7 +101,7 @@ retry:
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -145,7 +145,7 @@ retry:
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of execution. */
|
/* Then restore the correct state for this thread of execution. */
|
||||||
|
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ uint32_t *arm_syscall(uint32_t *regs)
|
|||||||
|
|
||||||
/* Copy "info" into user stack */
|
/* Copy "info" into user stack */
|
||||||
|
|
||||||
if (rtcb->xcp.sigdeliver)
|
if (rtcb->sigdeliver)
|
||||||
{
|
{
|
||||||
usp = rtcb->xcp.saved_regs[REG_SP];
|
usp = rtcb->xcp.saved_regs[REG_SP];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is
|
/* First, handle some special cases when the signal is
|
||||||
* being delivered to the currently executing task.
|
* being delivered to the currently executing task.
|
||||||
@@ -97,7 +97,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
/* In this case just deliver the signal now. */
|
/* In this case just deliver the signal now. */
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, we are (1) signaling a task is not running
|
/* Otherwise, we are (1) signaling a task is not running
|
||||||
|
|||||||
@@ -243,12 +243,6 @@ extern "C"
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_KERNEL
|
#ifdef CONFIG_BUILD_KERNEL
|
||||||
/* This is the saved address to use when returning from a user-space
|
/* This is the saved address to use when returning from a user-space
|
||||||
* signal handler.
|
* signal handler.
|
||||||
|
|||||||
@@ -118,9 +118,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to task that is currently executing on any CPU.
|
* to task that is currently executing on any CPU.
|
||||||
@@ -133,7 +133,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ void arm64_sigdeliver(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
@@ -103,7 +103,7 @@ retry:
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -150,7 +150,7 @@ retry:
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
rtcb->xcp.regs = rtcb->xcp.saved_reg;
|
rtcb->xcp.regs = rtcb->xcp.saved_reg;
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of execution. */
|
/* Then restore the correct state for this thread of execution. */
|
||||||
|
|||||||
@@ -93,12 +93,6 @@
|
|||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of PC and SR used during signal processing.
|
/* These are saved copies of PC and SR used during signal processing.
|
||||||
*
|
*
|
||||||
* REVISIT: Because there is only one copy of these save areas,
|
* REVISIT: Because there is only one copy of these save areas,
|
||||||
|
|||||||
@@ -93,12 +93,6 @@
|
|||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-zero if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of PC and SR used during signal processing.
|
/* These are saved copies of PC and SR used during signal processing.
|
||||||
*
|
*
|
||||||
* REVISIT: Because there is only one copy of these save areas,
|
* REVISIT: Because there is only one copy of these save areas,
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is
|
/* First, handle some special cases when the signal is
|
||||||
* being delivered to the currently executing task.
|
* being delivered to the currently executing task.
|
||||||
@@ -104,7 +104,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
/* In this case just deliver the signal now. */
|
/* In this case just deliver the signal now. */
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CASE 2: We are in an interrupt handler AND the
|
/* CASE 2: We are in an interrupt handler AND the
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ void avr_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
/* Save the return state on the stack. */
|
/* Save the return state on the stack. */
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ void avr_sigdeliver(void)
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -96,13 +96,13 @@ void avr_sigdeliver(void)
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regs[REG_PC0] = rtcb->xcp.saved_pc0;
|
regs[REG_PC0] = rtcb->xcp.saved_pc0;
|
||||||
regs[REG_PC1] = rtcb->xcp.saved_pc1;
|
regs[REG_PC1] = rtcb->xcp.saved_pc1;
|
||||||
#if defined(REG_PC2)
|
#if defined(REG_PC2)
|
||||||
regs[REG_PC2] = rtcb->xcp.saved_pc2;
|
regs[REG_PC2] = rtcb->xcp.saved_pc2;
|
||||||
#endif
|
#endif
|
||||||
regs[REG_SREG] = rtcb->xcp.saved_sreg;
|
regs[REG_SREG] = rtcb->xcp.saved_sreg;
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of execution. This is an
|
/* 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
|
* unusual case that must be handled by up_fullcontextresore. This case is
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void up_initial_state(struct tcb_s *tcb)
|
|||||||
#else
|
#else
|
||||||
/* No pending signal delivery */
|
/* No pending signal delivery */
|
||||||
|
|
||||||
xcp->sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
|
|
||||||
/* Clear the frame pointer and link register since this is the outermost
|
/* Clear the frame pointer and link register since this is the outermost
|
||||||
* frame.
|
* frame.
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is
|
/* First, handle some special cases when the signal is
|
||||||
* being delivered to the currently executing task.
|
* being delivered to the currently executing task.
|
||||||
@@ -102,7 +102,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
/* In this case just deliver the signal now. */
|
/* In this case just deliver the signal now. */
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CASE 2: We are in an interrupt handler AND the
|
/* CASE 2: We are in an interrupt handler AND the
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ void avr_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
/* Save the return state on the stack. */
|
/* Save the return state on the stack. */
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ void avr_sigdeliver(void)
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -100,9 +100,9 @@ void avr_sigdeliver(void)
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regs[REG_PC] = rtcb->xcp.saved_pc;
|
regs[REG_PC] = rtcb->xcp.saved_pc;
|
||||||
regs[REG_SR] = rtcb->xcp.saved_sr;
|
regs[REG_SR] = rtcb->xcp.saved_sr;
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of execution. This is an
|
/* 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
|
* unusual case that must be handled by up_fullcontextresore. This case is
|
||||||
|
|||||||
@@ -127,12 +127,6 @@ struct xcpt_syscall_s
|
|||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
/* The following function pointer is non-zero if there
|
|
||||||
* are pending signals to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -130,12 +130,6 @@ struct xcpt_syscall_s
|
|||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_DISABLE_SIGNALS
|
#ifndef CONFIG_DISABLE_SIGNALS
|
||||||
/* The following function pointer is non-zero if there
|
|
||||||
* are pending signals to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of the context used during
|
/* These are saved copies of the context used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (tcb->xcp.sigdeliver == NULL)
|
if (tcb->sigdeliver == NULL)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to task that is currently executing on any CPU.
|
* to task that is currently executing on any CPU.
|
||||||
@@ -107,7 +107,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
/* In this case just deliver the signal now. */
|
/* In this case just deliver the signal now. */
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CASE 2: The task that needs to receive the signal is running.
|
/* CASE 2: The task that needs to receive the signal is running.
|
||||||
|
|||||||
@@ -62,16 +62,16 @@ void ceva_sigdeliver(void)
|
|||||||
int saved_errno = rtcb->pterrno;
|
int saved_errno = rtcb->pterrno;
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
/* Get a local copy of the sigdeliver function pointer. We do this so that
|
/* 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
|
* we can nullify the sigdeliver function pointer in the TCB and accept
|
||||||
* more signal deliveries while processing the current pending signals.
|
* more signal deliveries while processing the current pending signals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver = (sig_deliver_t)rtcb->xcp.sigdeliver;
|
sigdeliver = rtcb->sigdeliver;
|
||||||
rtcb->xcp.sigdeliver = NULL;
|
rtcb->sigdeliver = NULL;
|
||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
|
|||||||
@@ -321,12 +321,6 @@ struct xcpt_syscall_s
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-NULL if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These additional register save locations are used to implement the
|
/* These additional register save locations are used to implement the
|
||||||
* signal delivery trampoline.
|
* signal delivery trampoline.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is
|
/* First, handle some special cases when the signal is
|
||||||
* being delivered to the currently executing task.
|
* being delivered to the currently executing task.
|
||||||
@@ -105,7 +105,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
/* In this case just deliver the signal now. */
|
/* In this case just deliver the signal now. */
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CASE 2: We are in an interrupt handler AND the
|
/* CASE 2: We are in an interrupt handler AND the
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ void mips_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
/* Save the return state on the stack. */
|
/* Save the return state on the stack. */
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ void mips_sigdeliver(void)
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -100,9 +100,9 @@ void mips_sigdeliver(void)
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regs[REG_EPC] = rtcb->xcp.saved_epc;
|
regs[REG_EPC] = rtcb->xcp.saved_epc;
|
||||||
regs[REG_STATUS] = rtcb->xcp.saved_status;
|
regs[REG_STATUS] = rtcb->xcp.saved_status;
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of
|
/* Then restore the correct state for this thread of
|
||||||
* execution.
|
* execution.
|
||||||
|
|||||||
@@ -179,12 +179,6 @@
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-NULL if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These additional register save locations are used to implement the
|
/* These additional register save locations are used to implement the
|
||||||
* signal delivery trampoline.
|
* signal delivery trampoline.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -261,12 +261,6 @@ struct xcpt_syscall_s
|
|||||||
|
|
||||||
struct xcptcontext
|
struct xcptcontext
|
||||||
{
|
{
|
||||||
/* The following function pointer is non-NULL if there are pending signals
|
|
||||||
* to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These additional register save locations are used to implement the
|
/* These additional register save locations are used to implement the
|
||||||
* signal delivery trampoline.
|
* signal delivery trampoline.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is
|
/* First, handle some special cases when the signal is
|
||||||
* being delivered to the currently executing task.
|
* being delivered to the currently executing task.
|
||||||
@@ -102,7 +102,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
/* In this case just deliver the signal now. */
|
/* In this case just deliver the signal now. */
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CASE 2: We are in an interrupt handler AND the
|
/* CASE 2: We are in an interrupt handler AND the
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ void lm32_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
/* Save the return state on the stack. */
|
/* Save the return state on the stack. */
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ void lm32_sigdeliver(void)
|
|||||||
|
|
||||||
/* Deliver the signal */
|
/* Deliver the signal */
|
||||||
|
|
||||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
(rtcb->sigdeliver)(rtcb);
|
||||||
|
|
||||||
/* Output any debug messages BEFORE restoring errno (because they may
|
/* Output any debug messages BEFORE restoring errno (because they may
|
||||||
* alter errno), then disable interrupts again and restore the original
|
* alter errno), then disable interrupts again and restore the original
|
||||||
@@ -99,9 +99,9 @@ void lm32_sigdeliver(void)
|
|||||||
* could be modified by a hostile program.
|
* could be modified by a hostile program.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
regs[REG_EPC] = rtcb->xcp.saved_epc;
|
regs[REG_EPC] = rtcb->xcp.saved_epc;
|
||||||
regs[REG_INT_CTX] = rtcb->xcp.saved_int_ctx;
|
regs[REG_INT_CTX] = rtcb->xcp.saved_int_ctx;
|
||||||
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
|
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
|
||||||
|
|
||||||
/* Then restore the correct state for this thread of
|
/* Then restore the correct state for this thread of
|
||||||
* execution.
|
* execution.
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
|
|
||||||
/* Refuse to handle nested signal actions */
|
/* Refuse to handle nested signal actions */
|
||||||
|
|
||||||
if (!tcb->xcp.sigdeliver)
|
if (!tcb->sigdeliver)
|
||||||
{
|
{
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->sigdeliver = sigdeliver;
|
||||||
|
|
||||||
/* First, handle some special cases when the signal is being delivered
|
/* First, handle some special cases when the signal is being delivered
|
||||||
* to the currently executing task.
|
* to the currently executing task.
|
||||||
@@ -103,7 +103,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
|
|||||||
/* In this case just deliver the signal now. */
|
/* In this case just deliver the signal now. */
|
||||||
|
|
||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
tcb->xcp.sigdeliver = NULL;
|
tcb->sigdeliver = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CASE 2: We are in an interrupt handler AND the interrupted task
|
/* CASE 2: We are in an interrupt handler AND the interrupted task
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ void minerva_sigdeliver(void)
|
|||||||
board_autoled_on(LED_SIGNAL);
|
board_autoled_on(LED_SIGNAL);
|
||||||
|
|
||||||
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
|
||||||
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
|
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
|
||||||
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
|
DEBUGASSERT(rtcb->sigdeliver != NULL);
|
||||||
|
|
||||||
/* Save the real return state on the stack. */
|
/* Save the real return state on the stack. */
|
||||||
|
|
||||||
@@ -76,8 +76,8 @@ void minerva_sigdeliver(void)
|
|||||||
* more signal deliveries while processing the current pending signals.
|
* more signal deliveries while processing the current pending signals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sigdeliver = rtcb->xcp.sigdeliver;
|
sigdeliver = rtcb->sigdeliver;
|
||||||
rtcb->xcp.sigdeliver = NULL;
|
rtcb->sigdeliver = NULL;
|
||||||
|
|
||||||
# ifndef CONFIG_SUPPRESS_INTERRUPTS
|
# ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
/* Then make sure that interrupts are enabled. Signal handlers must always
|
/* Then make sure that interrupts are enabled. Signal handlers must always
|
||||||
|
|||||||
@@ -170,12 +170,6 @@ struct xcptcontext
|
|||||||
|
|
||||||
uint32_t regs[XCPTCONTEXT_REGS];
|
uint32_t regs[XCPTCONTEXT_REGS];
|
||||||
|
|
||||||
/* The following function pointer is non-zero if there
|
|
||||||
* are pending signals to be processed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
|
||||||
|
|
||||||
/* These are saved copies of LR and CPSR used during
|
/* These are saved copies of LR and CPSR used during
|
||||||
* signal processing.
|
* signal processing.
|
||||||
*
|
*
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user