Module Name: src Committed By: tsutsui Date: Sun Dec 6 06:41:31 UTC 2009
Modified Files: src/sys/arch/amiga/amiga: amiga_init.c machdep.c pmap_bootstrap.c src/sys/arch/atari/atari: atari_init.c pmap_bootstrap.c src/sys/arch/atari/include: pmap.h 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/m68k/include: pmap_motorola.h src/sys/arch/m68k/m68k: pmap_motorola.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: Move initialization of protection_codes[] and kernel_pmap() from MD pmap bootstrap sources to common pmap_bootstrap_finalize(). Tested on atari, hp300, mac68k, and news68k. XXX: Why is protection_codes[] array initialized at run time? To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/arch/amiga/amiga/amiga_init.c cvs rdiff -u -r1.222 -r1.223 src/sys/arch/amiga/amiga/machdep.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amiga/amiga/pmap_bootstrap.c cvs rdiff -u -r1.90 -r1.91 src/sys/arch/atari/atari/atari_init.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/atari/atari/pmap_bootstrap.c cvs rdiff -u -r1.40 -r1.41 src/sys/arch/atari/include/pmap.h cvs rdiff -u -r1.24 -r1.25 src/sys/arch/cesfic/cesfic/pmap_bootstrap.c cvs rdiff -u -r1.44 -r1.45 src/sys/arch/hp300/hp300/pmap_bootstrap.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/m68k/include/pmap_motorola.h cvs rdiff -u -r1.53 -r1.54 src/sys/arch/m68k/m68k/pmap_motorola.c cvs rdiff -u -r1.85 -r1.86 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c cvs rdiff -u -r1.38 -r1.39 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c cvs rdiff -u -r1.28 -r1.29 src/sys/arch/news68k/news68k/pmap_bootstrap.c cvs rdiff -u -r1.33 -r1.34 src/sys/arch/next68k/next68k/pmap_bootstrap.c cvs rdiff -u -r1.47 -r1.48 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.115 src/sys/arch/amiga/amiga/amiga_init.c:1.116 --- src/sys/arch/amiga/amiga/amiga_init.c:1.115 Sun Dec 6 00:33:59 2009 +++ src/sys/arch/amiga/amiga/amiga_init.c Sun Dec 6 06:41:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: amiga_init.c,v 1.115 2009/12/06 00:33:59 tsutsui Exp $ */ +/* $NetBSD: amiga_init.c,v 1.116 2009/12/06 06:41:28 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.115 2009/12/06 00:33:59 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.116 2009/12/06 06:41:28 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -67,10 +67,6 @@ extern u_int lowram; extern u_int Umap; -extern u_int Sysseg_pa; -#if defined(M68040) || defined(M68060) -extern u_int protostfree; -#endif extern u_long boot_partition; vaddr_t amiga_uptbase; #ifdef P5PPC68KBOARD Index: src/sys/arch/amiga/amiga/machdep.c diff -u src/sys/arch/amiga/amiga/machdep.c:1.222 src/sys/arch/amiga/amiga/machdep.c:1.223 --- src/sys/arch/amiga/amiga/machdep.c:1.222 Tue Nov 24 18:19:52 2009 +++ src/sys/arch/amiga/amiga/machdep.c Sun Dec 6 06:41:28 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.222 2009/11/24 18:19:52 mhitch Exp $ */ +/* $NetBSD: machdep.c,v 1.223 2009/12/06 06:41:28 tsutsui Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -86,7 +86,7 @@ #include "opt_panicbutton.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.222 2009/11/24 18:19:52 mhitch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.223 2009/12/06 06:41:28 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -536,7 +536,6 @@ const struct bdevsw *bdev; int nblks; int i; - extern u_int Sysseg_pa; extern int end[]; memset(&cpu_kcore_hdr, 0, sizeof(cpu_kcore_hdr)); @@ -569,7 +568,7 @@ /* * Initialize the pointer to the kernel segment table. */ - m->sysseg_pa = Sysseg_pa; + m->sysseg_pa = (paddr_t)pmap_kernel()->pm_stpa; /* * Initialize relocation value such that: Index: src/sys/arch/amiga/amiga/pmap_bootstrap.c diff -u src/sys/arch/amiga/amiga/pmap_bootstrap.c:1.8 src/sys/arch/amiga/amiga/pmap_bootstrap.c:1.9 --- src/sys/arch/amiga/amiga/pmap_bootstrap.c:1.8 Sun Dec 6 00:33:59 2009 +++ src/sys/arch/amiga/amiga/pmap_bootstrap.c Sun Dec 6 06:41:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.8 2009/12/06 00:33:59 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.9 2009/12/06 06:41:29 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.8 2009/12/06 00:33:59 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.9 2009/12/06 06:41:29 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,13 +82,8 @@ #include <amiga/amiga/memlist.h> -u_int Sysseg_pa; - extern paddr_t avail_start; extern paddr_t avail_end; -#if defined(M68040) || defined(M68060) -extern u_int protostfree; -#endif extern paddr_t msgbufpa; @@ -193,40 +188,6 @@ virtual_end = VM_MAX_KERNEL_ADDRESS; /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = (u_int *)&protection_codes; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated in locore, - * just initialize pointers. - */ - pmap_kernel()->pm_stpa = (st_entry_t *)Sysseg_pa; - pmap_kernel()->pm_stab = Sysseg; - pmap_kernel()->pm_ptab = Sysmap; -#if defined(M68040) || defined(M68060) - if (mmutype == MMU_68040) - pmap_kernel()->pm_stfree = protostfree; -#endif - - simple_lock_init(&pmap_kernel()->pm_lock); - pmap_kernel()->pm_count = 1; - - /* * Allocate all the submaps we need */ #define SYSMAP(c, v, n) \ Index: src/sys/arch/atari/atari/atari_init.c diff -u src/sys/arch/atari/atari/atari_init.c:1.90 src/sys/arch/atari/atari/atari_init.c:1.91 --- src/sys/arch/atari/atari/atari_init.c:1.90 Sun Dec 6 00:33:59 2009 +++ src/sys/arch/atari/atari/atari_init.c Sun Dec 6 06:41:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: atari_init.c,v 1.90 2009/12/06 00:33:59 tsutsui Exp $ */ +/* $NetBSD: atari_init.c,v 1.91 2009/12/06 06:41:29 tsutsui Exp $ */ /* * Copyright (c) 1995 Leo Weppelman @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.90 2009/12/06 00:33:59 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atari_init.c,v 1.91 2009/12/06 06:41:29 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_mbtype.h" @@ -117,9 +117,6 @@ extern u_int lowram; int machineid, mmutype, cputype, astpending; -#if defined(M68040) || defined(M68060) -extern u_int protostfree; -#endif extern char *esym; extern struct pcb *curpcb; @@ -198,7 +195,6 @@ vaddr_t end_loaded; paddr_t kbase; u_int kstsize; - paddr_t Sysseg_pa; paddr_t Sysptmap_pa; #if defined(_MILANHW_) @@ -507,7 +503,7 @@ /* * get the pmap module in sync with reality. */ - pmap_bootstrap(vstart, Sysseg_pa); + pmap_bootstrap(vstart); /* * Prepare to enable the MMU. Index: src/sys/arch/atari/atari/pmap_bootstrap.c diff -u src/sys/arch/atari/atari/pmap_bootstrap.c:1.5 src/sys/arch/atari/atari/pmap_bootstrap.c:1.6 --- src/sys/arch/atari/atari/pmap_bootstrap.c:1.5 Sun Dec 6 00:33:59 2009 +++ src/sys/arch/atari/atari/pmap_bootstrap.c Sun Dec 6 06:41:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.5 2009/12/06 00:33:59 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.6 2009/12/06 06:41:29 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -102,7 +102,7 @@ * and just syncs the pmap module with what has already been done. */ void -pmap_bootstrap(vaddr_t vstart, paddr_t sysseg_pa) +pmap_bootstrap(vaddr_t vstart) { vaddr_t va; int i; @@ -149,41 +149,6 @@ virtual_end = VM_MAX_KERNEL_ADDRESS; /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = (u_int *)&protection_codes; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated in locore, - * just initialize pointers. - */ - pmap_kernel()->pm_stpa = (st_entry_t *)sysseg_pa; - pmap_kernel()->pm_stab = Sysseg; - pmap_kernel()->pm_ptab = Sysmap; -#if defined(M68040) || defined(M68060) - if (mmutype == MMU_68040) { - pmap_kernel()->pm_stfree = protostfree; - } -#endif - - simple_lock_init(&pmap_kernel()->pm_lock); - pmap_kernel()->pm_count = 1; - - /* * Allocate all the submaps we need */ #define SYSMAP(c, v, n) \ Index: src/sys/arch/atari/include/pmap.h diff -u src/sys/arch/atari/include/pmap.h:1.40 src/sys/arch/atari/include/pmap.h:1.41 --- src/sys/arch/atari/include/pmap.h:1.40 Fri Mar 13 19:08:20 2009 +++ src/sys/arch/atari/include/pmap.h Sun Dec 6 06:41:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.40 2009/03/13 19:08:20 abs Exp $ */ +/* $NetBSD: pmap.h,v 1.41 2009/12/06 06:41:29 tsutsui Exp $ */ /* * Copyright (c) 1991 Regents of the University of California. @@ -103,7 +103,7 @@ extern struct memseg boot_segs[NMEM_SEGS]; extern struct memseg usable_segs[NMEM_SEGS]; -void pmap_bootstrap(vaddr_t, paddr_t); +void pmap_bootstrap(vaddr_t); #endif /* _KERNEL */ Index: src/sys/arch/cesfic/cesfic/pmap_bootstrap.c diff -u src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.24 src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.25 --- src/sys/arch/cesfic/cesfic/pmap_bootstrap.c:1.24 Sun Dec 6 02:42:34 2009 +++ src/sys/arch/cesfic/cesfic/pmap_bootstrap.c Sun Dec 6 06:41:29 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.24 2009/12/06 02:42:34 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.25 2009/12/06 06:41:29 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.24 2009/12/06 02:42:34 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.25 2009/12/06 06:41:29 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -50,7 +50,6 @@ #include <uvm/uvm_extern.h> #define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa - KERNBASE)) -#define RELOCPTR(v, t) ((t)((uintptr_t)RELOC((v), t) + firstpa - KERNBASE)) extern char *etext; extern paddr_t avail_start, avail_end; @@ -369,13 +368,16 @@ } /* - * Calculate important exported kernel virtual addresses + * Calculate important exported kernel addresses and related vaules. */ /* * Sysseg: base of kernel segment table */ RELOC(Sysseg, st_entry_t *) = (st_entry_t *)(kstpa - firstpa + KERNBASE); + RELOC(Sysseg_pa, paddr_t) = kstpa; + if (RELOC(mmutype, int) == MMU_68040) + RELOC(protostfree, u_int) = stfree; /* * Sysptmap: base of kernel page table map */ @@ -417,43 +419,6 @@ RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS; /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = &RELOC(protection_codes, u_int); - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated above, - * just initialize pointers. - */ - { - struct pmap *kpm; - - kpm = RELOCPTR(kernel_pmap_ptr, struct pmap *); - - kpm->pm_stab = RELOC(Sysseg, st_entry_t *); - kpm->pm_ptab = RELOC(Sysmap, pt_entry_t *); - simple_lock_init(&kpm->pm_lock); - kpm->pm_count = 1; - kpm->pm_stpa = (st_entry_t *)kstpa; - if (RELOC(mmutype, int) == MMU_68040) - kpm->pm_stfree = stfree; - } - - /* * Allocate some fixed, special purpose kernel virtual addresses */ { Index: src/sys/arch/hp300/hp300/pmap_bootstrap.c diff -u src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.44 src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.45 --- src/sys/arch/hp300/hp300/pmap_bootstrap.c:1.44 Sun Dec 6 02:42:34 2009 +++ src/sys/arch/hp300/hp300/pmap_bootstrap.c Sun Dec 6 06:41:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.44 2009/12/06 02:42:34 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.45 2009/12/06 06:41:30 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.44 2009/12/06 02:42:34 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.45 2009/12/06 06:41:30 tsutsui Exp $"); #include <sys/param.h> @@ -51,7 +51,6 @@ #include <uvm/uvm_extern.h> #define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa)) -#define RELOCPTR(v, t) ((t)((uintptr_t)RELOC((v), t) + firstpa)) extern char *etext; extern vaddr_t CLKbase, MMUbase; @@ -401,12 +400,15 @@ RELOC(virtual_avail, vaddr_t) = PTE2VA(pte); /* - * Calculate important exported kernel virtual addresses + * Calculate important exported kernel addresses and related values. */ /* * Sysseg: base of kernel segment table */ RELOC(Sysseg, st_entry_t *) = (st_entry_t *)(kstpa - firstpa); + RELOC(Sysseg_pa, paddr_t) = kstpa; + if (RELOC(mmutype, int) == MMU_68040) + RELOC(protostfree, u_int) = stfree; /* * Sysptmap: base of kernel page table map */ @@ -464,43 +466,6 @@ #endif /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = &RELOC(protection_codes, u_int); - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated above, - * just initialize pointers. - */ - { - struct pmap *kpm; - - kpm = RELOCPTR(kernel_pmap_ptr, struct pmap *); - - kpm->pm_stab = RELOC(Sysseg, st_entry_t *); - kpm->pm_ptab = RELOC(Sysmap, pt_entry_t *); - simple_lock_init(&kpm->pm_lock); - kpm->pm_count = 1; - kpm->pm_stpa = (st_entry_t *)kstpa; - if (RELOC(mmutype, int) == MMU_68040) - kpm->pm_stfree = stfree; - } - - /* * Allocate some fixed, special purpose kernel virtual addresses */ { Index: src/sys/arch/luna68k/luna68k/pmap_bootstrap.c diff -u src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.24 src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.25 --- src/sys/arch/luna68k/luna68k/pmap_bootstrap.c:1.24 Sun Dec 6 02:42:34 2009 +++ src/sys/arch/luna68k/luna68k/pmap_bootstrap.c Sun Dec 6 06:41:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.24 2009/12/06 02:42:34 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.25 2009/12/06 06:41:30 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.24 2009/12/06 02:42:34 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.25 2009/12/06 06:41:30 tsutsui Exp $"); #include <sys/param.h> @@ -48,7 +48,6 @@ #include <uvm/uvm_extern.h> #define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa)) -#define RELOCPTR(v, t) ((t)((uintptr_t)RELOC((v), t) + firstpa)) extern char *etext; @@ -357,13 +356,16 @@ /* * Sysseg: base of kernel segment table */ - RELOC(Sysseg, st_entry_t *) = - (st_entry_t *)(kstpa - firstpa); + RELOC(Sysseg, st_entry_t *) = (st_entry_t *)(kstpa - firstpa); + RELOC(Sysseg_pa, paddr_t) = kstpa; +#if defined(M68040) + if (RELOC(mmutype, int) == MMU_68040) + RELOC(protostfree, u_int) = stfree; +#endif /* * Sysptmap: base of kernel page table map */ - RELOC(Sysptmap, pt_entry_t *) = - (pt_entry_t *)(kptmpa - firstpa); + RELOC(Sysptmap, pt_entry_t *) = (pt_entry_t *)(kptmpa - firstpa); /* * Sysmap: kernel page table (as mapped through Sysptmap) * Allocated at the end of KVA space. @@ -384,45 +386,6 @@ RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS; /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = &RELOC(protection_codes, u_int); - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated above, - * just initialize pointers. - */ - { - struct pmap *kpm; - - kpm = RELOCPTR(kernel_pmap_ptr, struct pmap *); - - kpm->pm_stab = RELOC(Sysseg, st_entry_t *); - kpm->pm_ptab = RELOC(Sysmap, pt_entry_t *); - simple_lock_init(&kpm->pm_lock); - kpm->pm_count = 1; - kpm->pm_stpa = (st_entry_t *)kstpa; -#if defined(M68040) - if (RELOC(mmutype, int) == MMU_68040) - kpm->pm_stfree = stfree; -#endif - } - - /* * Allocate some fixed, special purpose kernel virtual addresses */ { Index: src/sys/arch/m68k/include/pmap_motorola.h diff -u src/sys/arch/m68k/include/pmap_motorola.h:1.23 src/sys/arch/m68k/include/pmap_motorola.h:1.24 --- src/sys/arch/m68k/include/pmap_motorola.h:1.23 Sun Dec 6 00:33:58 2009 +++ src/sys/arch/m68k/include/pmap_motorola.h Sun Dec 6 06:41:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_motorola.h,v 1.23 2009/12/06 00:33:58 tsutsui Exp $ */ +/* $NetBSD: pmap_motorola.h,v 1.24 2009/12/06 06:41:30 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -180,12 +180,16 @@ /* Nothing. */ } +extern paddr_t Sysseg_pa; extern st_entry_t *Sysseg; extern pt_entry_t *Sysmap, *Sysptmap; extern vsize_t Sysptsize; extern vsize_t mem_size; extern vaddr_t virtual_avail, virtual_end; extern u_int protection_codes[]; +#if defined(M68040) || defined(M68060) +extern u_int protostfree; +#endif extern char *vmmap; /* map for mem, dumps, etc. */ extern void *CADDR1, *CADDR2; Index: src/sys/arch/m68k/m68k/pmap_motorola.c diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.53 src/sys/arch/m68k/m68k/pmap_motorola.c:1.54 --- src/sys/arch/m68k/m68k/pmap_motorola.c:1.53 Sun Dec 6 00:33:58 2009 +++ src/sys/arch/m68k/m68k/pmap_motorola.c Sun Dec 6 06:41:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_motorola.c,v 1.53 2009/12/06 00:33:58 tsutsui Exp $ */ +/* $NetBSD: pmap_motorola.c,v 1.54 2009/12/06 06:41:30 tsutsui Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -117,7 +117,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.53 2009/12/06 00:33:58 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.54 2009/12/06 06:41:30 tsutsui Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -230,6 +230,7 @@ * Segtabzero is an empty segment table which all processes share til they * reference something. */ +paddr_t Sysseg_pa; st_entry_t *Sysseg; pt_entry_t *Sysmap, *Sysptmap; st_entry_t *Segtabzero, *Segtabzeropa; @@ -325,6 +326,35 @@ pmap_bootstrap_finalize(void) { + /* + * Initialize protection array. + * XXX: Could this have port specific values? Can't this be static? + */ + protection_codes[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; + protection_codes[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; + protection_codes[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; + protection_codes[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; + protection_codes[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; + protection_codes[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; + protection_codes[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; + protection_codes[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; + + /* + * Initialize pmap_kernel(). + */ + pmap_kernel()->pm_stpa = (st_entry_t *)Sysseg_pa; + pmap_kernel()->pm_stab = Sysseg; + pmap_kernel()->pm_ptab = Sysmap; +#if defined(M68040) || defined(M68060) + if (mmutype == MMU_68040) + pmap_kernel()->pm_stfree = protostfree; +#endif + simple_lock_init(&pmap_kernel()->pm_lock); + pmap_kernel()->pm_count = 1; + + /* + * Initialize lwp0 uarea, curlwp, and curpcb. + */ memset((void *)lwp0uarea, 0, USPACE); uvm_lwp_setuarea(&lwp0, lwp0uarea); curlwp = &lwp0; Index: src/sys/arch/mac68k/mac68k/pmap_bootstrap.c diff -u src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.85 src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.86 --- src/sys/arch/mac68k/mac68k/pmap_bootstrap.c:1.85 Sun Dec 6 02:42:34 2009 +++ src/sys/arch/mac68k/mac68k/pmap_bootstrap.c Sun Dec 6 06:41:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.85 2009/12/06 02:42:34 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.86 2009/12/06 06:41:30 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.85 2009/12/06 02:42:34 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.86 2009/12/06 06:41:30 tsutsui Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -416,12 +416,15 @@ virtual_avail = PTE2VA(pte); /* - * Calculate important exported kernel virtual addresses + * Calculate important exported kernel addresses and related values. */ /* * Sysseg: base of kernel segment table */ Sysseg = PA2VA(kstpa, st_entry_t *); + Sysseg_pa = PA2VA(kstpa, paddr_t); + if (mmutype == MMU_68040) + protostfree = stfree; /* * Sysptmap: base of kernel page table map */ @@ -471,41 +474,6 @@ virtual_end = VM_MAX_KERNEL_ADDRESS; /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = (u_int *)&protection_codes; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated above, - * just initialize pointers. - */ - { - struct pmap *kpm = kernel_pmap_ptr; - - kpm->pm_stab = Sysseg; - kpm->pm_ptab = Sysmap; - simple_lock_init(&kpm->pm_lock); - kpm->pm_count = 1; - kpm->pm_stpa = (st_entry_t *)kstpa; - if (mmutype == MMU_68040) - kpm->pm_stfree = stfree; - } - - /* * Allocate some fixed, special purpose kernel virtual addresses */ { Index: src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c diff -u src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.38 src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.39 --- src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c:1.38 Sun Dec 6 02:42:34 2009 +++ src/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c Sun Dec 6 06:41:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.38 2009/12/06 02:42:34 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.39 2009/12/06 06:41:30 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.38 2009/12/06 02:42:34 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.39 2009/12/06 06:41:30 tsutsui Exp $"); #include <sys/param.h> #include <sys/kcore.h> @@ -50,7 +50,6 @@ #include <uvm/uvm_extern.h> #define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa)) -#define RELOCPTR(v, t) ((t)((uintptr_t)RELOC((v), t) + firstpa)) extern char *kernel_text, *etext; @@ -420,18 +419,21 @@ RELOC(virtual_avail, vaddr_t) = PTE2VA(pte); /* - * Calculate important exported kernel virtual addresses + * Calculate important exported kernel addresses and related values. */ /* * Sysseg: base of kernel segment table */ - RELOC(Sysseg, st_entry_t *) = - (st_entry_t *)(kstpa - firstpa); + RELOC(Sysseg, st_entry_t *) = (st_entry_t *)(kstpa - firstpa); + RELOC(Sysseg_pa, paddr_t) = kstpa; +#if defined(M68040) || defined(M68060) + if (RELOC(mmutype, int) == MMU_68040) + RELOC(protostfree, u_int) = stfree; +#endif /* * Sysptmap: base of kernel page table map */ - RELOC(Sysptmap, pt_entry_t *) = - (pt_entry_t *)(kptmpa - firstpa); + RELOC(Sysptmap, pt_entry_t *) = (pt_entry_t *)(kptmpa - firstpa); /* * Sysmap: kernel page table (as mapped through Sysptmap) * Allocated at the end of KVA space. @@ -522,45 +524,6 @@ RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS; /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = &RELOC(protection_codes, u_int); - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated above, - * just initialize pointers. - */ - { - struct pmap *kpm; - - kpm = RELOCPTR(kernel_pmap_ptr, struct pmap *); - - kpm->pm_stab = RELOC(Sysseg, st_entry_t *); - kpm->pm_ptab = RELOC(Sysmap, pt_entry_t *); - simple_lock_init(&kpm->pm_lock); - kpm->pm_count = 1; - kpm->pm_stpa = (st_entry_t *)kstpa; -#if defined(M68040) || defined(M68060) - if (RELOC(mmutype, int) == MMU_68040) - kpm->pm_stfree = stfree; -#endif - } - - /* * Allocate some fixed, special purpose kernel virtual addresses */ { Index: src/sys/arch/news68k/news68k/pmap_bootstrap.c diff -u src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.28 src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.29 --- src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.28 Sun Dec 6 02:42:35 2009 +++ src/sys/arch/news68k/news68k/pmap_bootstrap.c Sun Dec 6 06:41:30 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.28 2009/12/06 02:42:35 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.29 2009/12/06 06:41:30 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.28 2009/12/06 02:42:35 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.29 2009/12/06 06:41:30 tsutsui Exp $"); #include <sys/param.h> @@ -49,7 +49,6 @@ #include <uvm/uvm_extern.h> #define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa)) -#define RELOCPTR(v, t) ((t)((uintptr_t)RELOC((v), t) + firstpa)) extern char *etext; extern char *extiobase; @@ -378,12 +377,17 @@ RELOC(virtual_avail, vaddr_t) = PTE2VA(pte); /* - * Calculate important exported kernel virtual addresses + * Calculate important exported kernel addresses and related values. */ /* * Sysseg: base of kernel segment table */ RELOC(Sysseg, st_entry_t *) = (st_entry_t *)(kstpa - firstpa); + RELOC(Sysseg_pa, paddr_t) = kstpa; +#ifdef M68040 + if (RELOC(mmutype, int) == MMU_68040) + RELOC(protostfree, u_int) = stfree; +#endif /* * Sysptmap: base of kernel page table map */ @@ -435,45 +439,6 @@ #endif /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = &RELOC(protection_codes, u_int); - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated above, - * just initialize pointers. - */ - { - struct pmap *kpm; - - kpm = RELOCPTR(kernel_pmap_ptr, struct pmap *); - - kpm->pm_stab = RELOC(Sysseg, st_entry_t *); - kpm->pm_ptab = RELOC(Sysmap, pt_entry_t *); - simple_lock_init(&kpm->pm_lock); - kpm->pm_count = 1; - kpm->pm_stpa = (st_entry_t *)kstpa; -#ifdef M68040 - if (RELOC(mmutype, int) == MMU_68040) - kpm->pm_stfree = stfree; -#endif - } - - /* * Allocate some fixed, special purpose kernel virtual addresses */ { Index: src/sys/arch/next68k/next68k/pmap_bootstrap.c diff -u src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.33 src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.34 --- src/sys/arch/next68k/next68k/pmap_bootstrap.c:1.33 Sun Dec 6 02:42:35 2009 +++ src/sys/arch/next68k/next68k/pmap_bootstrap.c Sun Dec 6 06:41:31 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.33 2009/12/06 02:42:35 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.34 2009/12/06 06:41:31 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.33 2009/12/06 02:42:35 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.34 2009/12/06 06:41:31 tsutsui Exp $"); #include <sys/param.h> #include <sys/kcore.h> @@ -62,7 +62,6 @@ #include <uvm/uvm_extern.h> #define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa)) -#define RELOCPTR(v, t) ((t)((uintptr_t)RELOC((v), t) + firstpa)) extern char *etext; @@ -459,12 +458,17 @@ RELOC(virtual_avail, vaddr_t) = PTE2VA(pte); /* - * Calculate important exported kernel virtual addresses + * Calculate important exported kernel addresses and related values. */ /* * Sysseg: base of kernel segment table */ RELOC(Sysseg, st_entry_t *) = (st_entry_t *)(kstpa - firstpa); + RELOC(Sysseg_pa, paddr_t) = kstpa; +#if defined(M68040) || defined(M68060) + if (RELOC(mmutype, int) == MMU_68040) + RELOC(protostfree, u_int) = stfree; +#endif /* * Sysptmap: base of kernel page table map */ @@ -559,45 +563,6 @@ RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS; /* - * Initialize protection array. - * XXX don't use a switch statement, it might produce an - * absolute "jmp" table. - */ - { - u_int *kp; - - kp = &RELOC(protection_codes, u_int); - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; - kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; - kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; - } - - /* - * Kernel page/segment table allocated above, - * just initialize pointers. - */ - { - struct pmap *kpm; - - kpm = RELOCPTR(kernel_pmap_ptr, struct pmap *); - - kpm->pm_stab = RELOC(Sysseg, st_entry_t *); - kpm->pm_ptab = RELOC(Sysmap, pt_entry_t *); - simple_lock_init(&kpm->pm_lock); - kpm->pm_count = 1; - kpm->pm_stpa = (st_entry_t *)kstpa; -#if defined(M68040) || defined(M68060) - if (RELOC(mmutype, int) == MMU_68040) - kpm->pm_stfree = stfree; -#endif - } - - /* * Allocate some fixed, special purpose kernel virtual addresses */ { Index: src/sys/arch/x68k/x68k/pmap_bootstrap.c diff -u src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.47 src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.48 --- src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.47 Sun Dec 6 02:42:35 2009 +++ src/sys/arch/x68k/x68k/pmap_bootstrap.c Sun Dec 6 06:41:31 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_bootstrap.c,v 1.47 2009/12/06 02:42:35 tsutsui Exp $ */ +/* $NetBSD: pmap_bootstrap.c,v 1.48 2009/12/06 06:41:31 tsutsui Exp $ */ /* * Copyright (c) 1991, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.47 2009/12/06 02:42:35 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.48 2009/12/06 06:41:31 tsutsui Exp $"); #include "opt_m680x0.h" @@ -49,7 +49,6 @@ #define RELOC(v, t) *((t*)((uintptr_t)&(v) + firstpa)) -#define RELOCPTR(v, t) ((t)((uintptr_t)RELOC((v), t) + firstpa)) extern char *etext; @@ -368,12 +367,17 @@ RELOC(virtual_avail, vaddr_t) = PTE2VA(pte); /* - * Calculate important exported kernel virtual addresses + * Calculate important exported kernel addresses and related values. */ /* * Sysseg: base of kernel segment table */ RELOC(Sysseg, st_entry_t *) = (st_entry_t *)(kstpa - firstpa); + RELOC(Sysseg_pa, paddr_t) = kstpa; +#if defined(M68040) || defined(M68060) + if (RELOC(mmutype, int) == MMU_68040) + RELOC(protostfree, u_int) = stfree; +#endif /* * Sysptmap: base of kernel page table map */ @@ -422,25 +426,6 @@ kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; } - /* - * Kernel page/segment table allocated above, - * just initialize pointers. - */ - { - struct pmap *kpm; - - kpm = RELOCPTR(kernel_pmap_ptr, struct pmap *); - - kpm->pm_stab = RELOC(Sysseg, st_entry_t *); - kpm->pm_ptab = RELOC(Sysmap, pt_entry_t *); - simple_lock_init(&kpm->pm_lock); - kpm->pm_count = 1; - kpm->pm_stpa = (st_entry_t *)kstpa; -#if defined(M68040) || defined(M68060) - if (RELOC(mmutype, int) == MMU_68040) - kpm->pm_stfree = stfree; -#endif - } /* * Allocate some fixed, special purpose kernel virtual addresses