diff options
author | Peter Wemm <peter@FreeBSD.org> | 2004-07-08 01:31:13 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2004-07-08 01:31:13 +0000 |
commit | f08560a569029dfec86f975642ecec4953a146ab (patch) | |
tree | c9e0003486a3c636043a83e2eb7c143449b638c7 /sys/amd64 | |
parent | 6ad90df2e302f09b511a57b52e75d00a3c7ee247 (diff) | |
download | src-f08560a569029dfec86f975642ecec4953a146ab.tar.gz src-f08560a569029dfec86f975642ecec4953a146ab.zip |
MFi386: fix up CR0 settings
Notes
Notes:
svn path=/head/; revision=131775
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 53765146cf1c..2d0fd66dcd4d 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -558,27 +558,8 @@ exec_setregs(td, entry, stack, ps_strings) } /* - * Arrange to trap the next fpu or `fwait' instruction (see fpu.c - * for why fwait must be trapped at least if there is an fpu or an - * emulator). This is mainly to handle the case where npx0 is not - * configured, since the fpu routines normally set up the trap - * otherwise. It should be done only at boot time, but doing it - * here allows modifying `fpu_exists' for testing the emulator on - * systems with an fpu. - */ - load_cr0(rcr0() | CR0_MP | CR0_TS); - - /* Initialize the fpu (if any) for the current process. */ - /* - * XXX the above load_cr0() also initializes it and is a layering - * violation. It drops the fpu state partially - * and this would be fatal if we were interrupted now, and decided - * to force the state to the pcb, and checked the invariant - * (CR0_TS clear) if and only if PCPU_GET(fpcurthread) != NULL). - * ALL of this can happen except the check. The check used to - * happen and be fatal later when we didn't complete the drop - * before returning to user mode. This should be fixed properly - * soon. + * Drop the FP state if we hold it, so that the process gets a + * clean FP state if it uses the FPU again. */ fpstate_drop(td); } @@ -589,8 +570,11 @@ cpu_setregs(void) register_t cr0; cr0 = rcr0(); - cr0 |= CR0_NE; /* Done by fpuinit() */ - cr0 |= CR0_MP | CR0_TS; /* Done at every execve() too. */ + /* + * CR0_MP, CR0_NE and CR0_TS are also set by npx_probe() for the + * BSP. See the comments there about why we set them. + */ + cr0 |= CR0_MP | CR0_NE | CR0_TS; cr0 |= CR0_WP | CR0_AM; load_cr0(cr0); } |