* Send an interrupt to process. * * Stack is set up to allow sigcode stored * in u. to call routine, followed by kcall * to sigreturn routine below. After sigreturn * resets the signal mask, the stack, and the * frame pointer, it returns to the user * specified pc, psl. */
| 499 | * specified pc, psl. |
| 500 | */ |
| 501 | static void |
| 502 | linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) |
| 503 | { |
| 504 | struct thread *td = curthread; |
| 505 | struct proc *p = td->td_proc; |
| 506 | struct sigacts *psp; |
| 507 | struct trapframe *regs; |
| 508 | struct l_sigframe *fp, frame; |
| 509 | l_sigset_t lmask; |
| 510 | int sig, code; |
| 511 | int oonstack; |
| 512 | |
| 513 | PROC_LOCK_ASSERT(p, MA_OWNED); |
| 514 | psp = p->p_sigacts; |
| 515 | sig = ksi->ksi_signo; |
| 516 | code = ksi->ksi_code; |
| 517 | mtx_assert(&psp->ps_mtx, MA_OWNED); |
| 518 | if (SIGISMEMBER(psp->ps_siginfo, sig)) { |
| 519 | /* Signal handler installed with SA_SIGINFO. */ |
| 520 | linux_rt_sendsig(catcher, ksi, mask); |
| 521 | return; |
| 522 | } |
| 523 | regs = td->td_frame; |
| 524 | oonstack = sigonstack(regs->tf_esp); |
| 525 | |
| 526 | /* Allocate space for the signal handler context. */ |
| 527 | if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && |
| 528 | SIGISMEMBER(psp->ps_sigonstack, sig)) { |
| 529 | fp = (struct l_sigframe *)((uintptr_t)td->td_sigstk.ss_sp + |
| 530 | td->td_sigstk.ss_size - sizeof(struct l_sigframe)); |
| 531 | } else |
| 532 | fp = (struct l_sigframe *)regs->tf_esp - 1; |
| 533 | mtx_unlock(&psp->ps_mtx); |
| 534 | PROC_UNLOCK(p); |
| 535 | |
| 536 | /* Build the argument list for the signal handler. */ |
| 537 | sig = bsd_to_linux_signal(sig); |
| 538 | |
| 539 | bzero(&frame, sizeof(frame)); |
| 540 | |
| 541 | frame.sf_handler = catcher; |
| 542 | frame.sf_sig = sig; |
| 543 | |
| 544 | bsd_to_linux_sigset(mask, &lmask); |
| 545 | |
| 546 | /* Build the signal context to be used by sigreturn. */ |
| 547 | frame.sf_sc.sc_mask = lmask.__mask; |
| 548 | frame.sf_sc.sc_gs = rgs(); |
| 549 | frame.sf_sc.sc_fs = regs->tf_fs; |
| 550 | frame.sf_sc.sc_es = regs->tf_es; |
| 551 | frame.sf_sc.sc_ds = regs->tf_ds; |
| 552 | frame.sf_sc.sc_edi = regs->tf_edi; |
| 553 | frame.sf_sc.sc_esi = regs->tf_esi; |
| 554 | frame.sf_sc.sc_ebp = regs->tf_ebp; |
| 555 | frame.sf_sc.sc_ebx = regs->tf_ebx; |
| 556 | frame.sf_sc.sc_esp = regs->tf_esp; |
| 557 | frame.sf_sc.sc_edx = regs->tf_edx; |
| 558 | frame.sf_sc.sc_ecx = regs->tf_ecx; |
nothing calls this directly
no test coverage detected