Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Initialize these kpm fields in pmap_bootstrap.



details:   https://anonhg.NetBSD.org/src/rev/a91bd7fe1949
branches:  trunk
changeset: 355262:a91bd7fe1949
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Jul 22 08:23:18 2017 +0000

description:
Initialize these kpm fields in pmap_bootstrap.

diffstat:

 sys/arch/amd64/amd64/machdep.c |  14 +++++---------
 sys/arch/i386/i386/machdep.c   |  14 +++++---------
 sys/arch/x86/x86/pmap.c        |   8 ++++++--
 3 files changed, 16 insertions(+), 20 deletions(-)

diffs (119 lines):

diff -r d587cfc100f4 -r a91bd7fe1949 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Sat Jul 22 08:01:35 2017 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Sat Jul 22 08:23:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.256 2017/07/14 13:21:29 maxv Exp $       */
+/*     $NetBSD: machdep.c,v 1.257 2017/07/22 08:23:19 maxv Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.256 2017/07/14 13:21:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.257 2017/07/22 08:23:19 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -472,25 +472,21 @@
        pcb->pcb_rsp0 = (uvm_lwp_getuarea(l) + USPACE - 16) & ~0xf;
        pcb->pcb_iopl = SEL_KPL;
        pcb->pcb_dbregs = NULL;
-
-       pmap_kernel()->pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL);
        pcb->pcb_cr0 = rcr0() & ~CR0_TS;
        l->l_md.md_regs = (struct trapframe *)pcb->pcb_rsp0 - 1;
 
 #if !defined(XEN)
-       lldt(pmap_kernel()->pm_ldt_sel);
+       lldt(GSYSSEL(GLDT_SEL, SEL_KPL));
 #else
-       {
        struct physdev_op physop;
-       xen_set_ldt((vaddr_t) ldtstore, LDT_SIZE >> 3);
+       xen_set_ldt((vaddr_t)ldtstore, LDT_SIZE >> 3);
        /* Reset TS bit and set kernel stack for interrupt handlers */
        HYPERVISOR_fpu_taskswitch(1);
        HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb->pcb_rsp0);
        physop.cmd = PHYSDEVOP_SET_IOPL;
        physop.u.set_iopl.iopl = pcb->pcb_iopl;
        HYPERVISOR_physdev_op(&physop);
-       }
-#endif /* XEN */
+#endif
 }
 
 /*
diff -r d587cfc100f4 -r a91bd7fe1949 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Sat Jul 22 08:01:35 2017 +0000
+++ b/sys/arch/i386/i386/machdep.c      Sat Jul 22 08:23:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.783 2017/07/01 10:44:42 maxv Exp $       */
+/*     $NetBSD: machdep.c,v 1.784 2017/07/22 08:23:18 maxv Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.783 2017/07/01 10:44:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.784 2017/07/22 08:23:18 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -497,13 +497,9 @@
 void
 i386_proc0_tss_ldt_init(void)
 {
-       struct lwp *l;
-       struct pcb *pcb __diagused;
+       struct lwp *l = &lwp0;
+       struct pcb *pcb = lwp_getpcb(l);
 
-       l = &lwp0;
-       pcb = lwp_getpcb(l);
-
-       pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL);
        pcb->pcb_cr0 = rcr0() & ~CR0_TS;
        pcb->pcb_esp0 = uvm_lwp_getuarea(l) + USPACE - 16;
        pcb->pcb_iopl = SEL_KPL;
@@ -513,7 +509,7 @@
        pcb->pcb_dbregs = NULL;
 
 #ifndef XEN
-       lldt(pmap_kernel()->pm_ldt_sel);
+       lldt(GSEL(GLDT_SEL, SEL_KPL));
 #else
        HYPERVISOR_fpu_taskswitch(1);
        XENPRINTF(("lwp tss sp %p ss %04x/%04x\n",
diff -r d587cfc100f4 -r a91bd7fe1949 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c   Sat Jul 22 08:01:35 2017 +0000
+++ b/sys/arch/x86/x86/pmap.c   Sat Jul 22 08:23:18 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.254 2017/06/25 22:16:46 bouyer Exp $        */
+/*     $NetBSD: pmap.c,v 1.255 2017/07/22 08:23:19 maxv Exp $  */
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.254 2017/06/25 22:16:46 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.255 2017/07/22 08:23:19 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1265,6 +1265,10 @@
        kcpuset_create(&kpm->pm_cpus, true);
        kcpuset_create(&kpm->pm_kernel_cpus, true);
 
+       kpm->pm_ldt = NULL;
+       kpm->pm_ldt_len = 0;
+       kpm->pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL);
+
        /*
         * the above is just a rough estimate and not critical to the proper
         * operation of the system.



Home | Main Index | Thread Index | Old Index