aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1997-01-24 19:01:54 +0000
committerBruce Evans <bde@FreeBSD.org>1997-01-24 19:01:54 +0000
commitd9cca175bcb23e8ff64c3cd99a0948ba07e8f518 (patch)
tree23b72bf5a82cf92f64abb4518b33efc668bbc407 /sys
parent8819cbef393d6588a5a7cc8fbe1c644a267785f3 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/machdep.c29
-rw-r--r--sys/i386/i386/machdep.c29
2 files changed, 50 insertions, 8 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 4cf3ac843a67..6ebccffbd52b 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -685,11 +685,30 @@ setregs(p, entry, stack)
regs[tES] = _udatasel;
regs[tCS] = _ucodesel;
- p->p_addr->u_pcb.pcb_flags = 0; /* no fp at all */
- load_cr0(rcr0() | CR0_TS); /* start emulating */
-#if NNPX > 0
+ /*
+ * Initialize the math emulator (if any) for the current process.
+ * Actually, just clear the bit that says that the emulator has
+ * been initialized. Initialization is delayed until the process
+ * traps to the emulator (if it is done at all) mainly because
+ * emulators don't provide an entry point for initialization.
+ */
+ p->p_addr->u_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);
+
+#if NNPX > 0
+ /* Initialize the npx (if any) for the current process. */
npxinit(__INITIAL_NPXCW__);
-#endif /* NNPX > 0 */
+#endif
}
static int
@@ -1140,9 +1159,11 @@ init386(first)
Maxmem = MAXMEM/4;
#endif
+#if NNPX > 0
idp = find_isadev(isa_devtab_null, &npxdriver, 0);
if (idp != NULL && idp->id_msize != 0)
Maxmem = idp->id_msize / 4;
+#endif
/* call pmap initialization to make new kernel address space */
pmap_bootstrap (first, 0);
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 4cf3ac843a67..6ebccffbd52b 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -685,11 +685,30 @@ setregs(p, entry, stack)
regs[tES] = _udatasel;
regs[tCS] = _ucodesel;
- p->p_addr->u_pcb.pcb_flags = 0; /* no fp at all */
- load_cr0(rcr0() | CR0_TS); /* start emulating */
-#if NNPX > 0
+ /*
+ * Initialize the math emulator (if any) for the current process.
+ * Actually, just clear the bit that says that the emulator has
+ * been initialized. Initialization is delayed until the process
+ * traps to the emulator (if it is done at all) mainly because
+ * emulators don't provide an entry point for initialization.
+ */
+ p->p_addr->u_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);
+
+#if NNPX > 0
+ /* Initialize the npx (if any) for the current process. */
npxinit(__INITIAL_NPXCW__);
-#endif /* NNPX > 0 */
+#endif
}
static int
@@ -1140,9 +1159,11 @@ init386(first)
Maxmem = MAXMEM/4;
#endif
+#if NNPX > 0
idp = find_isadev(isa_devtab_null, &npxdriver, 0);
if (idp != NULL && idp->id_msize != 0)
Maxmem = idp->id_msize / 4;
+#endif
/* call pmap initialization to make new kernel address space */
pmap_bootstrap (first, 0);