mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
Backout changes trying to inherit floating-point environment, although
POSIX (susv3) requires this, but it is unclear what should be inherited, duplicating whole 387 stack for new thread seems to be unnecessary and dangerous. Revert to previous code, force a new thread to be started with clean FP state.
This commit is contained in:
parent
46f1e0d36c
commit
5d84379dd6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159027
@ -393,8 +393,7 @@ cpu_set_upcall(struct thread *td, struct thread *td0)
|
||||
* more analysis) (need a good safe default).
|
||||
*/
|
||||
bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
|
||||
pcb2->pcb_flags &= ~PCB_NPXTRAP;
|
||||
npx_fork_thread(td0, td);
|
||||
pcb2->pcb_flags &= ~(PCB_NPXTRAP|PCB_NPXINITDONE);
|
||||
|
||||
/*
|
||||
* Create a new fresh stack for the new thread.
|
||||
|
@ -138,8 +138,6 @@ union savefpu {
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
struct thread;
|
||||
|
||||
#define IO_NPX 0x0F0 /* Numeric Coprocessor */
|
||||
#define IO_NPXSIZE 16 /* 80387/80487 NPX registers */
|
||||
|
||||
@ -157,7 +155,6 @@ void npxinit(u_short control);
|
||||
void npxsave(union savefpu *addr);
|
||||
void npxsetregs(struct thread *td, union savefpu *addr);
|
||||
int npxtrap(void);
|
||||
void npx_fork_thread(struct thread *td, struct thread *newtd);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -942,41 +942,6 @@ npxsetregs(td, addr)
|
||||
curthread->td_pcb->pcb_flags |= PCB_NPXINITDONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* POSIX requires new thread to inherit floating-point environment.
|
||||
*/
|
||||
void
|
||||
npx_fork_thread(struct thread *td, struct thread *newtd)
|
||||
{
|
||||
union savefpu *state;
|
||||
u_int32_t mxcsr;
|
||||
u_int32_t cw;
|
||||
|
||||
if (!(td->td_pcb->pcb_flags & PCB_NPXINITDONE)) {
|
||||
newtd->td_pcb->pcb_flags &= ~PCB_NPXINITDONE;
|
||||
return;
|
||||
}
|
||||
|
||||
state = &newtd->td_pcb->pcb_save;
|
||||
/* get control word */
|
||||
if (npxgetregs(td, state))
|
||||
return;
|
||||
if (cpu_fxsr) {
|
||||
mxcsr = state->sv_xmm.sv_env.en_mxcsr;
|
||||
cw = state->sv_xmm.sv_env.en_cw;
|
||||
} else {
|
||||
cw = state->sv_87.sv_env.en_cw;
|
||||
mxcsr = 0;
|
||||
}
|
||||
bcopy(&npx_cleanstate, state, sizeof(*state));
|
||||
if (cpu_fxsr) {
|
||||
state->sv_xmm.sv_env.en_cw = cw;
|
||||
state->sv_xmm.sv_env.en_mxcsr = mxcsr;
|
||||
} else
|
||||
state->sv_87.sv_env.en_cw = cw;
|
||||
newtd->td_pcb->pcb_flags |= PCB_NPXINITDONE;
|
||||
}
|
||||
|
||||
static void
|
||||
fpusave(addr)
|
||||
union savefpu *addr;
|
||||
|
Loading…
Reference in New Issue
Block a user