Module Name:    src
Committed By:   tsutsui
Date:           Fri Dec 11 22:23:09 UTC 2009

Modified Files:
        src/sys/arch/amiga/amiga: amiga_init.c
        src/sys/arch/atari/atari: atari_init.c
        src/sys/arch/cesfic/cesfic: pmap_bootstrap.c
        src/sys/arch/hp300/hp300: pmap_bootstrap.c
        src/sys/arch/luna68k/luna68k: pmap_bootstrap.c
        src/sys/arch/mac68k/mac68k: pmap_bootstrap.c
        src/sys/arch/mvme68k/mvme68k: pmap_bootstrap.c
        src/sys/arch/news68k/news68k: pmap_bootstrap.c
        src/sys/arch/next68k/next68k: pmap_bootstrap.c
        src/sys/arch/x68k/x68k: pmap_bootstrap.c

Log Message:
Use appropriate macro during pmap initialization:
- use SYSMAP_VA, SEGSHIFT for Sysmap address and table entries
- use TIA_SIZE, TIB_SIZE for sizes of table entries

Now page size dependent numbers are almost replaced with proper macro.

Tested on atari, hp300, and news68k.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/amiga/amiga/amiga_init.c
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/atari/atari/atari_init.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/cesfic/cesfic/pmap_bootstrap.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/hp300/hp300/pmap_bootstrap.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/news68k/news68k/pmap_bootstrap.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/next68k/next68k/pmap_bootstrap.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/x68k/x68k/pmap_bootstrap.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/arch/amiga/amiga/amiga_init.c
diff -u src/sys/arch/amiga/amiga/amiga_init.c:1.116 src/sys/arch/amiga/amiga/amiga_init.c:1.117
--- src/sys/arch/amiga/amiga/amiga_init.c:1.116	Sun Dec  6 06:41:28 2009
+++ src/sys/arch/amiga/amiga/amiga_init.c	Fri Dec 11 22:23:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: amiga_init.c,v 1.116 2009/12/06 06:41:28 tsutsui Exp $	*/
+/*	$NetBSD: amiga_init.c,v 1.117 2009/12/11 22:23:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1994 Michael L. Hitch
@@ -36,7 +36,7 @@
 #include "opt_devreload.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.116 2009/12/06 06:41:28 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.117 2009/12/11 22:23:08 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -402,7 +402,7 @@
 	/*
 	 * Sysmap is now placed at the end of Supervisor virtual address space.
 	 */
-	RELOC(Sysmap, u_int *) = (u_int *)-(NPTEPG * PAGE_SIZE);
+	RELOC(Sysmap, u_int *) = (u_int *)SYSMAP_VA;
 
 	/*
 	 * initialize segment table and page table map
@@ -488,7 +488,7 @@
 		while (pg < epg)
 			*pg++ = SG_NV;
 		pg = (pt_entry_t *)Sysptmap_pa;
-		pg = &pg[256 - 1];		/* XXX */
+		pg = &pg[SYSMAP_VA >> SEGSHIFT];
 		*pg = Sysptmap_pa | PG_RW | PG_CI | PG_V;
 	} else
 #endif /* M68040 */
@@ -511,12 +511,16 @@
 		/*
 		 * invalidate the remainder of each table
 		 */
-		/* XXX PAGE_SIZE dependent constant: 256 or 1024 */
-		epg = (pt_entry_t *)(Sysptmap_pa + (256 - 1) * sizeof(st_entry_t));
+		epg = (pt_entry_t *)Sysptmap_pa;
+		epg = &epg[TIA_SIZE];
 		while (pg < epg) {
 			*sg++ = SG_NV;
 			*pg++ = PG_NV;
 		}
+		sg = (st_entry_t *)RELOC(Sysseg_pa, u_int);
+		sg = &sg[SYSMAP_VA >> SEGSHIFT];
+		pg = (pt_entry_t *)Sysptmap_pa;
+		pg = &pg[SYSMAP_VA >> SEGSHIFT];
 		*sg = Sysptmap_pa | SG_RW | SG_V;
 		*pg = Sysptmap_pa | PG_RW | PG_CI | PG_V;
 		/* XXX zero out rest of page? */

Index: src/sys/arch/atari/atari/atari_init.c
diff -u src/sys/arch/atari/atari/atari_init.c:1.91 src/sys/arch/atari/atari/atari_init.c:1.92
--- src/sys/arch/atari/atari/atari_init.c:1.91	Sun Dec  6 06:41:29 2009
+++ src/sys/arch/atari/atari/atari_init.c	Fri Dec 11 22:23:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari_init.c,v 1.91 2009/12/06 06:41:29 tsutsui Exp $	*/
+/*	$NetBSD: atari_init.c,v 1.92 2009/12/11 22:23:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.91 2009/12/06 06:41:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.92 2009/12/11 22:23:08 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mbtype.h"
@@ -336,7 +336,7 @@
 	/*
 	 * Sysmap is now placed at the end of Supervisor virtual address space.
 	 */
-	Sysmap = (pt_entry_t *)-(NPTEPG * PAGE_SIZE);
+	Sysmap = (pt_entry_t *)SYSMAP_VA;
 
 	/*
 	 * Initialize segment tables
@@ -942,11 +942,11 @@
 	 * Invalidate the remainder of the tables.
 	 */
 	esg = (st_entry_t *)sysseg_pa;
-	esg = &esg[256];			/* XXX should be TIA_SIZE */
+	esg = &esg[TIA_SIZE];
 	while (sg < esg)
 		*sg++ = SG_NV;
 	epg = (pt_entry_t *)sysptmap_pa;
-	epg = &epg[NPTEPG];			/* XXX should be TIB_SIZE */
+	epg = &epg[TIB_SIZE];
 	while (pg < epg)
 		*pg++ = PG_NV;
 
@@ -954,9 +954,9 @@
 	 * Initialize the PTE for the last one to point Sysptmap.
 	 */
 	sg = (st_entry_t *)sysseg_pa;
-	sg = &sg[256 - 1];			/* XXX should be TIA_SIZE */
+	sg = &sg[SYSMAP_VA >> SEGSHIFT];
 	pg = (pt_entry_t *)sysptmap_pa;
-	pg = &pg[256 - 1];			/* XXX should be TIA_SIZE */
+	pg = &pg[SYSMAP_VA >> SEGSHIFT];
 	*sg = RELOC_PA(kbase, sysptmap_pa) | SG_RW | SG_V;
 	*pg = RELOC_PA(kbase, sysptmap_pa) | PG_RW | PG_CI | PG_V;
 }
@@ -1054,7 +1054,7 @@
 	 * Invalidate rest of Sysptmap page.
 	 */
 	epg = (pt_entry_t *)sysptmap_pa;
-	epg = &epg[NPTEPG];		/* XXX: should be TIB_SIZE */
+	epg = &epg[TIB_SIZE];
 	while (pg < epg)
 		*pg++ = PG_NV;
 
@@ -1062,7 +1062,7 @@
 	 * Initialize the PTE for the last one to point Sysptmap.
 	 */
 	pg = (pt_entry_t *)sysptmap_pa;
-	pg = &pg[256 - 1];		/* XXX: should be TIA_SIZE */
+	pg = &pg[SYSMAP_VA >> SEGSHIFT];
 	*pg = RELOC_PA(kbase, sysptmap_pa) | PG_RW | PG_CI | PG_V;
 }
 #endif /* M68040 */

Index: src/sys/arch/cesfic/cesfic/pmap_bootstrap.c
diff -u src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.25 src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.26
--- src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.25	Sun Dec  6 06:41:29 2009
+++ src/sys/arch/cesfic/cesfic/pmap_bootstrap.c	Fri Dec 11 22:23:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.25 2009/12/06 06:41:29 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.26 2009/12/11 22:23:08 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.25 2009/12/06 06:41:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.26 2009/12/11 22:23:08 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -260,7 +260,7 @@
 		 * Invalidate all remaining entries.
 		 */
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte) {
 			*pte++ = PG_NV;
 		}
@@ -269,9 +269,9 @@
 		 * table page allocated earlier.
 		 */
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
-		pte++;
+		pte++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
 		*pte = lkptpa | PG_RW | PG_CI | PG_V;
 	} else {
 		/*
@@ -293,11 +293,11 @@
 		 * Invalidate all remaining entries in both.
 		 */
 		este = (st_entry_t *)kstpa;
-		este = &epte[NPTEPG];		/* XXX: should be TIA_SIZE */
+		este = &epte[TIA_SIZE];
 		while (ste < este)
 			*ste++ = SG_NV;
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte)
 			*pte++ = PG_NV;
 		/*
@@ -305,13 +305,13 @@
 		 * table page allocated earlier.
 		 */
 		ste = (st_entry_t *)kstpa;
-		ste = &ste[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		ste = &ste[SYSMAP_VA >> SEGSHIFT];
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*ste = kptmpa | SG_RW | SG_V;
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
-		ste++;
-		pte++;
+		ste++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
+		pte++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
 		*ste = lkptpa | SG_RW | SG_V;
 		*pte = lkptpa | PG_RW | PG_CI | PG_V;
 	}
@@ -387,8 +387,7 @@
 	 * Sysmap: kernel page table (as mapped through Sysptmap)
 	 * Allocated at the end of KVA space.
 	 */
-	RELOC(Sysmap, pt_entry_t *) =
-	    (pt_entry_t *)m68k_ptob((NPTEPG - 2) * NPTEPG);
+	RELOC(Sysmap, pt_entry_t *) = (pt_entry_t *)SYSMAP_VA;
 
 	/*
 	 * Remember the u-area address so it can be loaded in the lwp0

Index: src/sys/arch/hp300/hp300/pmap_bootstrap.c
diff -u src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.45 src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.46
--- src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.45	Sun Dec  6 06:41:30 2009
+++ src/sys/arch/hp300/hp300/pmap_bootstrap.c	Fri Dec 11 22:23:08 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.45 2009/12/06 06:41:30 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.46 2009/12/11 22:23:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.45 2009/12/06 06:41:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.46 2009/12/11 22:23:08 tsutsui Exp $");
 
 #include <sys/param.h>
 
@@ -265,7 +265,7 @@
 		 * Invalidate all remaining entries.
 		 */
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte) {
 			*pte++ = PG_NV;
 		}
@@ -274,9 +274,10 @@
 		 * table page allocated earlier.
 		 */
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
-		pte++;
+		pte = (pt_entry_t *)kptmpa;
+		pte = &pte[MAXADDR >> SEGSHIFT];
 		*pte = lkptpa | PG_RW | PG_CI | PG_V;
 	} else {
 		/*
@@ -298,11 +299,11 @@
 		 * Invalidate all remaining entries in both.
 		 */
 		este = (st_entry_t *)kstpa;
-		este = &epte[NPTEPG];		/* XXX: should be TIA_SIZE */
+		este = &epte[TIA_SIZE];
 		while (ste < este)
 			*ste++ = SG_NV;
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte)
 			*pte++ = PG_NV;
 		/*
@@ -310,13 +311,15 @@
 		 * table page allocated earlier.
 		 */
 		ste = (st_entry_t *)kstpa;
-		ste = &ste[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		ste = &ste[SYSMAP_VA >> SEGSHIFT];
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*ste = kptmpa | SG_RW | SG_V;
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
-		ste++;
-		pte++;
+		ste = (st_entry_t *)kstpa;
+		ste = &ste[MAXADDR >> SEGSHIFT];
+		pte = (pt_entry_t *)kptmpa;
+		pte = &pte[MAXADDR >> SEGSHIFT];
 		*ste = lkptpa | SG_RW | SG_V;
 		*pte = lkptpa | PG_RW | PG_CI | PG_V;
 	}
@@ -417,8 +420,7 @@
 	 * Sysmap: kernel page table (as mapped through Sysptmap)
 	 * Allocated at the end of KVA space.
 	 */
-	RELOC(Sysmap, pt_entry_t *) =
-	    (pt_entry_t *)m68k_ptob((NPTEPG - 2) * NPTEPG);
+	RELOC(Sysmap, pt_entry_t *) = (pt_entry_t *)SYSMAP_VA;
 	/*
 	 * CLKbase, MMUbase: important registers in internal IO space
 	 * accessed from assembly language.

Index: src/sys/arch/luna68k/luna68k/pmap_bootstrap.c
diff -u src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.26 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.27
--- src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.26	Fri Dec 11 20:00:49 2009
+++ src/sys/arch/luna68k/luna68k/pmap_bootstrap.c	Fri Dec 11 22:23:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.26 2009/12/11 20:00:49 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.27 2009/12/11 22:23:09 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.26 2009/12/11 20:00:49 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.27 2009/12/11 22:23:09 tsutsui Exp $");
 
 #include <sys/param.h>
 
@@ -242,7 +242,7 @@
 		 * Invalidate all remaining entries.
 		 */
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];
+		epte = &epte[TIB_SIZE];
 		while (pte < epte) {
 			*pte++ = PG_NV;
 		}
@@ -251,9 +251,8 @@
 		 * to point to Sysptmap.
 		 */
 		pte = (pt_entry_t *)kptmpa;
-		/* XXX should be (TIA_SIZE * PAGE_SIZE) */
-		pte[SYSMAP_VA / (NPTEPG * PAGE_SIZE)] =
-		    kptmpa | PG_RW | PG_CI | PG_V;
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
+		*pte = kptmpa | PG_RW | PG_CI | PG_V;
 	} else
 #endif
 	{
@@ -276,11 +275,11 @@
 		 * Invalidate all remaining entries in both.
 		 */
 		este = (st_entry_t *)kstpa;
-		este = &este[NPTEPG];		/* XXX: should be TIA_SIZE */
+		este = &este[TIA_SIZE];
 		while (ste < este)
 			*ste++ = SG_NV;
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte)
 			*pte++ = PG_NV;
 		/*
@@ -288,13 +287,11 @@
 		 * to point to Sysptmap.
  		 */
 		ste = (st_entry_t *)kstpa;
+		ste = &ste[SYSMAP_VA >> SEGSHIFT];
+		*ste = kptmpa | SG_RW | SG_V;
 		pte = (pt_entry_t *)kptmpa;
-		/* XXX should be (TIA_SIZE * PAGE_SIZE) */
-		ste[SYSMAP_VA / (NPTEPG * PAGE_SIZE)] =
-		    kptmpa | SG_RW | SG_V;
-		/* XXX should be (TIA_SIZE * PAGE_SIZE) */
-		pte[SYSMAP_VA / (NPTEPG * PAGE_SIZE)] =
-		    kptmpa | PG_RW | PG_CI | PG_V;
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
+		*pte = kptmpa | PG_RW | PG_CI | PG_V;
 	}
 
 	/*

Index: src/sys/arch/mac68k/mac68k/pmap_bootstrap.c
diff -u src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.86 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.87
--- src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.86	Sun Dec  6 06:41:30 2009
+++ src/sys/arch/mac68k/mac68k/pmap_bootstrap.c	Fri Dec 11 22:23:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.86 2009/12/06 06:41:30 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.87 2009/12/11 22:23:09 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.86 2009/12/06 06:41:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.87 2009/12/11 22:23:09 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -289,7 +289,7 @@
 		 * Invalidate all remaining entries.
 		 */
 		epte = PA2VA(kptmpa, pt_entry_t *);
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte) {
 			*pte++ = PG_NV;
 		}
@@ -297,7 +297,7 @@
 		 * Initialize the last one to point to Sysptmap.
 		 */
 		pte = PA2VA(kptmpa, pt_entry_t *);
-		pte = &pte[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
 	} else {
 		/*
@@ -319,21 +319,21 @@
 		 * Invalidate all remaining entries in both.
 		 */
 		este = PA2VA(kstpa, st_entry_t *);
-		este = &este[NPTEPG];		/* XXX: should be TIA_SIZE */
+		este = &este[TIA_SIZE];
 		while (ste < este)
 			*ste++ = SG_NV;
 		epte = PA2VA(kptmpa, pt_entry_t *);
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte)
 			*pte++ = PG_NV;
 		/*
 		 * Initialize the last one to point to Sysptmap.
 		 */
 		ste = PA2VA(kstpa, st_entry_t *);
-		ste = &ste[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		ste = &ste[SYSMAP_VA >> SEGSHIFT];
 		*ste = kptmpa | SG_RW | SG_V;
 		pte = PA2VA(kptmpa, pt_entry_t *);
-		pte = &pte[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
 	}
 
@@ -433,7 +433,7 @@
 	 * Sysmap: kernel page table (as mapped through Sysptmap)
 	 * Allocated at the end of KVA space.
 	 */
-	Sysmap = (pt_entry_t *)m68k_ptob((NPTEPG - 1) * NPTEPG);
+	Sysmap = (pt_entry_t *)SYSMAP_VA;
 
 	/*
 	 * Remember the u-area address so it can be loaded in the lwp0

Index: src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.39 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.40
--- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.39	Sun Dec  6 06:41:30 2009
+++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c	Fri Dec 11 22:23:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.39 2009/12/06 06:41:30 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.40 2009/12/11 22:23:09 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.39 2009/12/06 06:41:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.40 2009/12/11 22:23:09 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kcore.h>
@@ -279,7 +279,7 @@
 		 * Invalidate all remaining entries.
 		 */
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte) {
 			*pte++ = PG_NV;
 		}
@@ -288,9 +288,9 @@
 		 * table page allocated earlier.
 		 */
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
-		pte++;
+		pte++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
 		*pte = lkptpa | PG_RW | PG_CI | PG_U | PG_V;
 	} else
 #endif /* M68040 || M68060 */
@@ -314,11 +314,11 @@
 		 * Invalidate all remaining entries in both.
 		 */
 		este = (st_entry_t *)kstpa;
-		este = &epte[NPTEPG];		/* XXX: should be TIA_SIZE */
+		este = &epte[TIA_SIZE];
 		while (ste < este)
 			*ste++ = SG_NV;
 		epte = (st_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte)
 			*pte++ = PG_NV;
 		/*
@@ -326,13 +326,13 @@
 		 * table page allocated earlier.
 		 */
 		ste = (st_entry_t *)kstpa;
-		ste = &ste[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		ste = &ste[SYSMAP_VA >> SEGSHIFT];
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*ste = kptmpa | SG_RW | SG_V;
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
-		ste++;
-		pte++;
+		ste++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
+		pte++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
 		*ste = lkptpa | SG_RW | SG_V;
 		*pte = lkptpa | PG_RW | PG_CI | PG_V;
 	}
@@ -438,8 +438,7 @@
 	 * Sysmap: kernel page table (as mapped through Sysptmap)
 	 * Allocated at the end of KVA space.
 	 */
-	RELOC(Sysmap, pt_entry_t *) =
-	    (pt_entry_t *)m68k_ptob((NPTEPG - 2) * NPTEPG);
+	RELOC(Sysmap, pt_entry_t *) = (pt_entry_t *)SYSMAP_VA;
 
 	/*
 	 * Remember the u-area address so it can be loaded in the lwp0

Index: src/sys/arch/news68k/news68k/pmap_bootstrap.c
diff -u src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.29 src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.30
--- src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.29	Sun Dec  6 06:41:30 2009
+++ src/sys/arch/news68k/news68k/pmap_bootstrap.c	Fri Dec 11 22:23:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.29 2009/12/06 06:41:30 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.30 2009/12/11 22:23:09 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.29 2009/12/06 06:41:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.30 2009/12/11 22:23:09 tsutsui Exp $");
 
 #include <sys/param.h>
 
@@ -269,7 +269,7 @@
 		 * Invalidate all remaining entries.
 		 */
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte) {
 			*pte++ = PG_NV;
 		}
@@ -277,7 +277,7 @@
 		 * Initialize the last one to point to Sysptmap.
 		 */
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
 	} else
 #endif
@@ -301,21 +301,21 @@
 		 * Invalidate all remaining entries in both.
 		 */
 		este = (st_entry_t *)kstpa;
-		este = &este[NPTEPG];		/* XXX: should be TIA_SIZE */
+		este = &este[TIA_SIZE];
 		while (ste < este)
 			*ste++ = SG_NV;
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte)
 			*pte++ = PG_NV;
 		/*
 		 * Initialize the last one to point to Sysptmap.
 		 */
 		ste = (st_entry_t *)kstpa;
-		ste = &ste[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		ste = &ste[SYSMAP_VA >> SEGSHIFT];
 		*ste = kptmpa | SG_RW | SG_V;
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
 	}
 
@@ -396,8 +396,7 @@
 	 * Sysmap: kernel page table (as mapped through Sysptmap)
 	 * Allocated at the end of KVA space.
 	 */
-	RELOC(Sysmap, pt_entry_t *) =
-	    (pt_entry_t *)m68k_ptob((NPTEPG - 1) * NPTEPG);
+	RELOC(Sysmap, pt_entry_t *) = (pt_entry_t *)SYSMAP_VA;
 
 	/*
 	 * Remember the u-area address so it can be loaded in the lwp0

Index: src/sys/arch/next68k/next68k/pmap_bootstrap.c
diff -u src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.34 src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.35
--- src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.34	Sun Dec  6 06:41:31 2009
+++ src/sys/arch/next68k/next68k/pmap_bootstrap.c	Fri Dec 11 22:23:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.34 2009/12/06 06:41:31 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.35 2009/12/11 22:23:09 tsutsui Exp $	*/
 
 /*
  * This file was taken from mvme68k/mvme68k/pmap_bootstrap.c
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.34 2009/12/06 06:41:31 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.35 2009/12/11 22:23:09 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kcore.h>
@@ -289,7 +289,7 @@
 		 * Invalidate all remaining entries.
 		 */
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte) {
 			*pte++ = PG_NV;
 		}
@@ -298,9 +298,9 @@
 		 * table page allocated earlier.
 		 */
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
-		pte++;
+		pte++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
 		*pte = lkptpa | PG_RW | PG_CI | PG_U | PG_V;
 	} else
 #endif /* M68040 || M68060 */
@@ -324,11 +324,11 @@
 		 * Invalidate all remaining entries in both.
 		 */
 		este = (st_entry_t *)kstpa;
-		este = &epte[NPTEPG];		/* XXX: should be TIA_SIZE */
+		este = &epte[TIA_SIZE];
 		while (ste < este)
 			*ste++ = SG_NV;
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte)
 			*pte++ = PG_NV;
 		/*
@@ -336,13 +336,13 @@
 		 * table page allocated earlier.
 		 */
 		ste = (st_entry_t *)kstpa;
-		ste = &ste[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		ste = &ste[SYSMAP_VA >> SEGSHIFT];
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 2];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*ste = kptmpa | SG_RW | SG_V;
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
-		ste++;
-		pte++;
+		ste++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
+		pte++;		/* XXX should use [MAXADDR >> SEGSHIFT] */
 		*ste = lkptpa | SG_RW | SG_V;
 		*pte = lkptpa | PG_RW | PG_CI | PG_V;
 	}
@@ -477,8 +477,7 @@
 	 * Sysmap: kernel page table (as mapped through Sysptmap)
 	 * Allocated at the end of KVA space.
 	 */
-	RELOC(Sysmap, pt_entry_t *) =
-	    (pt_entry_t *)m68k_ptob((NPTEPG - 2) * NPTEPG);
+	RELOC(Sysmap, pt_entry_t *) = (pt_entry_t *)SYSMAP_VA;
 
 	/*
 	 * Remember the u-area address so it can be loaded in the lwp0

Index: src/sys/arch/x68k/x68k/pmap_bootstrap.c
diff -u src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.49 src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.50
--- src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.49	Fri Dec 11 19:36:05 2009
+++ src/sys/arch/x68k/x68k/pmap_bootstrap.c	Fri Dec 11 22:23:09 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.49 2009/12/11 19:36:05 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.50 2009/12/11 22:23:09 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.49 2009/12/11 19:36:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.50 2009/12/11 22:23:09 tsutsui Exp $");
 
 #include "opt_m680x0.h"
 
@@ -245,7 +245,7 @@
 		 * Invalidate all remaining entries.
 		 */
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte) {
 			*pte++ = PG_NV;
 		}
@@ -253,7 +253,7 @@
 		 * Initialize the last one to point to Sysptmap.
 		 */
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
 	} else
 #endif /* M68040 || M68060 */
@@ -277,21 +277,21 @@
 		 * Invalidate all remaining entries in both.
 		 */
 		este = (st_entry_t *)kstpa;
-		este = &este[NPTEPG];		/* XXX: should be TIA_SIZE */
+		este = &este[TIA_SIZE];
 		while (ste < este)
 			*ste++ = SG_NV;
 		epte = (pt_entry_t *)kptmpa;
-		epte = &epte[NPTEPG];		/* XXX: should be TIB_SIZE */
+		epte = &epte[TIB_SIZE];
 		while (pte < epte)
 			*pte++ = PG_NV;
 		/*
 		 * Initialize the last one to point to Sysptmap.
 		 */
 		ste = (st_entry_t *)kstpa;
-		ste = &ste[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		ste = &ste[SYSMAP_VA >> SEGSHIFT];
 		*ste = kptmpa | SG_RW | SG_V;
 		pte = (pt_entry_t *)kptmpa;
-		pte = &pte[NPTEPG - 1];		/* XXX: should be TIA_SIZE */
+		pte = &pte[SYSMAP_VA >> SEGSHIFT];
 		*pte = kptmpa | PG_RW | PG_CI | PG_V;
 	}
 
@@ -386,8 +386,7 @@
 	 * Sysmap: kernel page table (as mapped through Sysptmap)
 	 * Allocated at the end of KVA space.
 	 */
-	RELOC(Sysmap, pt_entry_t *) =
-	    (pt_entry_t *)m68k_ptob((NPTEPG - 1) * NPTEPG);
+	RELOC(Sysmap, pt_entry_t *) = (pt_entry_t *)SYSMAP_VA;
 
 	/*
 	 * Remember the u-area address so it can be loaded in the lwp0

Reply via email to