Module Name: src Committed By: uebayasi Date: Wed Nov 10 08:59:14 UTC 2010
Modified Files: src/sys/arch/alpha/alpha [uebayasi-xip]: pmap.c src/sys/arch/amd64/amd64 [uebayasi-xip]: machdep.c src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c src/sys/arch/i386/i386 [uebayasi-xip]: machdep.c src/sys/arch/ia64/ia64 [uebayasi-xip]: pmap.c src/sys/arch/mips/mips [uebayasi-xip]: pmap.c src/sys/arch/sh3/sh3 [uebayasi-xip]: pmap.c src/sys/uvm [uebayasi-xip]: uvm_page.h Log Message: Fix thinko; make vm_physseg ptr swap really work. To generate a diff of this commit: cvs rdiff -u -r1.252.2.8 -r1.252.2.9 src/sys/arch/alpha/alpha/pmap.c cvs rdiff -u -r1.141.2.6 -r1.141.2.7 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.211.2.21 -r1.211.2.22 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.681.2.6 -r1.681.2.7 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.24.2.7 -r1.24.2.8 src/sys/arch/ia64/ia64/pmap.c cvs rdiff -u -r1.188.2.10 -r1.188.2.11 src/sys/arch/mips/mips/pmap.c cvs rdiff -u -r1.74.2.7 -r1.74.2.8 src/sys/arch/sh3/sh3/pmap.c cvs rdiff -u -r1.59.2.33 -r1.59.2.34 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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.252.2.8 src/sys/arch/alpha/alpha/pmap.c:1.252.2.9 --- src/sys/arch/alpha/alpha/pmap.c:1.252.2.8 Wed Nov 10 08:04:59 2010 +++ src/sys/arch/alpha/alpha/pmap.c Wed Nov 10 08:59:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.252.2.8 2010/11/10 08:04:59 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.252.2.9 2010/11/10 08:59:12 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.252.2.8 2010/11/10 08:04:59 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.252.2.9 2010/11/10 08:59:12 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1063,7 +1063,7 @@ vm_nphysseg--; for (x = bank; x < vm_nphysseg; x++) { /* structure copy */ - *VM_PHYSMEM_PTR(x) = *VM_PHYSMEM_PTR(x + 1); + VM_PHYSMEM_PTR_SWAP(x, x + 1); } } Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.141.2.6 src/sys/arch/amd64/amd64/machdep.c:1.141.2.7 --- src/sys/arch/amd64/amd64/machdep.c:1.141.2.6 Wed Nov 10 03:36:26 2010 +++ src/sys/arch/amd64/amd64/machdep.c Wed Nov 10 08:59:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.141.2.6 2010/11/10 03:36:26 uebayasi Exp $ */ +/* $NetBSD: machdep.c,v 1.141.2.7 2010/11/10 08:59:12 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.141.2.6 2010/11/10 03:36:26 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.141.2.7 2010/11/10 08:59:12 uebayasi Exp $"); /* #define XENDEBUG_LOW */ @@ -1182,7 +1182,7 @@ /* Remove the last segment if it now has no pages. */ if (vps->start == vps->end) { for (vm_nphysseg--; x < vm_nphysseg; x++) - *VM_PHYSMEM_PTR(x) = *VM_PHYSMEM_PTR(x + 1); + VM_PHYSMEM_PTR_SWAP(x, x + 1); } /* Now find where the new avail_end is. */ Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.21 src/sys/arch/arm/arm32/pmap.c:1.211.2.22 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.21 Wed Nov 10 08:04:59 2010 +++ src/sys/arch/arm/arm32/pmap.c Wed Nov 10 08:59:13 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.21 2010/11/10 08:04:59 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.22 2010/11/10 08:59:13 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.211.2.21 2010/11/10 08:04:59 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.211.2.22 2010/11/10 08:59:13 uebayasi Exp $"); #define VM_PAGE_TO_MD(pg) (&(pg)->mdpage) @@ -6666,8 +6666,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.681.2.6 src/sys/arch/i386/i386/machdep.c:1.681.2.7 --- src/sys/arch/i386/i386/machdep.c:1.681.2.6 Wed Nov 10 03:36:27 2010 +++ src/sys/arch/i386/i386/machdep.c Wed Nov 10 08:59:13 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.681.2.6 2010/11/10 03:36:27 uebayasi Exp $ */ +/* $NetBSD: machdep.c,v 1.681.2.7 2010/11/10 08:59:13 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.681.2.6 2010/11/10 03:36:27 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.681.2.7 2010/11/10 08:59:13 uebayasi Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -1209,7 +1209,7 @@ /* Remove the last segment if it now has no pages. */ if (vps->start == vps->end) { for (--vm_nphysseg; x < vm_nphysseg; x++) - *VM_PHYSMEM_PTR(x) = *VM_PHYSMEM_PTR(x + 1); + VM_PHYSMEM_PTR_SWAP(x, x + 1); } /* Now find where the new avail_end is. */ Index: src/sys/arch/ia64/ia64/pmap.c diff -u src/sys/arch/ia64/ia64/pmap.c:1.24.2.7 src/sys/arch/ia64/ia64/pmap.c:1.24.2.8 --- src/sys/arch/ia64/ia64/pmap.c:1.24.2.7 Wed Nov 10 08:37:45 2010 +++ src/sys/arch/ia64/ia64/pmap.c Wed Nov 10 08:59:13 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.24.2.7 2010/11/10 08:37:45 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.24.2.8 2010/11/10 08:59:13 uebayasi Exp $ */ /*- @@ -85,7 +85,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.24.2.7 2010/11/10 08:37:45 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.24.2.8 2010/11/10 08:59:13 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -374,7 +374,7 @@ vm_nphysseg--; for (x = lcv; x < vm_nphysseg; x++) { /* structure copy */ - *VM_PHYSMEM_PTR(x) = *VM_PHYSMEM_PTR(x + 1); + VM_PHYSMEM_PTR_SWAP(x, x + 1); } } @@ -471,7 +471,7 @@ // physmem -= end2 - start1; for (x = lcv; x < vm_nphysseg; x++) { /* structure copy */ - vm_physmem_ptrs[x] = vm_physmem_ptrs[x + 1]; + VM_PHYSMEM_PTR_SWAP(x, x + 1); } /* Case 2: Perfect fit - skip segment reload. */ Index: src/sys/arch/mips/mips/pmap.c diff -u src/sys/arch/mips/mips/pmap.c:1.188.2.10 src/sys/arch/mips/mips/pmap.c:1.188.2.11 --- src/sys/arch/mips/mips/pmap.c:1.188.2.10 Wed Nov 10 03:36:28 2010 +++ src/sys/arch/mips/mips/pmap.c Wed Nov 10 08:59:13 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.188.2.10 2010/11/10 03:36:28 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.188.2.11 2010/11/10 08:59:13 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.188.2.10 2010/11/10 03:36:28 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.188.2.11 2010/11/10 08:59:13 uebayasi Exp $"); /* * Manages physical address maps. @@ -478,7 +478,7 @@ vm_nphysseg--; for (x = bank; x < vm_nphysseg; x++) { /* structure copy */ - *VM_PHYSMEM_PTR(x) = VM_PHYSMEM_PTR(x + 1); + VM_PHYSMEM_PTR_SWAP(x, x + 1); } } Index: src/sys/arch/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.74.2.7 src/sys/arch/sh3/sh3/pmap.c:1.74.2.8 --- src/sys/arch/sh3/sh3/pmap.c:1.74.2.7 Wed Nov 10 03:36:28 2010 +++ src/sys/arch/sh3/sh3/pmap.c Wed Nov 10 08:59:14 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.74.2.7 2010/11/10 03:36:28 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.74.2.8 2010/11/10 08:59:14 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.74.2.7 2010/11/10 03:36:28 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74.2.8 2010/11/10 08:59:14 uebayasi Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -138,10 +138,14 @@ size = round_page(size); npage = atop(size); - for (i = 0, bank = VM_PHYSMEM_PTR(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_PTR(j) = *VM_PHYSMEM_PTR(j + 1); + VM_PHYSMEM_PTR_SWAP(j, j + 1); } va = SH3_PHYS_TO_P1SEG(pa); Index: src/sys/uvm/uvm_page.h diff -u src/sys/uvm/uvm_page.h:1.59.2.33 src/sys/uvm/uvm_page.h:1.59.2.34 --- src/sys/uvm/uvm_page.h:1.59.2.33 Thu Nov 4 08:47:38 2010 +++ src/sys/uvm/uvm_page.h Wed Nov 10 08:59:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.h,v 1.59.2.33 2010/11/04 08:47:38 uebayasi Exp $ */ +/* $NetBSD: uvm_page.h,v 1.59.2.34 2010/11/10 08:59:12 uebayasi Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -265,7 +265,11 @@ */ #define VM_PHYSMEM_PTR(i) (vm_physmem_ptrs[i]) +#define VM_PHYSMEM_PTR_SWAP(i, j) \ + do { VM_PHYSMEM_PTR(i) = VM_PHYSMEM_PTR(j); } while (0) #define VM_PHYSDEV_PTR(i) (vm_physdev_ptrs[i]) +#define VM_PHYSDEV_PTR_SWAP(i, j) \ + do { VM_PHYSDEV_PTR(i) = VM_PHYSDEV_PTR(j); } while (0) extern struct vm_physseg *vm_physmem_ptrs[VM_PHYSSEG_MAX]; extern int vm_nphysmem;