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 7eea4223ee
commit f132ed2edb
33 changed files with 1938 additions and 2220 deletions
+4 -13
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); 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 /* First, handle some special cases when the signal is
* being delivered to the currently executing task. * 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()) if (tcb == this_task() && !up_interrupt_context())
{ {
/* In this case just deliver the signal now. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -141,4 +133,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+7 -17
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
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(),
this_task()->xcp.regs); 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()) if (tcb == this_task() && !up_interrupt_context())
{ {
/* In this case just deliver the signal now. /* In this case just deliver the signal now.
* REVISIT: Signal handle will run in a critical section! * REVISIT: Signal handle will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -177,4 +168,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+7 -16
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
/* 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(),
this_task()->xcp.regs); 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()) if (tcb == this_task() && !up_interrupt_context())
{ {
/* In this case just deliver the signal now. /* In this case just deliver the signal now.
* REVISIT: Signal handler will run in a critical section! * REVISIT: Signal handler will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -171,4 +163,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+7 -17
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
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(),
this_task()->xcp.regs); 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()) if (tcb == this_task() && !up_interrupt_context())
{ {
/* In this case just deliver the signal now. /* In this case just deliver the signal now.
* REVISIT: Signal handle will run in a critical section! * REVISIT: Signal handle will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -182,4 +173,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+7 -16
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
/* 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(),
this_task()->xcp.regs); 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()) if (tcb == this_task() && !up_interrupt_context())
{ {
/* In this case just deliver the signal now. /* In this case just deliver the signal now.
* REVISIT: Signal handler will run in a critical section! * REVISIT: Signal handler will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -161,4 +153,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+7 -17
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
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(),
this_task()->xcp.regs); 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()) if (tcb == this_task() && !up_interrupt_context())
{ {
/* In this case just deliver the signal now. /* In this case just deliver the signal now.
* REVISIT: Signal handle will run in a critical section! * REVISIT: Signal handle will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -182,4 +173,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+7 -16
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb, this_task(),
/* 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(),
this_task()->xcp.regs); 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()) if (tcb == this_task() && !up_interrupt_context())
{ {
/* In this case just deliver the signal now. /* In this case just deliver the signal now.
* REVISIT: Signal handler will run in a critical section! * REVISIT: Signal handler will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -161,4 +153,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
@@ -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); 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 /* First, handle some special cases when the signal is
* being delivered to the currently executing task. * 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()) if (tcb == this_task() && !up_interrupt_context())
{ {
/* In this case just deliver the signal now. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -138,4 +130,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_IRQ_EN] = 0; tcb->xcp.regs[REG_IRQ_EN] = 0;
} }
} }
}
@@ -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 */ /* First, handle some special cases when the signal is
* being delivered to the currently executing task.
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.
*/ */
if (tcb == this_task() && !up_interrupt_context()) 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! * REVISIT: Signal handler will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -170,4 +165,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+4 -12
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; uintptr_t reg_ptr = (uintptr_t)avr_sigdeliver;
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -191,4 +184,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_SREG] &= ~(1 << SREG_I); tcb->xcp.regs[REG_SREG] &= ~(1 << SREG_I);
} }
} }
}
+4 -12
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -166,4 +159,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_SR] |= AVR32_SR_GM_MASK; tcb->xcp.regs[REG_SR] |= AVR32_SR_GM_MASK;
} }
} }
}
+4 -13
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
DEBUGASSERT(tcb != NULL && sigdeliver != NULL); this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb->task_state == TSTATE_TASK_RUNNING) if (tcb->task_state == TSTATE_TASK_RUNNING)
{ {
uint8_t me = this_cpu(); 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -205,6 +197,5 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
#endif /* !CONFIG_DISABLE_SIGNALS */ #endif /* !CONFIG_DISABLE_SIGNALS */
+4 -12
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; uint32_t status;
sinfo("tcb=%p sigdeliver=%p\n", tcb, sigdeliver); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -186,4 +179,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EPC], tcb->xcp.regs[REG_STATUS]); tcb->xcp.regs[REG_EPC], tcb->xcp.regs[REG_STATUS]);
} }
} }
}
+4 -12
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -174,4 +167,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EPC], tcb->xcp.regs[REG_STATUS]); tcb->xcp.regs[REG_EPC], tcb->xcp.regs[REG_STATUS]);
} }
} }
}
@@ -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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and a task is /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -175,4 +168,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_CSR_MEPC], tcb->xcp.regs[REG_CSR_MSTATUS]); tcb->xcp.regs[REG_CSR_MEPC], tcb->xcp.regs[REG_CSR_MSTATUS]);
} }
} }
}
+4 -12
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -170,4 +163,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
*/ */
} }
} }
}
+4 -12
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -163,4 +156,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_FLG] &= ~M16C_FLG_I; tcb->xcp.regs[REG_FLG] &= ~M16C_FLG_I;
} }
} }
}
@@ -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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -159,4 +152,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PSW] |= 0x00030000; tcb->xcp.regs[REG_PSW] |= 0x00030000;
} }
} }
}
+4 -12
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -159,4 +152,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_SR] |= 0x000000f0 ; tcb->xcp.regs[REG_SR] |= 0x000000f0 ;
} }
} }
}
@@ -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; uintptr_t int_ctx;
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 /* 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.
@@ -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! * REVISIT: Signal handler will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -161,4 +156,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+3 -15
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 */ /* 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()) if (tcb == this_task())
{ {
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
} }
leave_critical_section(flags);
}
@@ -72,28 +72,15 @@
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SMP #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, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
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;
/* 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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -173,36 +160,21 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PSR] |= SPARC_PSR_ET_MASK; tcb->xcp.regs[REG_PSR] |= SPARC_PSR_ET_MASK;
} }
} }
leave_critical_section(flags);
}
#endif /* !CONFIG_SMP */ #endif /* !CONFIG_SMP */
#ifdef 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 cpu;
int me; int me;
sinfo("tcb=0x%p sigdeliver=0x%p\n", tcb, sigdeliver); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Make sure that interrupts are disabled */
flags = enter_critical_section();
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=0x%p current_regs=0x%p\n", this_task(), up_current_regs());
if (tcb->task_state == TSTATE_TASK_RUNNING) if (tcb->task_state == TSTATE_TASK_RUNNING)
{ {
me = this_cpu(); 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! * REVISIT: Signal handler will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -334,7 +306,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PSR] |= SPARC_PSR_ET_MASK; tcb->xcp.regs[REG_PSR] |= SPARC_PSR_ET_MASK;
} }
} }
leave_critical_section(flags);
}
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
@@ -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 /* First, handle some special cases when the signal is
* being delivered to the currently executing task. * 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -160,4 +154,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
PSW_IO_SUPERVISOR | PSW_CDE, true); PSW_IO_SUPERVISOR | PSW_CDE, true);
} }
} }
}
+4 -12
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and a task is /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -161,4 +154,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_EFLAGS] = 0; tcb->xcp.regs[REG_EFLAGS] = 0;
} }
} }
}
@@ -71,16 +71,10 @@
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SMP #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("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
sinfo("rtcb=%p g_current_regs=%p\n", this_task(), up_current_regs()); this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
@@ -98,7 +92,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* now. * now.
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; 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_RIP] = (uint64_t)x86_64_sigdeliver;
tcb->xcp.regs[REG_RSP] = tcb->xcp.regs[REG_RSP] - 8;
tcb->xcp.regs[REG_RFLAGS] = 0; tcb->xcp.regs[REG_RFLAGS] = 0;
} }
} }
}
#else /* !CONFIG_SMP */ #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 cpu;
int me; int me;
sinfo("tcb=0x%p sigdeliver=0x%p\n", tcb, sigdeliver); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
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.
*/ */
sinfo("rtcb=0x%p current_regs=0x%p\n", this_task(),
up_current_regs());
if (tcb->task_state == TSTATE_TASK_RUNNING) if (tcb->task_state == TSTATE_TASK_RUNNING)
{ {
me = this_cpu(); 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! * REVISIT: Signal handler will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -264,10 +248,8 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled * disabled
*/ */
up_current_regs()[REG_RIP] = up_current_regs()[REG_RIP] = (uint64_t)x86_64_sigdeliver;
(uint64_t)x86_64_sigdeliver; up_current_regs()[REG_RSP] = up_current_regs()[REG_RSP] - 8;
up_current_regs()[REG_RSP] =
up_current_regs()[REG_RSP] - 8;
up_current_regs()[REG_RFLAGS] = 0; up_current_regs()[REG_RFLAGS] = 0;
/* And make sure that the saved context in the TCB /* And make sure that the saved context in the TCB
@@ -318,5 +300,4 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_RFLAGS] = 0; tcb->xcp.regs[REG_RFLAGS] = 0;
} }
} }
}
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
+4 -10
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); 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 /* 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.
@@ -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! * REVISIT: Signal handler will run in a critical section!
*/ */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
else else
@@ -168,4 +163,3 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
#endif #endif
} }
} }
}
+4 -12
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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (!tcb->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.
*/ */
sinfo("rtcb=%p current_regs=%p\n", this_task(), up_current_regs());
if (tcb == this_task()) if (tcb == this_task())
{ {
/* CASE 1: We are not in an interrupt handler and /* 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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -163,4 +156,3 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_FLAGS] = 0; tcb->xcp.regs[REG_FLAGS] = 0;
} }
} }
}
+7 -14
View File
@@ -43,8 +43,7 @@
* Name: ez80_sigsetup * Name: ez80_sigsetup
****************************************************************************/ ****************************************************************************/
static void ez80_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver, static void ez80_sigsetup(FAR struct tcb_s *tcb, FAR chipreg_t *regs)
FAR chipreg_t *regs)
{ {
/* Save the return address and interrupt state. These will be restored by /* Save the return address and interrupt state. These will be restored by
* the signal trampoline after the signals have been delivered. * 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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
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.
@@ -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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -139,7 +133,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled. * 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 /* And make sure that the saved context in the TCB
* is the same as the interrupt return context. * 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. */ /* Set up to vector to the trampoline with interrupts disabled. */
ez80_sigsetup(tcb, sigdeliver, tcb->xcp.regs); ez80_sigsetup(tcb, tcb->xcp.regs);
}
} }
} }
+7 -14
View File
@@ -46,8 +46,7 @@
* Name: z180_sigsetup * Name: z180_sigsetup
****************************************************************************/ ****************************************************************************/
static void z180_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver, static void z180_sigsetup(FAR struct tcb_s *tcb, FAR chipreg_t *regs)
FAR chipreg_t *regs)
{ {
/* Save the return address and interrupt state. These will be restored by /* Save the return address and interrupt state. These will be restored by
* the signal trampoline after the signals have been delivered. * 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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
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.
@@ -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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -142,7 +136,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled. * disabled.
*/ */
z180_sigsetup(tcb, sigdeliver, IRQ_STATE()); z180_sigsetup(tcb, IRQ_STATE());
/* And make sure that the saved context in the TCB /* And make sure that the saved context in the TCB
* is the same as the interrupt return context. * 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. */ /* Set up to vector to the trampoline with interrupts disabled. */
z180_sigsetup(tcb, sigdeliver, tcb->xcp.regs); z180_sigsetup(tcb, tcb->xcp.regs);
}
} }
} }
+7 -14
View File
@@ -43,8 +43,7 @@
* Name: z8_sigsetup * Name: z8_sigsetup
****************************************************************************/ ****************************************************************************/
static void z8_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver, static void z8_sigsetup(FAR struct tcb_s *tcb, FAR chipreg_t *regs)
FAR chipreg_t *regs)
{ {
/* Save the return address and interrupt state. These will be restored by /* Save the return address and interrupt state. These will be restored by
* the signal trampoline after the signals have been delivered. * 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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
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.
@@ -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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -139,7 +133,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled. * disabled.
*/ */
z8_sigsetup(tcb, sigdeliver, IRQ_STATE()); z8_sigsetup(tcb, IRQ_STATE());
/* And make sure that the saved context in the TCB /* And make sure that the saved context in the TCB
* is the same as the interrupt return context. * 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. * disabled.
*/ */
z8_sigsetup(tcb, sigdeliver, tcb->xcp.regs); z8_sigsetup(tcb, tcb->xcp.regs);
}
} }
} }
+7 -14
View File
@@ -44,8 +44,7 @@
* Name: z80_sigsetup * Name: z80_sigsetup
****************************************************************************/ ****************************************************************************/
static void z80_sigsetup(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver, static void z80_sigsetup(FAR struct tcb_s *tcb, FAR chipreg_t *regs)
FAR chipreg_t *regs)
{ {
/* Save the return address and interrupt state. These will be restored by /* Save the return address and interrupt state. These will be restored by
* the signal trampoline after the signals have been delivered. * 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); sinfo("tcb=%p, rtcb=%p current_regs=%p\n", tcb,
this_task(), up_current_regs());
/* Refuse to handle nested signal actions */
if (tcb->sigdeliver == NULL)
{
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.
@@ -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. */ /* In this case just deliver the signal now. */
sigdeliver(tcb); (tcb->sigdeliver)(tcb);
tcb->sigdeliver = NULL; tcb->sigdeliver = NULL;
} }
@@ -140,7 +134,7 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled. * disabled.
*/ */
z80_sigsetup(tcb, sigdeliver, IRQ_STATE()); z80_sigsetup(tcb, IRQ_STATE());
/* And make sure that the saved context in the TCB /* And make sure that the saved context in the TCB
* is the same as the interrupt return context. * 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. */ /* Set up to vector to the trampoline with interrupts disabled. */
z80_sigsetup(tcb, sigdeliver, tcb->xcp.regs); z80_sigsetup(tcb, tcb->xcp.regs);
}
} }
} }
+1 -1
View File
@@ -545,7 +545,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 * Name: up_task_start
+6 -1
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()
*/ */
up_schedule_sigaction(stcb, nxsig_deliver); if (!stcb->sigdeliver)
{
stcb->sigdeliver = nxsig_deliver;
up_schedule_sigaction(stcb);
}
leave_critical_section(flags); leave_critical_section(flags);
} }
} }