Changeset View
Changeset View
Standalone View
Standalone View
head/sys/powerpc/powerpc/exec_machdep.c
Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) | ||||
if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && | if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && | ||||
SIGISMEMBER(psp->ps_sigonstack, sig)) { | SIGISMEMBER(psp->ps_sigonstack, sig)) { | ||||
usfp = (void *)(((uintptr_t)td->td_sigstk.ss_sp + | usfp = (void *)(((uintptr_t)td->td_sigstk.ss_sp + | ||||
td->td_sigstk.ss_size - rndfsize) & ~0xFul); | td->td_sigstk.ss_size - rndfsize) & ~0xFul); | ||||
} else { | } else { | ||||
usfp = (void *)((sp - rndfsize) & ~0xFul); | usfp = (void *)((sp - rndfsize) & ~0xFul); | ||||
} | } | ||||
/* | /* | ||||
* Save the floating-point state, if necessary, then copy it. | * Set Floating Point facility to "Ignore Exceptions Mode" so signal | ||||
* handler can run. | |||||
*/ | */ | ||||
/* XXX */ | if (td->td_pcb->pcb_flags & PCB_FPU) | ||||
tf->srr1 = tf->srr1 & ~(PSL_FE0 | PSL_FE1); | |||||
/* | /* | ||||
* Set up the registers to return to sigcode. | * Set up the registers to return to sigcode. | ||||
* | * | ||||
* r1/sp - sigframe ptr | * r1/sp - sigframe ptr | ||||
* lr - sig function, dispatched to by blrl in trampoline | * lr - sig function, dispatched to by blrl in trampoline | ||||
* r3 - sig number | * r3 - sig number | ||||
* r4 - SIGINFO ? &siginfo : exception code | * r4 - SIGINFO ? &siginfo : exception code | ||||
* r5 - user context | * r5 - user context | ||||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | sys_sigreturn(struct thread *td, struct sigreturn_args *uap) | ||||
} | } | ||||
error = set_mcontext(td, &uc.uc_mcontext); | error = set_mcontext(td, &uc.uc_mcontext); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); | kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); | ||||
/* | |||||
* Save FPU state if needed. User may have changed it on | |||||
* signal handler | |||||
*/ | |||||
if (uc.uc_mcontext.mc_srr1 & PSL_FP) | |||||
save_fpu(td); | |||||
CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", | CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", | ||||
td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); | td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); | ||||
return (EJUSTRETURN); | return (EJUSTRETURN); | ||||
} | } | ||||
#ifdef COMPAT_FREEBSD4 | #ifdef COMPAT_FREEBSD4 | ||||
int | int | ||||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | if (td != curthread) | ||||
return; | return; | ||||
pcb_flags = td->td_pcb->pcb_flags; | pcb_flags = td->td_pcb->pcb_flags; | ||||
/* Clean up registers not managed by MSR. */ | /* Clean up registers not managed by MSR. */ | ||||
if (pcb_flags & PCB_CFSCR) | if (pcb_flags & PCB_CFSCR) | ||||
mtspr(SPR_FSCR, 0); | mtspr(SPR_FSCR, 0); | ||||
if (pcb_flags & PCB_CDSCR) | if (pcb_flags & PCB_CDSCR) | ||||
mtspr(SPR_DSCRP, 0); | mtspr(SPR_DSCRP, 0); | ||||
cleanup_fpscr(); | |||||
} | } | ||||
/* | /* | ||||
* Set set up registers on exec. | * Set set up registers on exec. | ||||
*/ | */ | ||||
void | void | ||||
exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) | exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | if (copyin(uap->sigcntxp, &uc, sizeof(uc)) != 0) { | ||||
return (EFAULT); | return (EFAULT); | ||||
} | } | ||||
error = set_mcontext32(td, &uc.uc_mcontext); | error = set_mcontext32(td, &uc.uc_mcontext); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); | kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); | ||||
/* | |||||
* Save FPU state if needed. User may have changed it on | |||||
* signal handler | |||||
*/ | |||||
if (uc.uc_mcontext.mc_srr1 & PSL_FP) | |||||
save_fpu(td); | |||||
CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", | CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", | ||||
td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); | td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); | ||||
return (EJUSTRETURN); | return (EJUSTRETURN); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 360 Lines • Show Last 20 Lines |