Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Use appropriate macro during pmap initialization:
details: https://anonhg.NetBSD.org/src/rev/beff9de1f9be
branches: trunk
changeset: 749880:beff9de1f9be
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Dec 11 22:23:08 2009 +0000
description:
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.
diffstat:
sys/arch/amiga/amiga/amiga_init.c | 16 ++++++++++------
sys/arch/atari/atari/atari_init.c | 18 +++++++++---------
sys/arch/cesfic/cesfic/pmap_bootstrap.c | 25 ++++++++++++-------------
sys/arch/hp300/hp300/pmap_bootstrap.c | 28 +++++++++++++++-------------
sys/arch/luna68k/luna68k/pmap_bootstrap.c | 25 +++++++++++--------------
sys/arch/mac68k/mac68k/pmap_bootstrap.c | 18 +++++++++---------
sys/arch/mvme68k/mvme68k/pmap_bootstrap.c | 25 ++++++++++++-------------
sys/arch/news68k/news68k/pmap_bootstrap.c | 19 +++++++++----------
sys/arch/next68k/next68k/pmap_bootstrap.c | 25 ++++++++++++-------------
sys/arch/x68k/x68k/pmap_bootstrap.c | 19 +++++++++----------
10 files changed, 108 insertions(+), 110 deletions(-)
diffs (truncated from 739 to 300 lines):
diff -r 770344647c7b -r beff9de1f9be sys/arch/amiga/amiga/amiga_init.c
--- a/sys/arch/amiga/amiga/amiga_init.c Fri Dec 11 21:21:52 2009 +0000
+++ b/sys/arch/amiga/amiga/amiga_init.c Fri Dec 11 22:23:08 2009 +0000
@@ -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? */
diff -r 770344647c7b -r beff9de1f9be sys/arch/atari/atari/atari_init.c
--- a/sys/arch/atari/atari/atari_init.c Fri Dec 11 21:21:52 2009 +0000
+++ b/sys/arch/atari/atari/atari_init.c Fri Dec 11 22:23:08 2009 +0000
@@ -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 */
diff -r 770344647c7b -r beff9de1f9be sys/arch/cesfic/cesfic/pmap_bootstrap.c
--- a/sys/arch/cesfic/cesfic/pmap_bootstrap.c Fri Dec 11 21:21:52 2009 +0000
+++ b/sys/arch/cesfic/cesfic/pmap_bootstrap.c Fri Dec 11 22:23:08 2009 +0000
@@ -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
diff -r 770344647c7b -r beff9de1f9be sys/arch/hp300/hp300/pmap_bootstrap.c
--- a/sys/arch/hp300/hp300/pmap_bootstrap.c Fri Dec 11 21:21:52 2009 +0000
+++ b/sys/arch/hp300/hp300/pmap_bootstrap.c Fri Dec 11 22:23:08 2009 +0000
@@ -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.
diff -r 770344647c7b -r beff9de1f9be sys/arch/luna68k/luna68k/pmap_bootstrap.c
--- a/sys/arch/luna68k/luna68k/pmap_bootstrap.c Fri Dec 11 21:21:52 2009 +0000
+++ b/sys/arch/luna68k/luna68k/pmap_bootstrap.c Fri Dec 11 22:23:08 2009 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index