mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
sim: fix signal deliver calling error on sim platform
since the signal deliver handler should be called in signal owner task. Change-Id: Ic55c08d1a880069864eddda8dab945ce677792d7
This commit is contained in:
@@ -127,18 +127,6 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
||||
rtcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(rtcb);
|
||||
@@ -147,5 +135,20 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state)
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,18 +80,6 @@ void up_exit(int status)
|
||||
tcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", tcb);
|
||||
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded, interrupt
|
||||
* driven environment.
|
||||
*/
|
||||
|
||||
if (tcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", tcb);
|
||||
((sig_deliver_t)tcb->xcp.sigdeliver)(tcb);
|
||||
tcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_longjmp(tcb->xcp.regs, 1);
|
||||
|
||||
@@ -96,18 +96,6 @@ void up_release_pending(void)
|
||||
rtcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(rtcb);
|
||||
@@ -116,5 +104,20 @@ void up_release_pending(void)
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,18 +151,6 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
||||
rtcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(rtcb);
|
||||
@@ -171,6 +159,21 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority)
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,18 +139,6 @@ int up_cpu_paused(int cpu)
|
||||
|
||||
rtcb = current_task(cpu);
|
||||
|
||||
/* The way that we handle signals in the simulation is kind of a
|
||||
* kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("CPU%d: Delivering signals TCB=%p\n", cpu, rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION
|
||||
/* Notify that we have resumed */
|
||||
|
||||
@@ -165,6 +153,21 @@ int up_cpu_paused(int cpu)
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("CPU%d: Delivering signals TCB=%p\n", this_cpu(), rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -111,18 +111,6 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
||||
rtcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
nxsched_resume_scheduler(rtcb);
|
||||
@@ -131,5 +119,20 @@ void up_unblock_task(FAR struct tcb_s *tcb)
|
||||
|
||||
up_longjmp(rtcb->xcp.regs, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The way that we handle signals in the simulation is kind of
|
||||
* a kludge. This would be unsafe in a truly multi-threaded,
|
||||
* interrupt driven environment.
|
||||
*/
|
||||
|
||||
rtcb = this_task();
|
||||
if (rtcb->xcp.sigdeliver)
|
||||
{
|
||||
sinfo("Delivering signals TCB=%p\n", rtcb);
|
||||
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
|
||||
rtcb->xcp.sigdeliver = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user