diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-14 03:04:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-14 03:04:09 +0000 |
commit | dedeb2b420670c93d16940d6c746f6af87246d7f (patch) | |
tree | e7ede060b9f80cd1289b09a130f22a9e66a3bb62 /sys/uvm/uvm_page.c | |
parent | 000d711134f5ad425653ff4dccc81a69197e51e4 (diff) |
backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.
Diffstat (limited to 'sys/uvm/uvm_page.c')
-rw-r--r-- | sys/uvm/uvm_page.c | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 41cd30644dc..3758deb58e7 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_page.c,v 1.87 2009/06/07 02:01:54 oga Exp $ */ +/* $OpenBSD: uvm_page.c,v 1.88 2009/06/14 03:04:08 deraadt Exp $ */ /* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */ /* @@ -73,6 +73,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/malloc.h> #include <sys/sched.h> #include <sys/kernel.h> #include <sys/vnode.h> @@ -572,8 +573,8 @@ uvm_page_physget(paddr_t *paddrp) */ void -uvm_page_physload_flags(paddr_t start, paddr_t end, paddr_t avail_start, - paddr_t avail_end, int free_list, int flags) +uvm_page_physload(paddr_t start, paddr_t end, paddr_t avail_start, + paddr_t avail_end, int free_list) { int preload, lcv; psize_t npages; @@ -615,15 +616,13 @@ uvm_page_physload_flags(paddr_t start, paddr_t end, paddr_t avail_start, * if VM is already running, attempt to malloc() vm_page structures */ if (!preload) { - /* - * XXXCDC: need some sort of lockout for this case - * right now it is only used by devices so it should be alright. - */ +#if defined(VM_PHYSSEG_NOADD) + panic("uvm_page_physload: tried to add RAM after vm_mem_init"); +#else + /* XXXCDC: need some sort of lockout for this case */ paddr_t paddr; - npages = end - start; /* # of pages */ - - pgs = (struct vm_page *)uvm_km_zalloc(kernel_map, + pgs = (vm_page *)uvm_km_zalloc(kernel_map, sizeof(struct vm_page) * npages); if (pgs == NULL) { printf("uvm_page_physload: can not malloc vm_page " @@ -631,31 +630,18 @@ uvm_page_physload_flags(paddr_t start, paddr_t end, paddr_t avail_start, printf("\tignoring 0x%lx -> 0x%lx\n", start, end); return; } - - /* init phys_addr and free pages, XXX uvmexp.npages */ - for (lcv = 0, paddr = ptoa(start); lcv < npages; - lcv++, paddr += PAGE_SIZE) { + /* init phys_addr and free_list, and free pages */ + for (lcv = 0, paddr = ptoa(start) ; + lcv < npages ; lcv++, paddr += PAGE_SIZE) { pgs[lcv].phys_addr = paddr; -#ifdef __HAVE_VM_PAGE_MD - VM_MDPAGE_INIT(&pgs[lcv]); -#endif + pgs[lcv].free_list = free_list; if (atop(paddr) >= avail_start && - atop(paddr) <= avail_end) { - if (flags & PHYSLOAD_DEVICE) { - atomic_setbits_int(&pgs[lcv].pg_flags, - PG_DEV); - pgs[lcv].wire_count = 1; - } else { -#if defined(VM_PHYSSEG_NOADD) - panic("uvm_page_physload: tried to add RAM after vm_mem_init"); -#else - uvm_pagefree(&pgs[lcv]); -#endif - } - } + atop(paddr) <= avail_end) + uvm_pagefree(&pgs[lcv]); } /* XXXCDC: incomplete: need to update uvmexp.free, what else? */ /* XXXCDC: need hook to tell pmap to rebuild pv_list, etc... */ +#endif } else { /* gcc complains if these don't get init'd */ @@ -836,13 +822,15 @@ uvm_pagealloc_strat(struct uvm_object *obj, voff_t off, struct vm_anon *anon, pg->offset = off; pg->uobject = obj; pg->uanon = anon; - KASSERT((pg->pg_flags & PG_DEV) == 0); pg->pg_flags = PG_BUSY|PG_FAKE; if (!(flags & UVM_PGA_ZERO)) atomic_setbits_int(&pg->pg_flags, PG_CLEAN); if (anon) { anon->an_page = pg; atomic_setbits_int(&pg->pg_flags, PQ_ANON); +#ifdef UBC + uvm_pgcnt_anon++; +#endif } else { if (obj) uvm_pageinsert(pg); @@ -920,7 +908,6 @@ uvm_pagefree(struct vm_page *pg) UVMHIST_LOG(pghist, "freeing pg %p/%lx", pg, (u_long)VM_PAGE_TO_PHYS(pg), 0, 0); - KASSERT((pg->pg_flags & PG_DEV) == 0); /* * if the page was an object page (and thus "TABLED"), remove it |