arch: move sigdeliver to common code

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2024-09-11 17:42:46 +08:00
committed by Xiang Xiao
parent a569eef6ba
commit 7eea4223ee
98 changed files with 259 additions and 441 deletions

View File

@@ -151,12 +151,6 @@
#ifndef __ASSEMBLY__
struct xcptcontext
{
/* The following function pointer is non-zero if there are pending signals
* to be processed.
*/
void *sigdeliver; /* Actual type is sig_deliver_t */
/* These are saved copies of instruction pointer and EFLAGS used during
* signal processing.
*

View File

@@ -76,9 +76,9 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
/* Refuse to handle nested signal actions */
if (!tcb->xcp.sigdeliver)
if (!tcb->sigdeliver)
{
tcb->xcp.sigdeliver = sigdeliver;
tcb->sigdeliver = sigdeliver;
/* First, handle some special cases when the signal is being delivered
* to the currently executing task.
@@ -97,7 +97,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
/* In this case just deliver the signal now. */
sigdeliver(tcb);
tcb->xcp.sigdeliver = NULL;
tcb->sigdeliver = NULL;
}
/* CASE 2: We are in an interrupt handler AND the interrupted task

View File

@@ -59,8 +59,8 @@ void x86_sigdeliver(void)
board_autoled_on(LED_SIGNAL);
sinfo("rtcb=%p sigdeliver=%p sigpendactionq.head=%p\n",
rtcb, rtcb->xcp.sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->xcp.sigdeliver != NULL);
rtcb, rtcb->sigdeliver, rtcb->sigpendactionq.head);
DEBUGASSERT(rtcb->sigdeliver != NULL);
/* Save the return state on the stack. */
@@ -76,7 +76,7 @@ void x86_sigdeliver(void)
/* Deliver the signals */
((sig_deliver_t)rtcb->xcp.sigdeliver)(rtcb);
(rtcb->sigdeliver)(rtcb);
/* Output any debug messages BEFORE restoring errno (because they may
* alter errno), then disable interrupts again and restore the original
@@ -96,9 +96,9 @@ void x86_sigdeliver(void)
* could be modified by a hostile program.
*/
regs[REG_EIP] = rtcb->xcp.saved_eip;
regs[REG_EFLAGS] = rtcb->xcp.saved_eflags;
rtcb->xcp.sigdeliver = NULL; /* Allows next handler to be scheduled */
regs[REG_EIP] = rtcb->xcp.saved_eip;
regs[REG_EFLAGS] = rtcb->xcp.saved_eflags;
rtcb->sigdeliver = NULL; /* Allows next handler to be scheduled */
/* Then restore the correct state for this thread of execution. */