Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/i386 Initialize the kernel vm86 code before au...



details:   https://anonhg.NetBSD.org/src/rev/6d4dac1c26c5
branches:  trunk
changeset: 533689:6d4dac1c26c5
user:      drochner <drochner%NetBSD.org@localhost>
date:      Sun Jul 07 13:23:17 2002 +0000

description:
Initialize the kernel vm86 code before autoconfiguration, so that
BIOS calls can be used for device probing etc.

And now it's getting nasty:
The kvm86 code needs a TSS, and it is most convenient to use proc0's
instead of doing some static allocation. (We might reconsider this if
we want to use vm86 for console initialization, ie much earlier.)
For the TSS slot to be allocated, we have to move the call to
i386_proc0_tss_ldt_init() up.
Since the npx code twiddles CR0 the corresponding pcb field must
be synchronized later. It would probably be cleaner to do this in
the npx driver.

diffstat:

 sys/arch/i386/i386/autoconf.c |  24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diffs (70 lines):

diff -r 161918309ae4 -r 6d4dac1c26c5 sys/arch/i386/i386/autoconf.c
--- a/sys/arch/i386/i386/autoconf.c     Sun Jul 07 13:06:56 2002 +0000
+++ b/sys/arch/i386/i386/autoconf.c     Sun Jul 07 13:23:17 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.60 2002/01/07 21:47:00 thorpej Exp $    */
+/*     $NetBSD: autoconf.c,v 1.61 2002/07/07 13:23:17 drochner Exp $   */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.60 2002/01/07 21:47:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.61 2002/07/07 13:23:17 drochner Exp $");
 
 #include "opt_compat_oldboot.h"
 
@@ -66,9 +66,12 @@
 #include <sys/vnode.h>
 #include <sys/fcntl.h>
 #include <sys/dkio.h>
+#include <sys/proc.h>
+#include <sys/user.h>
 
 #include <machine/pte.h>
 #include <machine/cpu.h>
+#include <machine/pcb.h>
 #include <machine/bootinfo.h>
 
 static int match_harddisk __P((struct device *, struct btinfo_bootdisk *));
@@ -91,6 +94,11 @@
 #include <i386/pci/pcibios.h>
 #endif
 
+#include "opt_kvm86.h"
+#ifdef KVM86
+#include <machine/kvm86.h>
+#endif
+
 struct device *booted_device;
 int booted_partition;
 
@@ -110,6 +118,12 @@
        pcibios_init();
 #endif
 
+       /* kvm86 needs a TSS */
+       i386_proc0_tss_ldt_init();
+#ifdef KVM86
+       kvm86_init();
+#endif
+
        if (config_rootfound("mainbus", NULL) == NULL)
                panic("configure: mainbus not configured");
 
@@ -117,10 +131,10 @@
            (u_short)imask[IPL_BIO], (u_short)imask[IPL_NET],
            (u_short)imask[IPL_TTY]);
 
-       spl0();
+       /* resync after FPU configuration */
+       proc0.p_addr->u_pcb.pcb_cr0 = rcr0();
 
-       /* Set up proc0's TSS and LDT (after the FPU is configured). */
-       i386_proc0_tss_ldt_init();
+       spl0();
 
        /* XXX Finish deferred buffer cache allocation. */
        i386_bufinit();



Home | Main Index | Thread Index | Old Index