[PowerPC] Floating-point exception trap followup
* Fix incorrect operation on 32-bit caused by incorrectly-sized storage for a temporary FPSCR. * Fix several whitespace problems. * Don't try to enable VSX during cleanup_fpscr(). Reviewed by: alfredo, jhibbits (earlier version) Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D27453
This commit is contained in:
parent
89b418d69e
commit
ab5711797d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=368604
@ -163,21 +163,21 @@ mttb(u_quad_t time)
|
||||
mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff));
|
||||
}
|
||||
|
||||
|
||||
static __inline register_t
|
||||
mffs(void)
|
||||
{
|
||||
register_t value;
|
||||
uint64_t value;
|
||||
|
||||
__asm __volatile ("mffs 0; stfd 0,0(%0)"
|
||||
:: "b"(&value));
|
||||
|
||||
return (value);
|
||||
return ((register_t)value);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
mtfsf(register_t value)
|
||||
mtfsf(uint64_t value)
|
||||
{
|
||||
|
||||
__asm __volatile ("lfd 0,0(%0); mtfsf 0xff,0"
|
||||
:: "b"(&value));
|
||||
}
|
||||
|
@ -239,14 +239,13 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
|
||||
usfp = (void *)((sp - rndfsize) & ~0xFul);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Set Floating Point facility to "Ignore Exceptions Mode" so signal
|
||||
* handler can run.
|
||||
* handler can run.
|
||||
*/
|
||||
if (td->td_pcb->pcb_flags & PCB_FPU)
|
||||
tf->srr1 = tf->srr1 & ~(PSL_FE0 | PSL_FE1);
|
||||
|
||||
|
||||
/*
|
||||
* Set up the registers to return to sigcode.
|
||||
*
|
||||
@ -334,10 +333,10 @@ sys_sigreturn(struct thread *td, struct sigreturn_args *uap)
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Save FPU state if needed. User may have changed it on
|
||||
* signal handler
|
||||
*/
|
||||
* signal handler
|
||||
*/
|
||||
if (uc.uc_mcontext.mc_srr1 & PSL_FP)
|
||||
save_fpu(td);
|
||||
|
||||
|
@ -209,7 +209,6 @@ save_fpu_nodrop(struct thread *td)
|
||||
save_fpu_int(td);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Clear Floating-Point Status and Control Register
|
||||
*/
|
||||
@ -217,19 +216,18 @@ void
|
||||
cleanup_fpscr()
|
||||
{
|
||||
register_t msr;
|
||||
msr = mfmsr();
|
||||
mtmsr(msr | PSL_FP | PSL_VSX);
|
||||
|
||||
msr = mfmsr();
|
||||
mtmsr(msr | PSL_FP);
|
||||
mtfsf(0);
|
||||
|
||||
isync();
|
||||
mtmsr(msr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* * Returns the current fp exception
|
||||
* */
|
||||
* Get the current fp exception
|
||||
*/
|
||||
u_int
|
||||
get_fpu_exception(struct thread *td)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user