diff options
author | nyan <nyan@FreeBSD.org> | 2004-06-22 12:11:20 +0000 |
---|---|---|
committer | nyan <nyan@FreeBSD.org> | 2004-06-22 12:11:20 +0000 |
commit | 10c838a3616a2fe993a5ba40ca9b96962881ed59 (patch) | |
tree | d386ec63ad28a0108979a14ef949478019dab57c /sys/pc98 | |
parent | 166655f4a8f91ea0f5724f5d3bdfecef3a11960e (diff) | |
download | FreeBSD-src-10c838a3616a2fe993a5ba40ca9b96962881ed59.zip FreeBSD-src-10c838a3616a2fe993a5ba40ca9b96962881ed59.tar.gz |
MFi386: revision 1.592.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/i386/machdep.c | 32 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 32 |
2 files changed, 14 insertions, 50 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 315b4d3..1278261 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -1160,27 +1160,8 @@ exec_setregs(td, entry, stack, ps_strings) td->td_pcb->pcb_flags &= ~FP_SOFTFP; /* - * Arrange to trap the next npx or `fwait' instruction (see npx.c - * for why fwait must be trapped at least if there is an npx or an - * emulator). This is mainly to handle the case where npx0 is not - * configured, since the npx routines normally set up the trap - * otherwise. It should be done only at boot time, but doing it - * here allows modifying `npx_exists' for testing the emulator on - * systems with an npx. - */ - load_cr0(rcr0() | CR0_MP | CR0_TS); - - /* Initialize the npx (if any) for the current process. */ - /* - * XXX the above load_cr0() also initializes it and is a layering - * violation if NPX is configured. It drops the npx 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); @@ -1198,10 +1179,11 @@ cpu_setregs(void) unsigned int cr0; cr0 = rcr0(); -#ifdef SMP - cr0 |= CR0_NE; /* Done by npxinit() */ -#endif - 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; #ifndef I386_CPU cr0 |= CR0_WP | CR0_AM; #endif diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 315b4d3..1278261 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -1160,27 +1160,8 @@ exec_setregs(td, entry, stack, ps_strings) td->td_pcb->pcb_flags &= ~FP_SOFTFP; /* - * Arrange to trap the next npx or `fwait' instruction (see npx.c - * for why fwait must be trapped at least if there is an npx or an - * emulator). This is mainly to handle the case where npx0 is not - * configured, since the npx routines normally set up the trap - * otherwise. It should be done only at boot time, but doing it - * here allows modifying `npx_exists' for testing the emulator on - * systems with an npx. - */ - load_cr0(rcr0() | CR0_MP | CR0_TS); - - /* Initialize the npx (if any) for the current process. */ - /* - * XXX the above load_cr0() also initializes it and is a layering - * violation if NPX is configured. It drops the npx 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); @@ -1198,10 +1179,11 @@ cpu_setregs(void) unsigned int cr0; cr0 = rcr0(); -#ifdef SMP - cr0 |= CR0_NE; /* Done by npxinit() */ -#endif - 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; #ifndef I386_CPU cr0 |= CR0_WP | CR0_AM; #endif |