signal: adjust the signal processing logic to remove the judgment

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-09-09 20:17:25 +08:00 committed by Xiang Xiao
parent 8275a846b1
commit 487fcb3bce
33 changed files with 1938 additions and 2220 deletions

View File

@ -75,28 +75,20 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(),
this_task()->xcp.regs);
if (tcb == this_task() && !up_interrupt_context())
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -140,5 +132,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_CPSR] |= PSR_T_BIT;
#endif
}
}
}

View File

@ -78,31 +78,22 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
DEBUGASSERT(tcb != NULL && sigdeliver != NULL);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(),
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
if (tcb == this_task() && !up_interrupt_context())
{
/* In this case just deliver the signal now.
* REVISIT: Signal handle will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -176,5 +167,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -77,30 +77,22 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on this CPU.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(),
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
if (tcb == this_task() && !up_interrupt_context())
{
/* In this case just deliver the signal now.
* REVISIT: Signal handler will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -170,5 +162,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -79,31 +79,22 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
DEBUGASSERT(tcb != NULL && sigdeliver != NULL);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(),
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
if (tcb == this_task() && !up_interrupt_context())
{
/* In this case just deliver the signal now.
* REVISIT: Signal handle will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -181,5 +172,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -75,30 +75,22 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on any CPU.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(),
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
if (tcb == this_task() && !up_interrupt_context())
{
/* In this case just deliver the signal now.
* REVISIT: Signal handler will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -160,5 +152,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -79,31 +79,22 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
DEBUGASSERT(tcb != NULL && sigdeliver != NULL);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(),
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
if (tcb == this_task() && !up_interrupt_context())
{
/* In this case just deliver the signal now.
* REVISIT: Signal handle will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -181,5 +172,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -75,30 +75,22 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on any CPU.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(),
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
if (tcb == this_task() && !up_interrupt_context())
{
/* In this case just deliver the signal now.
* REVISIT: Signal handler will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -160,5 +152,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -75,28 +75,20 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(),
this_task()->xcp.regs);
if (tcb == this_task() && !up_interrupt_context())
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -137,5 +129,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_CPSR] = PSR_MODE_SVC | PSR_I_BIT;
tcb->xcp.regs[REG_IRQ_EN] = 0;
}
}
}

View File

@ -112,18 +112,13 @@ void arm64_init_signal_process(struct tcb_s *tcb, struct regs_context *regs)
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on any CPU.
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
if (tcb == this_task() && !up_interrupt_context())
@ -132,7 +127,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* REVISIT: Signal handler will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -169,5 +164,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -75,24 +75,17 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
uintptr_t reg_ptr = (uintptr_t)avr_sigdeliver;
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -103,7 +96,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -190,5 +183,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif
tcb->xcp.regs[REG_SREG] &= ~(1 << SREG_I);
}
}
}

View File

@ -75,22 +75,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -101,7 +94,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -165,5 +158,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PC] = (uint32_t)avr_sigdeliver;
tcb->xcp.regs[REG_SR] |= AVR32_SR_GM_MASK;
}
}
}

View File

@ -72,23 +72,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
DEBUGASSERT(tcb != NULL && sigdeliver != NULL);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on any CPU.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb->task_state == TSTATE_TASK_RUNNING)
{
uint8_t me = this_cpu();
@ -106,7 +98,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -204,7 +196,6 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_OM] |= REG_OM_KERNEL;
#endif
}
}
}
#endif /* !CONFIG_DISABLE_SIGNALS */

View File

@ -76,24 +76,17 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
uint32_t status;
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -104,7 +97,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -185,5 +178,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_epc, tcb->xcp.saved_status,
tcb->xcp.regs[REG_EPC], tcb->xcp.regs[REG_STATUS]);
}
}
}

View File

@ -75,22 +75,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -101,7 +94,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -173,5 +166,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_epc, tcb->xcp.saved_status,
tcb->xcp.regs[REG_EPC], tcb->xcp.regs[REG_STATUS]);
}
}
}

View File

@ -76,22 +76,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and a task is
@ -102,7 +95,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -174,5 +167,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_epc, tcb->xcp.saved_status,
tcb->xcp.regs[REG_CSR_MEPC], tcb->xcp.regs[REG_CSR_MSTATUS]);
}
}
}

View File

@ -74,22 +74,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -100,7 +93,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -169,5 +162,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* tcb->xcp.regs[REG_CPSR] = SVC_MODE | PSR_I_BIT | PSR_F_BIT;
*/
}
}
}

View File

@ -74,22 +74,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -100,7 +93,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -162,5 +155,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PC + 1] = (uint32_t)renesas_sigdeliver;
tcb->xcp.regs[REG_FLG] &= ~M16C_FLG_I;
}
}
}

View File

@ -74,22 +74,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -100,7 +93,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -158,5 +151,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PC] = (uint32_t)renesas_sigdeliver;
tcb->xcp.regs[REG_PSW] |= 0x00030000;
}
}
}

View File

@ -74,22 +74,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -100,7 +93,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -158,5 +151,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PC] = (uint32_t)renesas_sigdeliver;
tcb->xcp.regs[REG_SR] |= 0x000000f0 ;
}
}
}

View File

@ -76,17 +76,12 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
uintptr_t int_ctx;
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on any CPU.
@ -98,7 +93,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* REVISIT: Signal handler will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -160,5 +155,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -71,27 +71,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
irqstate_t flags;
/* We don't have to anything complex for the simulated target */
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
sinfo("tcb=%p\n", tcb);
/* Make sure that interrupts are disabled */
flags = enter_critical_section();
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
if (tcb == this_task())
{
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
}
leave_critical_section(flags);
}

View File

@ -72,28 +72,15 @@
****************************************************************************/
#ifndef CONFIG_SMP
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
irqstate_t flags;
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Make sure that interrupts are disabled */
flags = enter_critical_section();
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -104,7 +91,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -172,37 +159,22 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_NPC] = (uint32_t)sparc_sigdeliver + 4;
tcb->xcp.regs[REG_PSR] |= SPARC_PSR_ET_MASK;
}
}
leave_critical_section(flags);
}
#endif /* !CONFIG_SMP */
#ifdef CONFIG_SMP
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
irqstate_t flags;
int cpu;
int me;
sinfo("tcb=0x%p sigdeliver=0x%p\n", tcb, sigdeliver);
/* Make sure that interrupts are disabled */
flags = enter_critical_section();
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on any CPU.
*/
sinfo("rtcb=0x%p current_regs=0x%p\n", this_task(), up_current_regs());
if (tcb->task_state == TSTATE_TASK_RUNNING)
{
me = this_cpu();
@ -218,7 +190,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* REVISIT: Signal handler will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -333,8 +305,5 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_NPC] = (uint32_t)sparc_sigdeliver + 4;
tcb->xcp.regs[REG_PSR] |= SPARC_PSR_ET_MASK;
}
}
leave_critical_section(flags);
}
#endif /* CONFIG_SMP */

View File

@ -76,14 +76,8 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
@ -98,7 +92,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -159,5 +153,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
STACK_ALIGN_DOWN(up_getusrsp(tcb->xcp.regs)),
PSW_IO_SUPERVISOR | PSW_CDE, true);
}
}
}

View File

@ -70,22 +70,15 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and a task is
@ -96,7 +89,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -160,5 +153,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EIP] = (uint32_t)x86_sigdeliver;
tcb->xcp.regs[REG_EFLAGS] = 0;
}
}
}

View File

@ -71,16 +71,10 @@
****************************************************************************/
#ifndef CONFIG_SMP
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
sinfo("rtcb=%p g_current_regs=%p\n", this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
@ -98,7 +92,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* now.
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -163,32 +157,22 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
*/
tcb->xcp.regs[REG_RIP] = (uint64_t)x86_64_sigdeliver;
tcb->xcp.regs[REG_RSP] = tcb->xcp.regs[REG_RSP] - 8;
tcb->xcp.regs[REG_RFLAGS] = 0;
}
}
}
#else /* !CONFIG_SMP */
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
int cpu;
int me;
sinfo("tcb=0x%p sigdeliver=0x%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on any CPU.
*/
sinfo("rtcb=0x%p current_regs=0x%p\n", this_task(),
up_current_regs());
if (tcb->task_state == TSTATE_TASK_RUNNING)
{
me = this_cpu();
@ -204,7 +188,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* REVISIT: Signal handler will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -264,10 +248,8 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled
*/
up_current_regs()[REG_RIP] =
(uint64_t)x86_64_sigdeliver;
up_current_regs()[REG_RSP] =
up_current_regs()[REG_RSP] - 8;
up_current_regs()[REG_RIP] = (uint64_t)x86_64_sigdeliver;
up_current_regs()[REG_RSP] = up_current_regs()[REG_RSP] - 8;
up_current_regs()[REG_RFLAGS] = 0;
/* And make sure that the saved context in the TCB
@ -317,6 +299,5 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_RSP] = tcb->xcp.regs[REG_RSP] - 8;
tcb->xcp.regs[REG_RFLAGS] = 0;
}
}
}
#endif /* CONFIG_SMP */

View File

@ -78,15 +78,10 @@
*
****************************************************************************/
void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
this_task()->xcp.regs);
/* First, handle some special cases when the signal is being delivered
* to task that is currently executing on any CPU.
@ -98,7 +93,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* REVISIT: Signal handler will run in a critical section!
*/
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
else
@ -167,5 +162,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
}
#endif
}
}
}

View File

@ -74,22 +74,15 @@
*
****************************************************************************/
void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=0x%06x\n", tcb, (uint32_t)sigdeliver);
/* Refuse to handle nested signal actions */
if (!tcb->sigdeliver)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is
* being delivered to the currently executing task.
*/
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task())
{
/* CASE 1: We are not in an interrupt handler and
@ -100,7 +93,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -162,5 +155,4 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
*saved_pc = (uint32_t)z16_sigdeliver;
tcb->xcp.regs[REG_FLAGS] = 0;
}
}
}

View File

@ -43,8 +43,7 @@
* Name: ez80_sigsetup
****************************************************************************/
static void ez80_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
FAR chipreg_t *regs)
static void ez80_sigsetup(FAR struct tcb_s *tcb, FAR chipreg_t *regs)
{
/* Save the return address and interrupt state. These will be restored by
* the signal trampoline after the signals have been delivered.
@ -99,15 +98,10 @@ static void ez80_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
*
****************************************************************************/
void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=0x%06" PRIx32 "\n", tcb, (uint32_t)sigdeliver);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
@ -123,7 +117,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -139,7 +133,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled.
*/
ez80_sigsetup(tcb, sigdeliver, (chipreg_t *)IRQ_STATE());
ez80_sigsetup(tcb, (chipreg_t *)IRQ_STATE());
/* And make sure that the saved context in the TCB
* is the same as the interrupt return context.
@ -158,7 +152,6 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* Set up to vector to the trampoline with interrupts disabled. */
ez80_sigsetup(tcb, sigdeliver, tcb->xcp.regs);
}
ez80_sigsetup(tcb, tcb->xcp.regs);
}
}

View File

@ -46,8 +46,7 @@
* Name: z180_sigsetup
****************************************************************************/
static void z180_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
FAR chipreg_t *regs)
static void z180_sigsetup(FAR struct tcb_s *tcb, FAR chipreg_t *regs)
{
/* Save the return address and interrupt state. These will be restored by
* the signal trampoline after the signals have been delivered.
@ -102,15 +101,10 @@ static void z180_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
*
****************************************************************************/
void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
_info("tcb=%p sigdeliver=0x%04x\n", tcb, (uint16_t)sigdeliver);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
@ -126,7 +120,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -142,7 +136,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled.
*/
z180_sigsetup(tcb, sigdeliver, IRQ_STATE());
z180_sigsetup(tcb, IRQ_STATE());
/* And make sure that the saved context in the TCB
* is the same as the interrupt return context.
@ -162,7 +156,6 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* Set up to vector to the trampoline with interrupts disabled. */
z180_sigsetup(tcb, sigdeliver, tcb->xcp.regs);
}
z180_sigsetup(tcb, tcb->xcp.regs);
}
}

View File

@ -43,8 +43,7 @@
* Name: z8_sigsetup
****************************************************************************/
static void z8_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
FAR chipreg_t *regs)
static void z8_sigsetup(FAR struct tcb_s *tcb, FAR chipreg_t *regs)
{
/* Save the return address and interrupt state. These will be restored by
* the signal trampoline after the signals have been delivered.
@ -99,15 +98,10 @@ static void z8_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
*
****************************************************************************/
void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
sinfo("tcb=%p sigdeliver=0x%04x\n", tcb, (uint16_t)sigdeliver);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
@ -123,7 +117,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -139,7 +133,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled.
*/
z8_sigsetup(tcb, sigdeliver, IRQ_STATE());
z8_sigsetup(tcb, IRQ_STATE());
/* And make sure that the saved context in the TCB
* is the same as the interrupt return context.
@ -161,7 +155,6 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled.
*/
z8_sigsetup(tcb, sigdeliver, tcb->xcp.regs);
}
z8_sigsetup(tcb, tcb->xcp.regs);
}
}

View File

@ -44,8 +44,7 @@
* Name: z80_sigsetup
****************************************************************************/
static void z80_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
FAR chipreg_t *regs)
static void z80_sigsetup(FAR struct tcb_s *tcb, FAR chipreg_t *regs)
{
/* Save the return address and interrupt state. These will be restored by
* the signal trampoline after the signals have been delivered.
@ -100,15 +99,10 @@ static void z80_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver,
*
****************************************************************************/
void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(FAR struct tcb_s *tcb)
{
_info("tcb=%p sigdeliver=0x%04x\n", tcb, (uint16_t)sigdeliver);
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
tcb->sigdeliver = sigdeliver;
sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
@ -124,7 +118,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* In this case just deliver the signal now. */
sigdeliver(tcb);
(tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL;
}
@ -140,7 +134,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled.
*/
z80_sigsetup(tcb, sigdeliver, IRQ_STATE());
z80_sigsetup(tcb, IRQ_STATE());
/* And make sure that the saved context in the TCB
* is the same as the interrupt return context.
@ -160,7 +154,6 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
{
/* Set up to vector to the trampoline with interrupts disabled. */
z80_sigsetup(tcb, sigdeliver, tcb->xcp.regs);
}
z80_sigsetup(tcb, tcb->xcp.regs);
}
}

View File

@ -541,7 +541,7 @@ int up_backtrace(FAR struct tcb_s *tcb,
*
****************************************************************************/
void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver);
void up_schedule_sigaction(FAR struct tcb_s *tcb);
/****************************************************************************
* Name: up_task_start

View File

@ -115,7 +115,12 @@ static int nxsig_queue_action(FAR struct tcb_s *stcb, siginfo_t *info)
* up_schedule_sigaction()
*/
up_schedule_sigaction(stcb, nxsig_deliver);
if (!stcb->sigdeliver)
{
stcb->sigdeliver = nxsig_deliver;
up_schedule_sigaction(stcb);
}
leave_critical_section(flags);
}
}