- Change trapsignal() to accept a thread and not a proc.
- Change all consumers to pass in a thread. Right now this does not cause any functional changes but it will be important later when signals can be delivered to specific threads.
This commit is contained in:
parent
772e5d8d88
commit
1bf4700bff
@ -584,7 +584,7 @@ trap(a0, a1, a2, entry, framep)
|
||||
framep->tf_regs[FRAME_TRAPARG_A0] = a0;
|
||||
framep->tf_regs[FRAME_TRAPARG_A1] = a1;
|
||||
framep->tf_regs[FRAME_TRAPARG_A2] = a2;
|
||||
trapsignal(p, i, ucode);
|
||||
trapsignal(td, i, ucode);
|
||||
out:
|
||||
if (user) {
|
||||
framep->tf_regs[FRAME_SP] = alpha_pal_rdusp();
|
||||
|
@ -680,7 +680,7 @@ osigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -721,7 +721,7 @@ osigreturn(td, uap)
|
||||
* other selectors, invalid %eip's and invalid %esp's.
|
||||
*/
|
||||
if (!CS_SECURE(scp->sc_cs)) {
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
regs->tf_ds = scp->sc_ds;
|
||||
@ -798,7 +798,7 @@ freebsd4_sigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -844,7 +844,7 @@ freebsd4_sigreturn(td, uap)
|
||||
cs = ucp->uc_mcontext.mc_cs;
|
||||
if (!CS_SECURE(cs)) {
|
||||
printf("freebsd4_sigreturn: cs = 0x%x\n", cs);
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
@ -905,7 +905,7 @@ sigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -951,7 +951,7 @@ sigreturn(td, uap)
|
||||
cs = ucp->uc_mcontext.mc_cs;
|
||||
if (!CS_SECURE(cs)) {
|
||||
printf("sigreturn: cs = 0x%x\n", cs);
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
@ -680,7 +680,7 @@ osigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -721,7 +721,7 @@ osigreturn(td, uap)
|
||||
* other selectors, invalid %eip's and invalid %esp's.
|
||||
*/
|
||||
if (!CS_SECURE(scp->sc_cs)) {
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
regs->tf_ds = scp->sc_ds;
|
||||
@ -798,7 +798,7 @@ freebsd4_sigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -844,7 +844,7 @@ freebsd4_sigreturn(td, uap)
|
||||
cs = ucp->uc_mcontext.mc_cs;
|
||||
if (!CS_SECURE(cs)) {
|
||||
printf("freebsd4_sigreturn: cs = 0x%x\n", cs);
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
@ -905,7 +905,7 @@ sigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -951,7 +951,7 @@ sigreturn(td, uap)
|
||||
cs = ucp->uc_mcontext.mc_cs;
|
||||
if (!CS_SECURE(cs)) {
|
||||
printf("sigreturn: cs = 0x%x\n", cs);
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
@ -554,7 +554,7 @@ linux_sigreturn(struct thread *td, struct linux_sigreturn_args *args)
|
||||
*/
|
||||
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
|
||||
if (!CS_SECURE(frame.sf_sc.sc_cs)) {
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
@ -652,7 +652,7 @@ linux_rt_sigreturn(struct thread *td, struct linux_rt_sigreturn_args *args)
|
||||
*/
|
||||
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
|
||||
if (!CS_SECURE(context->sc_cs)) {
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
|
@ -740,7 +740,7 @@ trap(int vector, int imm, struct trapframe *framep)
|
||||
#ifdef DEBUG
|
||||
printtrap(vector, imm, framep, 1, user);
|
||||
#endif
|
||||
trapsignal(p, i, ucode);
|
||||
trapsignal(td, i, ucode);
|
||||
out:
|
||||
if (user) {
|
||||
userret(td, framep, sticks);
|
||||
@ -1048,7 +1048,7 @@ ia32_syscall(struct trapframe *framep)
|
||||
*/
|
||||
if ((orig_eflags & PSL_T) && !(orig_eflags & PSL_VM)) {
|
||||
ia64_set_eflag(ia64_get_eflag() & ~PSL_T);
|
||||
trapsignal(p, SIGTRAP, 0);
|
||||
trapsignal(td, SIGTRAP, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1256,19 +1256,19 @@ pgsignal(pgrp, sig, checkctty)
|
||||
}
|
||||
|
||||
/*
|
||||
* Send a signal caused by a trap to the current process.
|
||||
* Send a signal caused by a trap to the current thread.
|
||||
* If it will be caught immediately, deliver it with correct code.
|
||||
* Otherwise, post it normally.
|
||||
*
|
||||
* MPSAFE
|
||||
*/
|
||||
void
|
||||
trapsignal(p, sig, code)
|
||||
struct proc *p;
|
||||
register int sig;
|
||||
u_long code;
|
||||
trapsignal(struct thread *td, int sig, u_long code)
|
||||
{
|
||||
register struct sigacts *ps;
|
||||
struct sigacts *ps;
|
||||
struct proc *p;
|
||||
|
||||
p = td->td_proc;
|
||||
|
||||
PROC_LOCK(p);
|
||||
ps = p->p_sigacts;
|
||||
|
@ -209,7 +209,7 @@ ast(struct trapframe *framep)
|
||||
PCB_NPXTRAP);
|
||||
ucode = npxtrap();
|
||||
if (ucode != -1) {
|
||||
trapsignal(p, SIGFPE, ucode);
|
||||
trapsignal(td, SIGFPE, ucode);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -700,7 +700,7 @@ osigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -741,7 +741,7 @@ osigreturn(td, uap)
|
||||
* other selectors, invalid %eip's and invalid %esp's.
|
||||
*/
|
||||
if (!CS_SECURE(scp->sc_cs)) {
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
regs->tf_ds = scp->sc_ds;
|
||||
@ -818,7 +818,7 @@ freebsd4_sigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -864,7 +864,7 @@ freebsd4_sigreturn(td, uap)
|
||||
cs = ucp->uc_mcontext.mc_cs;
|
||||
if (!CS_SECURE(cs)) {
|
||||
printf("freebsd4_sigreturn: cs = 0x%x\n", cs);
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
@ -925,7 +925,7 @@ sigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -971,7 +971,7 @@ sigreturn(td, uap)
|
||||
cs = ucp->uc_mcontext.mc_cs;
|
||||
if (!CS_SECURE(cs)) {
|
||||
printf("sigreturn: cs = 0x%x\n", cs);
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ osigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -741,7 +741,7 @@ osigreturn(td, uap)
|
||||
* other selectors, invalid %eip's and invalid %esp's.
|
||||
*/
|
||||
if (!CS_SECURE(scp->sc_cs)) {
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
regs->tf_ds = scp->sc_ds;
|
||||
@ -818,7 +818,7 @@ freebsd4_sigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -864,7 +864,7 @@ freebsd4_sigreturn(td, uap)
|
||||
cs = ucp->uc_mcontext.mc_cs;
|
||||
if (!CS_SECURE(cs)) {
|
||||
printf("freebsd4_sigreturn: cs = 0x%x\n", cs);
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
@ -925,7 +925,7 @@ sigreturn(td, uap)
|
||||
|
||||
/* Go back to user mode if both flags are set. */
|
||||
if ((eflags & PSL_VIP) && (eflags & PSL_VIF))
|
||||
trapsignal(p, SIGBUS, 0);
|
||||
trapsignal(td, SIGBUS, 0);
|
||||
|
||||
if (vm86->vm86_has_vme) {
|
||||
eflags = (tf->tf_eflags & ~VME_USERCHANGE) |
|
||||
@ -971,7 +971,7 @@ sigreturn(td, uap)
|
||||
cs = ucp->uc_mcontext.mc_cs;
|
||||
if (!CS_SECURE(cs)) {
|
||||
printf("sigreturn: cs = 0x%x\n", cs);
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
trapsignal(td, SIGBUS, T_PROTFLT);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ trap(struct trapframe *frame)
|
||||
if (sig != 0) {
|
||||
if (p->p_sysent->sv_transtrap != NULL)
|
||||
sig = (p->p_sysent->sv_transtrap)(sig, type);
|
||||
trapsignal(p, sig, ucode);
|
||||
trapsignal(td, sig, ucode);
|
||||
}
|
||||
|
||||
userret(td, frame, sticks);
|
||||
|
@ -258,7 +258,7 @@ trap(struct trapframe *frame)
|
||||
if (sig != 0) {
|
||||
if (p->p_sysent->sv_transtrap != NULL)
|
||||
sig = (p->p_sysent->sv_transtrap)(sig, type);
|
||||
trapsignal(p, sig, ucode);
|
||||
trapsignal(td, sig, ucode);
|
||||
}
|
||||
|
||||
userret(td, frame, sticks);
|
||||
|
@ -284,7 +284,7 @@ trap(struct trapframe *tf)
|
||||
if (debugger_on_signal &&
|
||||
(sig == 4 || sig == 10 || sig == 11))
|
||||
Debugger("trapsig");
|
||||
trapsignal(p, sig, tf->tf_type);
|
||||
trapsignal(td, sig, tf->tf_type);
|
||||
}
|
||||
|
||||
userret(td, tf, sticks);
|
||||
|
@ -247,7 +247,7 @@ void psignal(struct proc *p, int sig);
|
||||
void sigexit(struct thread *td, int signum) __dead2;
|
||||
void siginit(struct proc *p);
|
||||
void signotify(struct proc *p);
|
||||
void trapsignal(struct proc *p, int sig, u_long code);
|
||||
void trapsignal(struct thread *td, int sig, u_long code);
|
||||
|
||||
/*
|
||||
* Machine-dependent functions:
|
||||
|
Loading…
x
Reference in New Issue
Block a user