Module Name: src Committed By: uebayasi Date: Wed Nov 10 09:27:25 UTC 2010
Modified Files: src/sys/arch/acorn26/acorn26: pmap.c src/sys/arch/alpha/alpha: machdep.c pmap.c src/sys/arch/amd64/amd64: machdep.c src/sys/arch/arm/arm32: pmap.c src/sys/arch/i386/i386: machdep.c src/sys/arch/ia64/ia64: machdep.c pmap.c src/sys/arch/m68k/m68k: pmap_motorola.c src/sys/arch/mips/mips: mips_machdep.c pmap.c src/sys/arch/powerpc/ibm4xx: pmap.c src/sys/arch/powerpc/isa: isadma_machdep.c src/sys/arch/powerpc/oea: pmap.c src/sys/arch/powerpc/powerpc: bus_dma.c src/sys/arch/sh3/sh3: mem.c pmap.c src/sys/arch/vax/vax: pmap.c src/sys/arch/x68k/x68k: machdep.c mem.c src/sys/uvm: uvm_page.h Log Message: Use more VM_PHYSMEM_*() accessors. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/acorn26/acorn26/pmap.c cvs rdiff -u -r1.327 -r1.328 src/sys/arch/alpha/alpha/machdep.c cvs rdiff -u -r1.253 -r1.254 src/sys/arch/alpha/alpha/pmap.c cvs rdiff -u -r1.154 -r1.155 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.217 -r1.218 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.696 -r1.697 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/ia64/ia64/machdep.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/ia64/ia64/pmap.c cvs rdiff -u -r1.56 -r1.57 src/sys/arch/m68k/m68k/pmap_motorola.c cvs rdiff -u -r1.227 -r1.228 src/sys/arch/mips/mips/mips_machdep.c cvs rdiff -u -r1.190 -r1.191 src/sys/arch/mips/mips/pmap.c cvs rdiff -u -r1.63 -r1.64 src/sys/arch/powerpc/ibm4xx/pmap.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/isa/isadma_machdep.c cvs rdiff -u -r1.72 -r1.73 src/sys/arch/powerpc/oea/pmap.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/powerpc/bus_dma.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sh3/sh3/mem.c cvs rdiff -u -r1.75 -r1.76 src/sys/arch/sh3/sh3/pmap.c cvs rdiff -u -r1.177 -r1.178 src/sys/arch/vax/vax/pmap.c cvs rdiff -u -r1.167 -r1.168 src/sys/arch/x68k/x68k/machdep.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x68k/x68k/mem.c cvs rdiff -u -r1.62 -r1.63 src/sys/uvm/uvm_page.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/acorn26/acorn26/pmap.c diff -u src/sys/arch/acorn26/acorn26/pmap.c:1.30 src/sys/arch/acorn26/acorn26/pmap.c:1.31 --- src/sys/arch/acorn26/acorn26/pmap.c:1.30 Sat Nov 7 07:27:40 2009 +++ src/sys/arch/acorn26/acorn26/pmap.c Wed Nov 10 09:27:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.30 2009/11/07 07:27:40 cegger Exp $ */ +/* $NetBSD: pmap.c,v 1.31 2010/11/10 09:27:21 uebayasi Exp $ */ /*- * Copyright (c) 1997, 1998, 2000 Ben Harris * All rights reserved. @@ -102,7 +102,7 @@ #include <sys/param.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.30 2009/11/07 07:27:40 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.31 2010/11/10 09:27:21 uebayasi Exp $"); #include <sys/kernel.h> /* for cold */ #include <sys/malloc.h> @@ -299,11 +299,11 @@ addr = 0; size = round_page(size); for (i = 0; i < vm_nphysseg; i++) { - if (vm_physmem[i].avail_start < vm_physmem[i].avail_end) { + if (VM_PHYSMEM_PTR(i)->avail_start < VM_PHYSMEM_PTR(i)->avail_end) { addr = (vaddr_t) ((char*)MEMC_PHYS_BASE + - ptoa(vm_physmem[i].avail_start)); - vm_physmem[i].avail_start++; + ptoa(VM_PHYSMEM_PTR(i)->avail_start)); + VM_PHYSMEM_PTR(i)->avail_start++; break; } } Index: src/sys/arch/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.327 src/sys/arch/alpha/alpha/machdep.c:1.328 --- src/sys/arch/alpha/alpha/machdep.c:1.327 Sat Nov 6 11:46:00 2010 +++ src/sys/arch/alpha/alpha/machdep.c Wed Nov 10 09:27:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.327 2010/11/06 11:46:00 uebayasi Exp $ */ +/* $NetBSD: machdep.c,v 1.328 2010/11/10 09:27:21 uebayasi Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.327 2010/11/06 11:46:00 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.328 2010/11/10 09:27:21 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -604,7 +604,7 @@ vsize_t sz = (vsize_t)round_page(MSGBUFSIZE); vsize_t reqsz = sz; - vps = &vm_physmem[vm_nphysseg - 1]; + vps = VM_PHYSMEM_PTR(vm_nphysseg - 1); /* shrink so that it'll fit in the last segment */ if ((vps->avail_end - vps->avail_start) < atop(sz)) Index: src/sys/arch/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.253 src/sys/arch/alpha/alpha/pmap.c:1.254 --- src/sys/arch/alpha/alpha/pmap.c:1.253 Sat Oct 30 17:00:54 2010 +++ src/sys/arch/alpha/alpha/pmap.c Wed Nov 10 09:27:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.253 2010/10/30 17:00:54 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.254 2010/11/10 09:27:21 uebayasi Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.253 2010/10/30 17:00:54 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.254 2010/11/10 09:27:21 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -788,8 +788,8 @@ * the fact that BSEARCH sorts the vm_physmem[] array * for us. */ - avail_start = ptoa(vm_physmem[0].start); - avail_end = ptoa(vm_physmem[vm_nphysseg - 1].end); + avail_start = ptoa(VM_PHYSMEM_PTR(0)->start); + avail_end = ptoa(VM_PHYSMEM_PTR(vm_nphysseg - 1)->end); virtual_end = VM_MIN_KERNEL_ADDRESS + lev3mapsize * PAGE_SIZE; #if 0 @@ -1028,34 +1028,34 @@ #if 0 printf(" bank %d: avail_start 0x%lx, start 0x%lx, " - "avail_end 0x%lx\n", bank, vm_physmem[bank].avail_start, - vm_physmem[bank].start, vm_physmem[bank].avail_end); + "avail_end 0x%lx\n", bank, VM_PHYSMEM_PTR(bank)->avail_start, + VM_PHYSMEM_PTR(bank)->start, VM_PHYSMEM_PTR(bank)->avail_end); #endif - if (vm_physmem[bank].avail_start != vm_physmem[bank].start || - vm_physmem[bank].avail_start >= vm_physmem[bank].avail_end) + if (VM_PHYSMEM_PTR(bank)->avail_start != VM_PHYSMEM_PTR(bank)->start || + VM_PHYSMEM_PTR(bank)->avail_start >= VM_PHYSMEM_PTR(bank)->avail_end) continue; #if 0 printf(" avail_end - avail_start = 0x%lx\n", - vm_physmem[bank].avail_end - vm_physmem[bank].avail_start); + VM_PHYSMEM_PTR(bank)->avail_end - VM_PHYSMEM_PTR(bank)->avail_start); #endif - if ((vm_physmem[bank].avail_end - vm_physmem[bank].avail_start) + if ((VM_PHYSMEM_PTR(bank)->avail_end - VM_PHYSMEM_PTR(bank)->avail_start) < npgs) continue; /* * There are enough pages here; steal them! */ - pa = ptoa(vm_physmem[bank].avail_start); - vm_physmem[bank].avail_start += npgs; - vm_physmem[bank].start += npgs; + pa = ptoa(VM_PHYSMEM_PTR(bank)->avail_start); + VM_PHYSMEM_PTR(bank)->avail_start += npgs; + VM_PHYSMEM_PTR(bank)->start += npgs; /* * Have we used up this segment? */ - if (vm_physmem[bank].avail_start == vm_physmem[bank].end) { + if (VM_PHYSMEM_PTR(bank)->avail_start == VM_PHYSMEM_PTR(bank)->end) { if (vm_nphysseg == 1) panic("pmap_steal_memory: out of memory!"); @@ -1063,7 +1063,7 @@ vm_nphysseg--; for (x = bank; x < vm_nphysseg; x++) { /* structure copy */ - vm_physmem[x] = vm_physmem[x + 1]; + VM_PHYSMEM_PTR_SWAP(x, x + 1); } } @@ -1114,12 +1114,12 @@ #if 0 for (bank = 0; bank < vm_nphysseg; bank++) { printf("bank %d\n", bank); - printf("\tstart = 0x%x\n", ptoa(vm_physmem[bank].start)); - printf("\tend = 0x%x\n", ptoa(vm_physmem[bank].end)); + printf("\tstart = 0x%x\n", ptoa(VM_PHYSMEM_PTR(bank)->start)); + printf("\tend = 0x%x\n", ptoa(VM_PHYSMEM_PTR(bank)->end)); printf("\tavail_start = 0x%x\n", - ptoa(vm_physmem[bank].avail_start)); + ptoa(VM_PHYSMEM_PTR(bank)->avail_start)); printf("\tavail_end = 0x%x\n", - ptoa(vm_physmem[bank].avail_end)); + ptoa(VM_PHYSMEM_PTR(bank)->avail_end)); } #endif } Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.154 src/sys/arch/amd64/amd64/machdep.c:1.155 --- src/sys/arch/amd64/amd64/machdep.c:1.154 Sun Oct 24 07:53:05 2010 +++ src/sys/arch/amd64/amd64/machdep.c Wed Nov 10 09:27:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.154 2010/10/24 07:53:05 jruoho Exp $ */ +/* $NetBSD: machdep.c,v 1.155 2010/11/10 09:27:21 uebayasi Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008 @@ -107,7 +107,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.154 2010/10/24 07:53:05 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.155 2010/11/10 09:27:21 uebayasi Exp $"); /* #define XENDEBUG_LOW */ @@ -1163,7 +1163,7 @@ vps = NULL; for (x = 0; x < vm_nphysseg; x++) { - vps = &vm_physmem[x]; + vps = VM_PHYSMEM_PTR(x); if (ctob(vps->avail_end) == avail_end) break; } @@ -1182,13 +1182,13 @@ /* Remove the last segment if it now has no pages. */ if (vps->start == vps->end) { for (vm_nphysseg--; x < vm_nphysseg; x++) - vm_physmem[x] = vm_physmem[x + 1]; + VM_PHYSMEM_PTR_SWAP(x, x + 1); } /* Now find where the new avail_end is. */ for (avail_end = 0, x = 0; x < vm_nphysseg; x++) - if (vm_physmem[x].avail_end > avail_end) - avail_end = vm_physmem[x].avail_end; + if (VM_PHYSMEM_PTR(x)->avail_end > avail_end) + avail_end = VM_PHYSMEM_PTR(x)->avail_end; avail_end = ctob(avail_end); if (sz == reqsz) Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.217 src/sys/arch/arm/arm32/pmap.c:1.218 --- src/sys/arch/arm/arm32/pmap.c:1.217 Wed Nov 3 16:59:19 2010 +++ src/sys/arch/arm/arm32/pmap.c Wed Nov 10 09:27:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.217 2010/11/03 16:59:19 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.218 2010/11/10 09:27:22 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -211,7 +211,7 @@ #include <machine/param.h> #include <arm/arm32/katelib.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.217 2010/11/03 16:59:19 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.218 2010/11/10 09:27:22 uebayasi Exp $"); #define VM_PAGE_TO_MD(pg) (&(pg)->mdpage) @@ -5388,8 +5388,8 @@ * One could argue whether this should be the entire memory or just * the memory that is useable in a user process. */ - avail_start = ptoa(vm_physmem[0].start); - avail_end = ptoa(vm_physmem[vm_nphysseg - 1].end); + avail_start = ptoa(VM_PHYSMEM_PTR(0)->start); + avail_end = ptoa(VM_PHYSMEM_PTR(vm_nphysseg - 1)->end); /* * Now we need to free enough pv_entry structures to allow us to get @@ -6639,7 +6639,8 @@ break; } KASSERT(mask == 0); - for (ps = vm_physmem, i = 0; i < vm_nphysseg; ps++, i++) { + for (i = 0; i < vm_nphysseg; i++) { + ps = VM_PHYSMEM_PTR(i); if (ps->avail_start == atop(pv->pv_pa + pv->pv_size) && pv->pv_va + pv->pv_size <= ptoa(ps->avail_end)) { rpv->pv_va = pv->pv_va; @@ -6657,8 +6658,8 @@ * If we consumed the entire physseg, remove it. */ if (ps->avail_start == ps->avail_end) { - for (--vm_nphysseg; i < vm_nphysseg; i++, ps++) - ps[0] = ps[1]; + for (--vm_nphysseg; i < vm_nphysseg; i++) + VM_PHYSMEM_PTR_SWAP(i, i + 1); } memset((void *)rpv->pv_va, 0, rpv->pv_size); return; Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.696 src/sys/arch/i386/i386/machdep.c:1.697 --- src/sys/arch/i386/i386/machdep.c:1.696 Sun Oct 24 07:53:04 2010 +++ src/sys/arch/i386/i386/machdep.c Wed Nov 10 09:27:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.696 2010/10/24 07:53:04 jruoho Exp $ */ +/* $NetBSD: machdep.c,v 1.697 2010/11/10 09:27:22 uebayasi 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.696 2010/10/24 07:53:04 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.697 2010/11/10 09:27:22 uebayasi Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -1189,7 +1189,7 @@ search_again: vps = NULL; for (x = 0; x < vm_nphysseg; ++x) { - vps = &vm_physmem[x]; + vps = VM_PHYSMEM_PTR(x); if (ctob(vps->avail_end) == avail_end) { break; } @@ -1209,13 +1209,13 @@ /* Remove the last segment if it now has no pages. */ if (vps->start == vps->end) { for (--vm_nphysseg; x < vm_nphysseg; x++) - vm_physmem[x] = vm_physmem[x + 1]; + VM_PHYSMEM_PTR_SWAP(x, x + 1); } /* Now find where the new avail_end is. */ for (avail_end = 0, x = 0; x < vm_nphysseg; x++) - if (vm_physmem[x].avail_end > avail_end) - avail_end = vm_physmem[x].avail_end; + if (VM_PHYSMEM_PTR(x)->avail_end > avail_end) + avail_end = VM_PHYSMEM_PTR(x)->avail_end; avail_end = ctob(avail_end); if (sz == reqsz) Index: src/sys/arch/ia64/ia64/machdep.c diff -u src/sys/arch/ia64/ia64/machdep.c:1.24 src/sys/arch/ia64/ia64/machdep.c:1.25 --- src/sys/arch/ia64/ia64/machdep.c:1.24 Mon Jun 28 12:08:13 2010 +++ src/sys/arch/ia64/ia64/machdep.c Wed Nov 10 09:27:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.24 2010/06/28 12:08:13 kiyohara Exp $ */ +/* $NetBSD: machdep.c,v 1.25 2010/11/10 09:27:22 uebayasi Exp $ */ /*- * Copyright (c) 2003,2004 Marcel Moolenaar @@ -180,14 +180,14 @@ printf("Physical memory chunk(s):\n"); for (lcv = 0; - lcv < vm_nphysseg || vm_physmem[lcv].avail_end != 0; + lcv < vm_nphysseg || VM_PHYSMEM_PTR(lcv)->avail_end != 0; lcv++) { - sizetmp = vm_physmem[lcv].avail_end - - vm_physmem[lcv].avail_start; + sizetmp = VM_PHYSMEM_PTR(lcv)->avail_end - + VM_PHYSMEM_PTR(lcv)->avail_start; printf("0x%016lx - 0x%016lx, %ld bytes (%d pages)\n", - ptoa(vm_physmem[lcv].avail_start), - ptoa(vm_physmem[lcv].avail_end) - 1, + ptoa(VM_PHYSMEM_PTR(lcv)->avail_start), + ptoa(VM_PHYSMEM_PTR(lcv)->avail_end) - 1, ptoa(sizetmp), sizetmp); } printf("Total number of segments: vm_nphysseg = %d \n", Index: src/sys/arch/ia64/ia64/pmap.c diff -u src/sys/arch/ia64/ia64/pmap.c:1.25 src/sys/arch/ia64/ia64/pmap.c:1.26 --- src/sys/arch/ia64/ia64/pmap.c:1.25 Sat Oct 30 17:27:17 2010 +++ src/sys/arch/ia64/ia64/pmap.c Wed Nov 10 09:27:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.25 2010/10/30 17:27:17 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.26 2010/11/10 09:27:22 uebayasi Exp $ */ /*- @@ -85,7 +85,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.25 2010/10/30 17:27:17 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.26 2010/11/10 09:27:22 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -338,35 +338,35 @@ #if 0 printf(" bank %d: avail_start 0x%lx, start 0x%lx, " - "avail_end 0x%lx\n", lcv, vm_physmem[lcv].avail_start, - vm_physmem[lcv].start, vm_physmem[lcv].avail_end); + "avail_end 0x%lx\n", lcv, VM_PHYSMEM_PTR(lcv)->avail_start, + VM_PHYSMEM_PTR(lcv)->start, VM_PHYSMEM_PTR(lcv)->avail_end); #endif - if (vm_physmem[lcv].avail_start != vm_physmem[lcv].start || - vm_physmem[lcv].avail_start >= vm_physmem[lcv].avail_end) + if (VM_PHYSMEM_PTR(lcv)->avail_start != VM_PHYSMEM_PTR(lcv)->start || + VM_PHYSMEM_PTR(lcv)->avail_start >= VM_PHYSMEM_PTR(lcv)->avail_end) continue; #if 0 printf(" avail_end - avail_start = 0x%lx\n", - vm_physmem[lcv].avail_end - vm_physmem[lcv].avail_start); + VM_PHYSMEM_PTR(lcv)->avail_end - VM_PHYSMEM_PTR(lcv)->avail_start); #endif - if ((vm_physmem[lcv].avail_end - vm_physmem[lcv].avail_start) + if ((VM_PHYSMEM_PTR(lcv)->avail_end - VM_PHYSMEM_PTR(lcv)->avail_start) < npgs) continue; /* * There are enough pages here; steal them! */ - pa = ptoa(vm_physmem[lcv].avail_start); - vm_physmem[lcv].avail_start += npgs; - vm_physmem[lcv].start += npgs; + pa = ptoa(VM_PHYSMEM_PTR(lcv)->avail_start); + VM_PHYSMEM_PTR(lcv)->avail_start += npgs; + VM_PHYSMEM_PTR(lcv)->start += npgs; /* * Have we used up this segment? */ - if (vm_physmem[lcv].avail_start == vm_physmem[lcv].end) { + if (VM_PHYSMEM_PTR(lcv)->avail_start == VM_PHYSMEM_PTR(lcv)->end) { if (vm_nphysseg == 1) panic("pmap_steal_memory: out of memory!"); @@ -374,7 +374,7 @@ vm_nphysseg--; for (x = lcv; x < vm_nphysseg; x++) { /* structure copy */ - vm_physmem[x] = vm_physmem[x + 1]; + VM_PHYSMEM_PTR_SWAP(x, x + 1); } } @@ -421,25 +421,25 @@ #if 1 printf(" lcv %d: avail_start 0x%lx, start 0x%lx, " - "avail_end 0x%lx\n", lcv, vm_physmem[lcv].avail_start, - vm_physmem[lcv].start, vm_physmem[lcv].avail_end); + "avail_end 0x%lx\n", lcv, VM_PHYSMEM_PTR(lcv)->avail_start, + VM_PHYSMEM_PTR(lcv)->start, VM_PHYSMEM_PTR(lcv)->avail_end); printf(" avail_end - avail_start = 0x%lx\n", - vm_physmem[lcv].avail_end - vm_physmem[lcv].avail_start); + VM_PHYSMEM_PTR(lcv)->avail_end - VM_PHYSMEM_PTR(lcv)->avail_start); #endif - if (vm_physmem[lcv].avail_start != vm_physmem[lcv].start || /* XXX: ??? */ - vm_physmem[lcv].avail_start >= vm_physmem[lcv].avail_end) + if (VM_PHYSMEM_PTR(lcv)->avail_start != VM_PHYSMEM_PTR(lcv)->start || /* XXX: ??? */ + VM_PHYSMEM_PTR(lcv)->avail_start >= VM_PHYSMEM_PTR(lcv)->avail_end) continue; /* Break off a VHPT sized, aligned chunk off this segment. */ - start1 = vm_physmem[lcv].avail_start; + start1 = VM_PHYSMEM_PTR(lcv)->avail_start; /* Align requested start address on requested size boundary */ end1 = vhpt_start = roundup(start1, npgs); start2 = vhpt_start + npgs; - end2 = vm_physmem[lcv].avail_end; + end2 = VM_PHYSMEM_PTR(lcv)->avail_end; /* Case 1: Doesn't fit. skip this segment */ @@ -471,7 +471,7 @@ // physmem -= end2 - start1; for (x = lcv; x < vm_nphysseg; x++) { /* structure copy */ - vm_physmem[x] = vm_physmem[x + 1]; + VM_PHYSMEM_PTR_SWAP(x, x + 1); } /* Case 2: Perfect fit - skip segment reload. */ Index: src/sys/arch/m68k/m68k/pmap_motorola.c diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.56 src/sys/arch/m68k/m68k/pmap_motorola.c:1.57 --- src/sys/arch/m68k/m68k/pmap_motorola.c:1.56 Sun Jun 6 04:50:07 2010 +++ src/sys/arch/m68k/m68k/pmap_motorola.c Wed Nov 10 09:27:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_motorola.c,v 1.56 2010/06/06 04:50:07 mrg Exp $ */ +/* $NetBSD: pmap_motorola.c,v 1.57 2010/11/10 09:27:22 uebayasi Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -119,7 +119,7 @@ #include "opt_m68k_arch.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.56 2010/06/06 04:50:07 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.57 2010/11/10 09:27:22 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -293,7 +293,7 @@ int bank, pg = 0; /* XXX gcc4 -Wuninitialized */ bank = vm_physseg_find(atop((pa)), &pg); - return &vm_physmem[bank].pmseg.pvheader[pg]; + return &VM_PHYSMEM_PTR(bank)->pmseg.pvheader[pg]; } /* @@ -431,7 +431,7 @@ * initial segment table, pv_head_table and pmap_attributes. */ for (page_cnt = 0, bank = 0; bank < vm_nphysseg; bank++) - page_cnt += vm_physmem[bank].end - vm_physmem[bank].start; + page_cnt += VM_PHYSMEM_PTR(bank)->end - VM_PHYSMEM_PTR(bank)->start; s = M68K_STSIZE; /* Segtabzero */ s += page_cnt * sizeof(struct pv_header); /* pv table */ s = round_page(s); @@ -458,8 +458,8 @@ */ pvh = pv_table; for (bank = 0; bank < vm_nphysseg; bank++) { - npages = vm_physmem[bank].end - vm_physmem[bank].start; - vm_physmem[bank].pmseg.pvheader = pvh; + npages = VM_PHYSMEM_PTR(bank)->end - VM_PHYSMEM_PTR(bank)->start; + VM_PHYSMEM_PTR(bank)->pmseg.pvheader = pvh; pvh += npages; } @@ -1844,8 +1844,8 @@ s = splvm(); for (bank = 0; bank < vm_nphysseg; bank++) { - pmap_collect1(pmap_kernel(), ptoa(vm_physmem[bank].start), - ptoa(vm_physmem[bank].end)); + pmap_collect1(pmap_kernel(), ptoa(VM_PHYSMEM_PTR(bank)->start), + ptoa(VM_PHYSMEM_PTR(bank)->end)); } splx(s); Index: src/sys/arch/mips/mips/mips_machdep.c diff -u src/sys/arch/mips/mips/mips_machdep.c:1.227 src/sys/arch/mips/mips/mips_machdep.c:1.228 --- src/sys/arch/mips/mips/mips_machdep.c:1.227 Sat Nov 6 11:46:01 2010 +++ src/sys/arch/mips/mips/mips_machdep.c Wed Nov 10 09:27:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mips_machdep.c,v 1.227 2010/11/06 11:46:01 uebayasi Exp $ */ +/* $NetBSD: mips_machdep.c,v 1.228 2010/11/10 09:27:23 uebayasi Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -112,7 +112,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.227 2010/11/06 11:46:01 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.228 2010/11/10 09:27:23 uebayasi Exp $"); #include "opt_cputype.h" #include "opt_compat_netbsd32.h" @@ -1615,7 +1615,7 @@ vsize_t reqsz = sz; struct vm_physseg *vps; - vps = &vm_physmem[vm_nphysseg - 1]; + vps = VM_PHYSMEM_PTR(vm_nphysseg - 1); /* shrink so that it'll fit in the last segment */ if ((vps->avail_end - vps->avail_start) < atop(sz)) Index: src/sys/arch/mips/mips/pmap.c diff -u src/sys/arch/mips/mips/pmap.c:1.190 src/sys/arch/mips/mips/pmap.c:1.191 --- src/sys/arch/mips/mips/pmap.c:1.190 Sat Oct 30 17:44:04 2010 +++ src/sys/arch/mips/mips/pmap.c Wed Nov 10 09:27:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.190 2010/10/30 17:44:04 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.191 2010/11/10 09:27:23 uebayasi Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.190 2010/10/30 17:44:04 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.191 2010/11/10 09:27:23 uebayasi Exp $"); /* * Manages physical address maps. @@ -342,8 +342,8 @@ * for us. Must do this before uvm_pageboot_alloc() * can be called. */ - avail_start = ptoa(vm_physmem[0].start); - avail_end = ptoa(vm_physmem[vm_nphysseg - 1].end); + avail_start = ptoa(VM_PHYSMEM_PTR(0)->start); + avail_end = ptoa(VM_PHYSMEM_PTR(vm_nphysseg - 1)->end); virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG; /* @@ -451,25 +451,25 @@ if (uvm.page_init_done == true) panic("pmap_steal_memory: called _after_ bootstrap"); - if (vm_physmem[bank].avail_start != vm_physmem[bank].start || - vm_physmem[bank].avail_start >= vm_physmem[bank].avail_end) + if (VM_PHYSMEM_PTR(bank)->avail_start != VM_PHYSMEM_PTR(bank)->start || + VM_PHYSMEM_PTR(bank)->avail_start >= VM_PHYSMEM_PTR(bank)->avail_end) continue; - if ((vm_physmem[bank].avail_end - vm_physmem[bank].avail_start) + if ((VM_PHYSMEM_PTR(bank)->avail_end - VM_PHYSMEM_PTR(bank)->avail_start) < npgs) continue; /* * There are enough pages here; steal them! */ - pa = ptoa(vm_physmem[bank].avail_start); - vm_physmem[bank].avail_start += npgs; - vm_physmem[bank].start += npgs; + pa = ptoa(VM_PHYSMEM_PTR(bank)->avail_start); + VM_PHYSMEM_PTR(bank)->avail_start += npgs; + VM_PHYSMEM_PTR(bank)->start += npgs; /* * Have we used up this segment? */ - if (vm_physmem[bank].avail_start == vm_physmem[bank].end) { + if (VM_PHYSMEM_PTR(bank)->avail_start == VM_PHYSMEM_PTR(bank)->end) { if (vm_nphysseg == 1) panic("pmap_steal_memory: out of memory!"); @@ -477,7 +477,7 @@ vm_nphysseg--; for (x = bank; x < vm_nphysseg; x++) { /* structure copy */ - vm_physmem[x] = vm_physmem[x + 1]; + VM_PHYSMEM_PTR_SWAP(x, x + 1); } } @@ -524,9 +524,9 @@ */ pv = pv_table; for (bank = 0; bank < vm_nphysseg; bank++) { - s = vm_physmem[bank].end - vm_physmem[bank].start; + s = VM_PHYSMEM_PTR(bank)->end - VM_PHYSMEM_PTR(bank)->start; for (i = 0; i < s; i++) - VM_PAGE_TO_MD(&vm_physmem[bank].pgs[i])->pvh_list = pv++; + VM_PAGE_TO_MD(&VM_PHYSMEM_PTR(bank)->pgs[i])->pvh_list = pv++; } /* Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.63 src/sys/arch/powerpc/ibm4xx/pmap.c:1.64 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.63 Sat Nov 6 16:36:26 2010 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Wed Nov 10 09:27:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.63 2010/11/06 16:36:26 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.64 2010/11/10 09:27:23 uebayasi Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.63 2010/11/06 16:36:26 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.64 2010/11/10 09:27:23 uebayasi Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -195,7 +195,7 @@ bank = vm_physseg_find(atop(pa), &pg); if (bank == -1) return NULL; - return &vm_physmem[bank].pmseg.pvent[pg]; + return &VM_PHYSMEM_PTR(bank)->pmseg.pvent[pg]; } static inline char * @@ -206,7 +206,7 @@ bank = vm_physseg_find(atop(pa), &pg); if (bank == -1) return NULL; - return &vm_physmem[bank].pmseg.attrs[pg]; + return &VM_PHYSMEM_PTR(bank)->pmseg.attrs[pg]; } /* @@ -472,9 +472,9 @@ pv = pv_table; attr = pmap_attrib; for (bank = 0; bank < vm_nphysseg; bank++) { - sz = vm_physmem[bank].end - vm_physmem[bank].start; - vm_physmem[bank].pmseg.pvent = pv; - vm_physmem[bank].pmseg.attrs = attr; + sz = VM_PHYSMEM_PTR(bank)->end - VM_PHYSMEM_PTR(bank)->start; + VM_PHYSMEM_PTR(bank)->pmseg.pvent = pv; + VM_PHYSMEM_PTR(bank)->pmseg.attrs = attr; pv += sz; attr += sz; } Index: src/sys/arch/powerpc/isa/isadma_machdep.c diff -u src/sys/arch/powerpc/isa/isadma_machdep.c:1.5 src/sys/arch/powerpc/isa/isadma_machdep.c:1.6 --- src/sys/arch/powerpc/isa/isadma_machdep.c:1.5 Mon Apr 28 20:23:32 2008 +++ src/sys/arch/powerpc/isa/isadma_machdep.c Wed Nov 10 09:27:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: isadma_machdep.c,v 1.5 2008/04/28 20:23:32 martin Exp $ */ +/* $NetBSD: isadma_machdep.c,v 1.6 2010/11/10 09:27:23 uebayasi Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: isadma_machdep.c,v 1.5 2008/04/28 20:23:32 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isadma_machdep.c,v 1.6 2010/11/10 09:27:23 uebayasi Exp $"); #define ISA_DMA_STATS @@ -169,8 +169,8 @@ paddr_t avail_end = 0; for (bank = 0; bank < vm_nphysseg; bank++) { - if (avail_end < vm_physmem[bank].avail_end << PGSHIFT) - avail_end = vm_physmem[bank].avail_end << PGSHIFT; + if (avail_end < VM_PHYSMEM_PTR(bank)->avail_end << PGSHIFT) + avail_end = VM_PHYSMEM_PTR(bank)->avail_end << PGSHIFT; } /* Call common function to create the basic map. */ @@ -597,8 +597,8 @@ int bank; for (bank = 0; bank < vm_nphysseg; bank++) { - if (avail_end < vm_physmem[bank].avail_end << PGSHIFT) - avail_end = vm_physmem[bank].avail_end << PGSHIFT; + if (avail_end < VM_PHYSMEM_PTR(bank)->avail_end << PGSHIFT) + avail_end = VM_PHYSMEM_PTR(bank)->avail_end << PGSHIFT; } if (avail_end > ISA_DMA_BOUNCE_THRESHOLD) Index: src/sys/arch/powerpc/oea/pmap.c diff -u src/sys/arch/powerpc/oea/pmap.c:1.72 src/sys/arch/powerpc/oea/pmap.c:1.73 --- src/sys/arch/powerpc/oea/pmap.c:1.72 Sat Oct 30 18:08:48 2010 +++ src/sys/arch/powerpc/oea/pmap.c Wed Nov 10 09:27:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.72 2010/10/30 18:08:48 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.73 2010/11/10 09:27:23 uebayasi Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.72 2010/10/30 18:08:48 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.73 2010/11/10 09:27:23 uebayasi Exp $"); #define PMAP_NOOPNAMES @@ -2925,7 +2925,8 @@ * PA 0 will never be among those given to UVM so we can use it * to indicate we couldn't steal any memory. */ - for (ps = vm_physmem, bank = 0; bank < vm_nphysseg; bank++, ps++) { + for (bank = 0; bank < vm_nphysseg; bank++) { + ps = VM_PHYSMEM_PTR(bank); if (ps->free_list == VM_FREELIST_FIRST256 && ps->avail_end - ps->avail_start >= npgs) { pa = ptoa(ps->avail_start); @@ -2962,8 +2963,10 @@ #ifdef DEBUG if (pmapdebug && npgs > 1) { u_int cnt = 0; - for (bank = 0, ps = vm_physmem; bank < vm_nphysseg; bank++, ps++) + for (bank = 0; bank < vm_nphysseg; bank++) { + ps = VM_PHYSMEM_PTR(bank); cnt += ps->avail_end - ps->avail_start; + } printf("pmap_steal_memory: stole %u (total %u) pages (%u left)\n", npgs, pmap_pages_stolen, cnt); } @@ -3440,12 +3443,12 @@ int bank; char pbuf[9]; for (cnt = 0, bank = 0; bank < vm_nphysseg; bank++) { - cnt += vm_physmem[bank].avail_end - vm_physmem[bank].avail_start; + cnt += VM_PHYSMEM_PTR(bank)->avail_end - VM_PHYSMEM_PTR(bank)->avail_start; printf("pmap_bootstrap: vm_physmem[%d]=%#" _PRIxpa "-%#" _PRIxpa "/%#" _PRIxpa "\n", bank, - ptoa(vm_physmem[bank].avail_start), - ptoa(vm_physmem[bank].avail_end), - ptoa(vm_physmem[bank].avail_end - vm_physmem[bank].avail_start)); + ptoa(VM_PHYSMEM_PTR(bank)->avail_start), + ptoa(VM_PHYSMEM_PTR(bank)->avail_end), + ptoa(VM_PHYSMEM_PTR(bank)->avail_end - VM_PHYSMEM_PTR(bank)->avail_start)); } format_bytes(pbuf, sizeof(pbuf), ptoa((u_int64_t) cnt)); printf("pmap_bootstrap: UVM memory = %s (%u pages)\n", @@ -3480,8 +3483,8 @@ pm->pm_sr[0] = sr; for (bank = 0; bank < vm_nphysseg; bank++) { - pa_end = ptoa(vm_physmem[bank].avail_end); - pa = ptoa(vm_physmem[bank].avail_start); + pa_end = ptoa(VM_PHYSMEM_PTR(bank)->avail_end); + pa = ptoa(VM_PHYSMEM_PTR(bank)->avail_start); for (; pa < pa_end; pa += PAGE_SIZE) { ptegidx = va_to_pteg(pm, pa); pmap_pte_create(&pt, pm, pa, pa | PTE_M|PTE_BW); Index: src/sys/arch/powerpc/powerpc/bus_dma.c diff -u src/sys/arch/powerpc/powerpc/bus_dma.c:1.36 src/sys/arch/powerpc/powerpc/bus_dma.c:1.37 --- src/sys/arch/powerpc/powerpc/bus_dma.c:1.36 Sat Nov 6 11:46:01 2010 +++ src/sys/arch/powerpc/powerpc/bus_dma.c Wed Nov 10 09:27:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.36 2010/11/06 11:46:01 uebayasi Exp $ */ +/* $NetBSD: bus_dma.c,v 1.37 2010/11/10 09:27:24 uebayasi Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.36 2010/11/06 11:46:01 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.37 2010/11/10 09:27:24 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -532,10 +532,10 @@ int bank; for (bank = 0; bank < vm_nphysseg; bank++) { - if (avail_start > vm_physmem[bank].avail_start << PGSHIFT) - avail_start = vm_physmem[bank].avail_start << PGSHIFT; - if (avail_end < vm_physmem[bank].avail_end << PGSHIFT) - avail_end = vm_physmem[bank].avail_end << PGSHIFT; + if (avail_start > VM_PHYSMEM_PTR(bank)->avail_start << PGSHIFT) + avail_start = VM_PHYSMEM_PTR(bank)->avail_start << PGSHIFT; + if (avail_end < VM_PHYSMEM_PTR(bank)->avail_end << PGSHIFT) + avail_end = VM_PHYSMEM_PTR(bank)->avail_end << PGSHIFT; } return _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, Index: src/sys/arch/sh3/sh3/mem.c diff -u src/sys/arch/sh3/sh3/mem.c:1.27 src/sys/arch/sh3/sh3/mem.c:1.28 --- src/sys/arch/sh3/sh3/mem.c:1.27 Sat Nov 6 11:46:02 2010 +++ src/sys/arch/sh3/sh3/mem.c Wed Nov 10 09:27:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.27 2010/11/06 11:46:02 uebayasi Exp $ */ +/* $NetBSD: mem.c,v 1.28 2010/11/10 09:27:24 uebayasi Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -80,7 +80,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.27 2010/11/06 11:46:02 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.28 2010/11/10 09:27:24 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -207,6 +207,6 @@ __mm_mem_addr(paddr_t pa) { - return ((atop(pa) < vm_physmem[0].start || PHYS_TO_VM_PAGE(pa) != NULL) + return ((atop(pa) < VM_PHYSMEM_PTR(0)->start || PHYS_TO_VM_PAGE(pa) != NULL) ? true : false); } Index: src/sys/arch/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.75 src/sys/arch/sh3/sh3/pmap.c:1.76 --- src/sys/arch/sh3/sh3/pmap.c:1.75 Sat Oct 30 18:15:04 2010 +++ src/sys/arch/sh3/sh3/pmap.c Wed Nov 10 09:27:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.75 2010/10/30 18:15:04 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.76 2010/11/10 09:27:24 uebayasi Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.75 2010/10/30 18:15:04 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.76 2010/11/10 09:27:24 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -109,8 +109,8 @@ /* Steal msgbuf area */ initmsgbuf((void *)uvm_pageboot_alloc(MSGBUFSIZE), MSGBUFSIZE); - avail_start = ptoa(vm_physmem[0].start); - avail_end = ptoa(vm_physmem[vm_nphysseg - 1].end); + avail_start = ptoa(VM_PHYSMEM_PTR(0)->start); + avail_end = ptoa(VM_PHYSMEM_PTR(vm_nphysseg - 1)->end); __pmap_kve = VM_MIN_KERNEL_ADDRESS; pmap_kernel()->pm_refcnt = 1; @@ -138,10 +138,14 @@ size = round_page(size); npage = atop(size); - for (i = 0, bank = &vm_physmem[i]; i < vm_nphysseg; i++, bank++) + bank = NULL; + for (i = 0; i < vm_nphysseg; i++) { + bank = VM_PHYSMEM_PTR(i); if (npage <= bank->avail_end - bank->avail_start) break; + } KDASSERT(i != vm_nphysseg); + KDASSERT(bank != NULL); /* Steal pages */ pa = ptoa(bank->avail_start); @@ -154,7 +158,7 @@ vm_nphysseg--; KDASSERT(vm_nphysseg > 0); for (j = i; i < vm_nphysseg; j++) - vm_physmem[j] = vm_physmem[j + 1]; + VM_PHYSMEM_PTR_SWAP(j, j + 1); } va = SH3_PHYS_TO_P1SEG(pa); Index: src/sys/arch/vax/vax/pmap.c diff -u src/sys/arch/vax/vax/pmap.c:1.177 src/sys/arch/vax/vax/pmap.c:1.178 --- src/sys/arch/vax/vax/pmap.c:1.177 Sat Nov 6 11:46:03 2010 +++ src/sys/arch/vax/vax/pmap.c Wed Nov 10 09:27:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.177 2010/11/06 11:46:03 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.178 2010/11/10 09:27:24 uebayasi Exp $ */ /* * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.177 2010/11/06 11:46:03 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.178 2010/11/10 09:27:24 uebayasi Exp $"); #include "opt_ddb.h" #include "opt_cputype.h" @@ -467,9 +467,9 @@ * A vax only have one segment of memory. */ - v = (vm_physmem[0].avail_start << PGSHIFT) | KERNBASE; - vm_physmem[0].avail_start += npgs; - vm_physmem[0].start += npgs; + v = (VM_PHYSMEM_PTR(0)->avail_start << PGSHIFT) | KERNBASE; + VM_PHYSMEM_PTR(0)->avail_start += npgs; + VM_PHYSMEM_PTR(0)->start += npgs; memset((void *)v, 0, size); return v; } Index: src/sys/arch/x68k/x68k/machdep.c diff -u src/sys/arch/x68k/x68k/machdep.c:1.167 src/sys/arch/x68k/x68k/machdep.c:1.168 --- src/sys/arch/x68k/x68k/machdep.c:1.167 Sat Oct 16 17:10:44 2010 +++ src/sys/arch/x68k/x68k/machdep.c Wed Nov 10 09:27:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.167 2010/10/16 17:10:44 tsutsui Exp $ */ +/* $NetBSD: machdep.c,v 1.168 2010/11/10 09:27:24 uebayasi Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.167 2010/10/16 17:10:44 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.168 2010/11/10 09:27:24 uebayasi Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -582,9 +582,9 @@ m->ram_segs[0].start = lowram; m->ram_segs[0].size = mem_size - lowram; for (i = 1; i < vm_nphysseg; i++) { - m->ram_segs[i].start = ctob(vm_physmem[i].start); - m->ram_segs[i].size = ctob(vm_physmem[i].end - - vm_physmem[i].start); + m->ram_segs[i].start = ctob(VM_PHYSMEM_PTR(i)->start); + m->ram_segs[i].size = ctob(VM_PHYSMEM_PTR(i)->end + - VM_PHYSMEM_PTR(i)->start); } } Index: src/sys/arch/x68k/x68k/mem.c diff -u src/sys/arch/x68k/x68k/mem.c:1.36 src/sys/arch/x68k/x68k/mem.c:1.37 --- src/sys/arch/x68k/x68k/mem.c:1.36 Mon Mar 5 12:30:38 2007 +++ src/sys/arch/x68k/x68k/mem.c Wed Nov 10 09:27:24 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.36 2007/03/05 12:30:38 tsutsui Exp $ */ +/* $NetBSD: mem.c,v 1.37 2010/11/10 09:27:24 uebayasi Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.36 2007/03/05 12:30:38 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.37 2010/11/10 09:27:24 uebayasi Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -244,8 +244,8 @@ int i; for (i = 0; i < vm_nphysseg; i++) { - if (ctob(vm_physmem[i].start) <= addr && - addr < ctob(vm_physmem[i].end)) + if (ctob(VM_PHYSMEM_PTR(i)->start) <= addr && + addr < ctob(VM_PHYSMEM_PTR(i)->end)) return 1; } return 0; Index: src/sys/uvm/uvm_page.h diff -u src/sys/uvm/uvm_page.h:1.62 src/sys/uvm/uvm_page.h:1.63 --- src/sys/uvm/uvm_page.h:1.62 Wed Nov 10 01:24:46 2010 +++ src/sys/uvm/uvm_page.h Wed Nov 10 09:27:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.h,v 1.62 2010/11/10 01:24:46 uebayasi Exp $ */ +/* $NetBSD: uvm_page.h,v 1.63 2010/11/10 09:27:21 uebayasi Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -256,7 +256,8 @@ */ #define VM_PHYSMEM_PTR(i) (&vm_physmem[i]) -#define VM_PHYSDEV_PTR(i) (&vm_physdev[i]) /* XXX not yet */ +#define VM_PHYSMEM_PTR_SWAP(i, j) \ + do { vm_physmem[(i)] = vm_physmem[(j)]; } while (0) extern struct vm_physseg vm_physmem[VM_PHYSSEG_MAX]; extern int vm_nphysseg;