Source-Changes-HG archive

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

[src/yamt-km]: src/sys/arch - convert i386 to new apis.



details:   https://anonhg.NetBSD.org/src/rev/ab7c62083979
branches:  yamt-km
changeset: 573293:ab7c62083979
user:      yamt <yamt%NetBSD.org@localhost>
date:      Tue Jan 25 13:01:08 2005 +0000

description:
- convert i386 to new apis.
- remove a pmap bootstrap kludge, which is no longer needed.

diffstat:

 sys/arch/i386/i386/cpu.c         |  12 +++++----
 sys/arch/i386/i386/gdt.c         |  10 +++++---
 sys/arch/i386/i386/kvm86.c       |   6 ++--
 sys/arch/i386/i386/machdep.c     |   7 +++--
 sys/arch/i386/i386/pmap.c        |  47 ++++++++++-----------------------------
 sys/arch/i386/i386/sys_machdep.c |  12 +++++----
 sys/arch/i386/i386/vm_machdep.c  |   8 +++---
 sys/arch/i386/pnpbios/pnpbios.c  |   7 +++--
 sys/arch/x86/x86/bus_dma.c       |  10 +++++---
 sys/arch/x86/x86/bus_space.c     |  10 ++++----
 sys/arch/x86/x86/mpbios.c        |   8 +++---
 11 files changed, 62 insertions(+), 75 deletions(-)

diffs (truncated from 496 to 300 lines):

diff -r 0ccdc9d2a0f3 -r ab7c62083979 sys/arch/i386/i386/cpu.c
--- a/sys/arch/i386/i386/cpu.c  Tue Jan 25 12:59:35 2005 +0000
+++ b/sys/arch/i386/i386/cpu.c  Tue Jan 25 13:01:08 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.20 2004/08/30 15:05:17 drochner Exp $ */
+/* $NetBSD: cpu.c,v 1.20.6.1 2005/01/25 13:01:08 yamt Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.20 2004/08/30 15:05:17 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.20.6.1 2005/01/25 13:01:08 yamt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -293,7 +293,7 @@
        /*
         * Allocate UPAGES contiguous pages for the idle PCB and stack.
         */
-       kstack = uvm_km_alloc (kernel_map, USPACE);
+       kstack = uvm_km_alloc(kernel_map, USPACE, 0, UVM_KMF_WIRED);
        if (kstack == 0) {
                if (caa->cpu_role != CPU_ROLE_AP) {
                        panic("cpu_attach: unable to allocate idle stack for"
@@ -696,7 +696,8 @@
 {
        struct segment_descriptor sd;
 
-       ci->ci_doubleflt_stack = (char *)uvm_km_alloc(kernel_map, USPACE);
+       ci->ci_doubleflt_stack = (char *)uvm_km_alloc(kernel_map, USPACE, 0,
+           UVM_KMF_WIRED);
        cpu_init_tss(&ci->ci_doubleflt_tss, ci->ci_doubleflt_stack,
            IDTVEC(tss_trap08));
        setsegment(&sd, &ci->ci_doubleflt_tss, sizeof(struct i386tss) - 1,
@@ -713,7 +714,8 @@
         * XXX overwriting the gate set in db_machine_init.
         * Should rearrange the code so that it's set only once.
         */
-       ci->ci_ddbipi_stack = (char *)uvm_km_alloc(kernel_map, USPACE);
+       ci->ci_ddbipi_stack = (char *)uvm_km_alloc(kernel_map, USPACE, 0,
+           UVM_KMF_WIRED);
        cpu_init_tss(&ci->ci_ddbipi_tss, ci->ci_ddbipi_stack,
            Xintrddbipi);
 
diff -r 0ccdc9d2a0f3 -r ab7c62083979 sys/arch/i386/i386/gdt.c
--- a/sys/arch/i386/i386/gdt.c  Tue Jan 25 12:59:35 2005 +0000
+++ b/sys/arch/i386/i386/gdt.c  Tue Jan 25 13:01:08 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gdt.c,v 1.32 2004/02/13 11:36:13 wiz Exp $     */
+/*     $NetBSD: gdt.c,v 1.32.10.1 2005/01/25 13:01:08 yamt Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.32 2004/02/13 11:36:13 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.32.10.1 2005/01/25 13:01:08 yamt Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -126,7 +126,8 @@
        gdt_free = GNULL_SEL;
 
        old_gdt = gdt;
-       gdt = (union descriptor *)uvm_km_valloc(kernel_map, max_len);
+       gdt = (union descriptor *)uvm_km_alloc(kernel_map, max_len,
+           0, UVM_KMF_VAONLY);
        for (va = (vaddr_t)gdt; va < (vaddr_t)gdt + min_len; va += PAGE_SIZE) {
                pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO);
                if (pg == NULL) {
@@ -154,7 +155,8 @@
        struct vm_page *pg;
        vaddr_t va;
 
-       ci->ci_gdt = (union descriptor *)uvm_km_valloc(kernel_map, max_len);
+       ci->ci_gdt = (union descriptor *)uvm_km_alloc(kernel_map, max_len,
+           0, UVM_KMF_VAONLY);
        for (va = (vaddr_t)ci->ci_gdt; va < (vaddr_t)ci->ci_gdt + min_len;
            va += PAGE_SIZE) {
                while ((pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO))
diff -r 0ccdc9d2a0f3 -r ab7c62083979 sys/arch/i386/i386/kvm86.c
--- a/sys/arch/i386/i386/kvm86.c        Tue Jan 25 12:59:35 2005 +0000
+++ b/sys/arch/i386/i386/kvm86.c        Tue Jan 25 13:01:08 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm86.c,v 1.7 2003/06/23 11:01:18 martin Exp $ */
+/* $NetBSD: kvm86.c,v 1.7.12.1 2005/01/25 13:01:08 yamt Exp $ */
 
 /*
  * Copyright (c) 2002
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kvm86.c,v 1.7 2003/06/23 11:01:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kvm86.c,v 1.7.12.1 2005/01/25 13:01:08 yamt Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -118,7 +118,7 @@
        kvm86_map(vmd, vtophys((vaddr_t)bioscallscratchpage),
                  BIOSCALLSCRATCHPAGE_VMVA);
        bioscallvmd = vmd;
-       bioscalltmpva = uvm_km_valloc(kernel_map, PAGE_SIZE);
+       bioscalltmpva = uvm_km_alloc(kernel_map, PAGE_SIZE, UVM_KMF_VAONLY);
 }
 
 /*
diff -r 0ccdc9d2a0f3 -r ab7c62083979 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Tue Jan 25 12:59:35 2005 +0000
+++ b/sys/arch/i386/i386/machdep.c      Tue Jan 25 13:01:08 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.559 2004/10/20 04:20:05 thorpej Exp $    */
+/*     $NetBSD: machdep.c,v 1.559.6.1 2005/01/25 13:01:08 yamt Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.559 2004/10/20 04:20:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.559.6.1 2005/01/25 13:01:08 yamt Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -290,7 +290,8 @@
        /*
         * Initialize error message buffer (et end of core).
         */
-       msgbuf_vaddr = uvm_km_valloc(kernel_map, x86_round_page(MSGBUFSIZE));
+       msgbuf_vaddr = uvm_km_alloc(kernel_map, x86_round_page(MSGBUFSIZE), 0,
+           UVM_KMF_VAONLY);
        if (msgbuf_vaddr == 0)
                panic("failed to valloc msgbuf_vaddr");
 
diff -r 0ccdc9d2a0f3 -r ab7c62083979 sys/arch/i386/i386/pmap.c
--- a/sys/arch/i386/i386/pmap.c Tue Jan 25 12:59:35 2005 +0000
+++ b/sys/arch/i386/i386/pmap.c Tue Jan 25 13:01:08 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.180 2005/01/01 21:00:06 yamt Exp $  */
+/*     $NetBSD: pmap.c,v 1.180.4.1 2005/01/25 13:01:08 yamt Exp $      */
 
 /*
  *
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.180 2005/01/01 21:00:06 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.180.4.1 2005/01/25 13:01:08 yamt Exp $");
 
 #include "opt_cputype.h"
 #include "opt_user_ldt.h"
@@ -379,7 +379,6 @@
 static struct pv_pagelist pv_freepages;        /* list of pv_pages with free entrys */
 static struct pv_pagelist pv_unusedpgs; /* list of unused pv_pages */
 static int pv_nfpvents;                        /* # of free pv entries */
-static struct pv_page *pv_initpage;    /* bootstrap page from kernel_map */
 static vaddr_t pv_cachedva;            /* cached VA for later use */
 
 #define PVE_LOWAT (PVE_PER_PVPAGE / 2) /* free pv_entry low water mark */
@@ -1149,22 +1148,10 @@
 {
        int i;
 
-       /*
-        * now we need to free enough pv_entry structures to allow us to get
-        * the kmem_map/kmem_object allocated and inited (done after this
-        * function is finished).  to do this we allocate one bootstrap page out
-        * of kernel_map and use it to provide an initial pool of pv_entry
-        * structures.   we never free this page.
-        */
-
-       pv_initpage = (struct pv_page *) uvm_km_alloc(kernel_map, PAGE_SIZE);
-       if (pv_initpage == NULL)
-               panic("pmap_init: pv_initpage");
        pv_cachedva = 0;   /* a VA we have allocated but not used yet */
        pv_nfpvents = 0;
-       (void) pmap_add_pvpage(pv_initpage, FALSE);
-
-       pj_page = (void *)uvm_km_alloc(kernel_map, PAGE_SIZE);
+
+       pj_page = (void *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_WIRED);
        if (pj_page == NULL)
                panic("pmap_init: pj_page");
 
@@ -1299,8 +1286,8 @@
 
        if (pv_cachedva == 0) {
                s = splvm();   /* must protect kmem_map with splvm! */
-               pv_cachedva = uvm_km_kmemalloc(kmem_map, NULL, PAGE_SIZE,
-                   UVM_KMF_TRYLOCK|UVM_KMF_VALLOC);
+               pv_cachedva = uvm_km_alloc(kmem_map, PAGE_SIZE, 0,
+                   UVM_KMF_TRYLOCK|UVM_KMF_VAONLY);
                splx(s);
                if (pv_cachedva == 0) {
                        return (NULL);
@@ -1475,15 +1462,7 @@
 
        pvp = TAILQ_FIRST(&pv_unusedpgs);
 
-       /*
-        * note: watch out for pv_initpage which is allocated out of
-        * kernel_map rather than kmem_map.
-        */
-
-       if (pvp == pv_initpage)
-               map = kernel_map;
-       else
-               map = kmem_map;
+       map = kmem_map;
        if (vm_map_lock_try(map)) {
 
                /* remove pvp from pv_unusedpgs */
@@ -1492,7 +1471,7 @@
                /* unmap the page */
                dead_entries = NULL;
                uvm_unmap_remove(map, (vaddr_t)pvp, ((vaddr_t)pvp) + PAGE_SIZE,
-                   &dead_entries, NULL);
+                   &dead_entries, NULL, 0);
                vm_map_unlock(map);
 
                if (dead_entries != NULL)
@@ -1500,9 +1479,6 @@
 
                pv_nfpvents -= PVE_PER_PVPAGE;  /* update free count */
        }
-       if (pvp == pv_initpage)
-               /* no more initpage, we've freed it */
-               pv_initpage = NULL;
 
        splx(s);
 }
@@ -1833,7 +1809,7 @@
                 */
                ldt_free(pmap);
                uvm_km_free(kernel_map, (vaddr_t)pmap->pm_ldt,
-                           pmap->pm_ldt_len * sizeof(union descriptor));
+                   pmap->pm_ldt_len * sizeof(union descriptor), UVM_KMF_WIRED);
        }
 #endif
 
@@ -1873,7 +1849,8 @@
                size_t len;
 
                len = pmap1->pm_ldt_len * sizeof(union descriptor);
-               new_ldt = (union descriptor *)uvm_km_alloc(kernel_map, len);
+               new_ldt = (union descriptor *)uvm_km_alloc(kernel_map,
+                   len, 0, UVM_KMF_WIRED);
                memcpy(new_ldt, pmap1->pm_ldt, len);
                pmap2->pm_ldt = new_ldt;
                pmap2->pm_ldt_len = pmap1->pm_ldt_len;
@@ -1920,7 +1897,7 @@
        simple_unlock(&pmap->pm_obj.vmobjlock);
 
        if (old_ldt != NULL)
-               uvm_km_free(kernel_map, (vaddr_t)old_ldt, len);
+               uvm_km_free(kernel_map, (vaddr_t)old_ldt, len, UVM_KMF_WIRED);
 }
 #endif /* USER_LDT */
 
diff -r 0ccdc9d2a0f3 -r ab7c62083979 sys/arch/i386/i386/sys_machdep.c
--- a/sys/arch/i386/i386/sys_machdep.c  Tue Jan 25 12:59:35 2005 +0000
+++ b/sys/arch/i386/i386/sys_machdep.c  Tue Jan 25 13:01:08 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_machdep.c,v 1.70 2003/10/27 14:11:47 junyoung Exp $        */
+/*     $NetBSD: sys_machdep.c,v 1.70.10.1 2005/01/25 13:01:08 yamt Exp $       */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.70 2003/10/27 14:11:47 junyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.70.10.1 2005/01/25 13:01:08 yamt Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_mtrr.h"
@@ -282,7 +282,7 @@
 
                simple_unlock(&pmap->pm_lock);
                new_ldt = (union descriptor *)uvm_km_alloc(kernel_map,
-                   new_len);
+                   new_len, 0, UVM_KMF_WIRED);
                simple_lock(&pmap->pm_lock);
 
                if (pmap->pm_ldt != NULL && ldt_len <= pmap->pm_ldt_len) {
@@ -294,7 +294,8 @@
                         * hey.. not our problem if user applications
                         * have race conditions like that.
                         */
-                       uvm_km_free(kernel_map, (vaddr_t)new_ldt, new_len);
+                       uvm_km_free(kernel_map, (vaddr_t)new_ldt, new_len,
+                           UVM_KMF_WIRED);



Home | Main Index | Thread Index | Old Index