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?
This commit is contained in:
parent
c1fa6bf05b
commit
31af389001
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: amiga_init.c,v 1.115 2009/12/06 00:33:59 tsutsui Exp
|
||||
|
||||
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
|
||||
|
@ -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 @@ cpu_dumpconf(void)
|
||||
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 @@ cpu_dumpconf(void)
|
||||
/*
|
||||
* 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:
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.8 2009/12/06 00:33:59 tsutsui E
|
||||
|
||||
#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;
|
||||
|
||||
@ -192,40 +187,6 @@ pmap_bootstrap(paddr_t firstaddr, paddr_t loadaddr)
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -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 @@ static cpu_kcore_hdr_t cpu_kcore_hdr;
|
||||
|
||||
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 @@ start_c(int id, u_int ttphystart, u_int ttphysize, u_int stphysize,
|
||||
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 @@ start_c(int id, u_int ttphystart, u_int ttphysize, u_int stphysize,
|
||||
/*
|
||||
* get the pmap module in sync with reality.
|
||||
*/
|
||||
pmap_bootstrap(vstart, Sysseg_pa);
|
||||
pmap_bootstrap(vstart);
|
||||
|
||||
/*
|
||||
* Prepare to enable the MMU.
|
||||
|
@ -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 @@ char *vmmap;
|
||||
* 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;
|
||||
@ -148,41 +148,6 @@ pmap_bootstrap(vaddr_t vstart, paddr_t sysseg_pa)
|
||||
virtual_avail = vstart;
|
||||
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
|
||||
*/
|
||||
|
@ -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 @@ struct memseg {
|
||||
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 */
|
||||
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.24 2009/12/06 02:42:34 tsutsui
|
||||
#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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
@ -416,43 +418,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
KERNBASE + (nextpa - firstpa);
|
||||
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
|
||||
*/
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.44 2009/12/06 02:42:34 tsutsui
|
||||
#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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
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
|
||||
*/
|
||||
@ -463,43 +465,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
}
|
||||
#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
|
||||
*/
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.24 2009/12/06 02:42:34 tsutsui
|
||||
#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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
/*
|
||||
* 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.
|
||||
@ -383,45 +385,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -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 @@ pmap_remove_all(struct pmap *pmap)
|
||||
/* 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;
|
||||
|
@ -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 @@ struct kpt_page *kpt_pages;
|
||||
* 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 @@ void
|
||||
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;
|
||||
|
@ -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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
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
|
||||
*/
|
||||
@ -470,41 +473,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
mem_size = m68k_ptob(physmem);
|
||||
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
|
||||
*/
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.38 2009/12/06 02:42:34 tsutsui
|
||||
#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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
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.
|
||||
@ -521,45 +523,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.28 2009/12/06 02:42:35 tsutsui
|
||||
#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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
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
|
||||
*/
|
||||
@ -434,45 +438,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
}
|
||||
#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
|
||||
*/
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.33 2009/12/06 02:42:35 tsutsui
|
||||
#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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
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
|
||||
*/
|
||||
@ -558,45 +562,6 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.47 2009/12/06 02:42:35 tsutsui
|
||||
|
||||
|
||||
#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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
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 @@ pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user