Module Name:    src
Committed By:   uebayasi
Date:           Sun Nov 21 12:14:15 UTC 2010

Modified Files:
        src/sys/uvm [uebayasi-xip]: uvm_pglist.c

Log Message:
Sync with HEAD.


To generate a diff of this commit:
cvs rdiff -u -r1.45.2.4 -r1.45.2.5 src/sys/uvm/uvm_pglist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_pglist.c
diff -u src/sys/uvm/uvm_pglist.c:1.45.2.4 src/sys/uvm/uvm_pglist.c:1.45.2.5
--- src/sys/uvm/uvm_pglist.c:1.45.2.4	Fri Nov 12 19:00:00 2010
+++ src/sys/uvm/uvm_pglist.c	Sun Nov 21 12:14:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pglist.c,v 1.45.2.4 2010/11/12 19:00:00 uebayasi Exp $	*/
+/*	$NetBSD: uvm_pglist.c,v 1.45.2.5 2010/11/21 12:14:15 uebayasi Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.45.2.4 2010/11/12 19:00:00 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.45.2.5 2010/11/21 12:14:15 uebayasi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -59,6 +59,20 @@
 #define	STAT_DECR(v)
 #endif
 
+#ifdef DEBUG
+static int
+vm_physmem_index(struct vm_physseg *ps)
+{
+	int i;
+
+	for (i = 0; i < vm_nphysmem; i++) {
+		if (VM_PHYSMEM_PTR(i) == ps)
+			return i;
+	}
+	return -1;
+}
+#endif
+
 /*
  * uvm_pglistalloc: allocate a list of pages
  *
@@ -133,7 +147,7 @@
 #endif
 #ifdef PGALLOC_VERBOSE
 	printf("pgalloc: contig %d pgs from psi %ld\n", num,
-	(long)(ps - vm_physmem_ptrs[0]));
+	(long)(ps - VM_PHYSMEM_PTR(0)));
 #endif
 
 	KASSERT(mutex_owned(&uvm_fpageqlock));
@@ -164,11 +178,11 @@
 		 * Make sure this is a managed physical page.
 		 */
 
-		if (vm_physseg_find(try, &cidx) != ps - vm_physmem_ptrs[0])
+		if (vm_physseg_find(try, &cidx) != vm_physmem_index(ps))
 			panic("pgalloc contig: botch1");
 		if (cidx != try - ps->start)
 			panic("pgalloc contig: botch2");
-		if (vm_physseg_find(try + num - 1, &cidx) != ps - vm_physmem_ptrs[0])
+		if (vm_physseg_find(try + num - 1, &cidx) != vm_physmem_index(ps))
 			panic("pgalloc contig: botch3");
 		if (cidx != try - ps->start + num - 1)
 			panic("pgalloc contig: botch4");
@@ -251,7 +265,7 @@
 		for (psi = 0 ; psi < vm_nphysmem ; psi++)
 #endif
 		{
-			ps = vm_physmem_ptrs[psi];
+			ps = VM_PHYSMEM_PTR(psi);
 
 			if (ps->free_list != fl)
 				continue;
@@ -292,7 +306,7 @@
 #endif
 #ifdef PGALLOC_VERBOSE
 	printf("pgalloc: simple %d pgs from psi %ld\n", num,
-	    (long)(ps - vm_physmem_ptrs[0]));
+	    (long)(ps - VM_PHYSMEM_PTR(0)));
 #endif
 
 	KASSERT(mutex_owned(&uvm_fpageqlock));
@@ -303,7 +317,7 @@
 	for (try = max(atop(low), ps->avail_start);
 	     try < limit; try ++) {
 #ifdef DEBUG
-		if (vm_physseg_find(try, &cidx) != ps - vm_physmem_ptrs[0])
+		if (vm_physseg_find(try, &cidx) != vm_physmem_index(ps))
 			panic("pgalloc simple: botch1");
 		if (cidx != (try - ps->start))
 			panic("pgalloc simple: botch2");
@@ -350,7 +364,7 @@
 		for (psi = 0 ; psi < vm_nphysmem ; psi++)
 #endif
 		{
-			ps = vm_physmem_ptrs[psi];
+			ps = VM_PHYSMEM_PTR(psi);
 
 			if (ps->free_list != fl)
 				continue;

Reply via email to