diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-04-17 18:47:52 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-04-17 18:47:52 +0000 |
commit | f051bae440ec0fa5fe664e635090e32f92a54cdc (patch) | |
tree | efabe9cf512d871648ad02ec75c903eb68d2ca9a /sys/arch/sparc | |
parent | 0f281c355a9f1d74f8996074563ab439162320c6 (diff) |
Do not use KERNBASE when VM_MIN_KERNEL_ADDRESS or VM_MAXUSER_ADDRESS are
implied; this currently does not change anything (yet).
Also, define the I/O space range in <machine/vmparam.h> rather than in
<sparc/sparc/vaddrs.h>.
ok deraadt@ mickey@
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r-- | sys/arch/sparc/include/pmap.h | 6 | ||||
-rw-r--r-- | sys/arch/sparc/include/vmparam.h | 11 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/auxreg.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/genassym.cf | 5 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/locore.s | 18 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/pmap.c | 66 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/trap.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/vaddrs.h | 6 |
8 files changed, 64 insertions, 58 deletions
diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index b754e9ab4e2..b6586168a1c 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.39 2005/04/04 23:40:02 miod Exp $ */ +/* $OpenBSD: pmap.h,v 1.40 2005/04/17 18:47:48 miod Exp $ */ /* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */ /* @@ -124,8 +124,8 @@ * pointers to each other. These must (unfortunately) be kept in sync. * */ -#define NKREG ((int)((-(unsigned)KERNBASE) / NBPRG)) /* i.e., 8 */ -#define NUREG (256 - NKREG) /* i.e., 248 */ +#define NKREG ((int)((-(unsigned)VM_MIN_KERNEL_ADDRESS) / NBPRG)) /* 8 */ +#define NUREG (256 - NKREG) /* 248 */ TAILQ_HEAD(mmuhd,mmuentry); diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h index dc35ede11e3..8557ec3fb71 100644 --- a/sys/arch/sparc/include/vmparam.h +++ b/sys/arch/sparc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.30 2005/04/11 15:13:01 deraadt Exp $ */ +/* $OpenBSD: vmparam.h,v 1.31 2005/04/17 18:47:48 miod Exp $ */ /* $NetBSD: vmparam.h,v 1.13 1997/07/12 16:20:03 perry Exp $ */ /* @@ -53,7 +53,7 @@ * is the top (end) of the user stack. */ #define USRTEXT 0x2000 /* Start of user text */ -#define USRSTACK KERNBASE /* Start of user stack */ +#define USRSTACK VM_MIN_KERNEL_ADDRESS /* Start of user stack */ /* * Virtual memory related constants, all in bytes @@ -90,11 +90,14 @@ * tread with care. */ #define VM_MIN_ADDRESS ((vaddr_t)0) -#define VM_MAX_ADDRESS ((vaddr_t)KERNBASE) -#define VM_MAXUSER_ADDRESS ((vaddr_t)KERNBASE) +#define VM_MAX_ADDRESS ((vaddr_t)VM_MIN_KERNEL_ADDRESS) +#define VM_MAXUSER_ADDRESS ((vaddr_t)VM_MIN_KERNEL_ADDRESS) #define VM_MIN_KERNEL_ADDRESS ((vaddr_t)KERNBASE) #define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xfe000000) +#define IOSPACE_BASE VM_MAX_KERNEL_ADDRESS +#define IOSPACE_LEN 0x01000000 /* 16 MB of iospace */ + #define VM_PHYSSEG_MAX 32 /* we only have one "hole" */ #define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH #define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ diff --git a/sys/arch/sparc/sparc/auxreg.c b/sys/arch/sparc/sparc/auxreg.c index c3d12d0a62d..b9f0cb5dafd 100644 --- a/sys/arch/sparc/sparc/auxreg.c +++ b/sys/arch/sparc/sparc/auxreg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auxreg.c,v 1.11 2003/06/02 23:27:55 millert Exp $ */ +/* $OpenBSD: auxreg.c,v 1.12 2005/04/17 18:47:50 miod Exp $ */ /* $NetBSD: auxreg.c,v 1.21 1997/05/24 20:15:59 pk Exp $ */ /* @@ -47,6 +47,8 @@ #include <sys/kernel.h> #include <sys/timeout.h> +#include <uvm/uvm_param.h> + #include <machine/autoconf.h> #include <sparc/sparc/vaddrs.h> diff --git a/sys/arch/sparc/sparc/genassym.cf b/sys/arch/sparc/sparc/genassym.cf index 28cf31fb5f3..1dbf11cc5d5 100644 --- a/sys/arch/sparc/sparc/genassym.cf +++ b/sys/arch/sparc/sparc/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.18 2005/04/16 15:07:29 miod Exp $ +# $OpenBSD: genassym.cf,v 1.19 2005/04/17 18:47:50 miod Exp $ # $NetBSD: genassym.cf,v 1.2 1997/06/28 19:59:04 pk Exp $ # @@ -70,10 +70,11 @@ include <sparc/dev/fdreg.h> include <sparc/dev/fdvar.h> # general constants -export BSD export SUN4_PGSHIFT export SUN4CM_PGSHIFT export USRSTACK +export IOSPACE_BASE +export VM_MIN_KERNEL_ADDRESS # proc fields and values struct proc diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s index 82050a5918f..5ddf51820cb 100644 --- a/sys/arch/sparc/sparc/locore.s +++ b/sys/arch/sparc/sparc/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.63 2005/04/17 18:44:19 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.64 2005/04/17 18:47:50 miod Exp $ */ /* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */ /* @@ -4156,8 +4156,8 @@ ENTRY(copyinstr) beq,a Lcstoolong0 ! yes, return ENAMETOOLONG sethi %hi(_C_LABEL(cpcb)), %o4 - set KERNBASE, %o4 - cmp %o0, %o4 ! fromaddr < KERNBASE? + set VM_MIN_KERNEL_ADDRESS, %o4 + cmp %o0, %o4 ! fromaddr < VM_MIN_KERNEL_ADDRESS? blu Lcsdocopyi ! yes, go do it sethi %hi(_C_LABEL(cpcb)), %o4 ! (first instr of copy) @@ -4177,8 +4177,8 @@ ENTRY(copyoutstr) beq,a Lcstoolong0 ! yes, return ENAMETOOLONG sethi %hi(_C_LABEL(cpcb)), %o4 - set KERNBASE, %o4 - cmp %o1, %o4 ! toaddr < KERNBASE? + set VM_MIN_KERNEL_ADDRESS, %o4 + cmp %o1, %o4 ! toaddr < VM_MIN_KERNEL_ADDRESS? blu Lcsdocopyo ! yes, go do it sethi %hi(_C_LABEL(cpcb)), %o4 ! (first instr of copy) @@ -4287,8 +4287,8 @@ ENTRY(copystr) * Copy specified amount of data from user space into the kernel. */ ENTRY(copyin) - set KERNBASE, %o3 - cmp %o0, %o3 ! src < KERNBASE? + set VM_MIN_KERNEL_ADDRESS, %o3 + cmp %o0, %o3 ! src < VM_MIN_KERNEL_ADDRESS? blu,a Ldocopy ! yes, can try it sethi %hi(_C_LABEL(cpcb)), %o3 @@ -4304,8 +4304,8 @@ ENTRY(copyin) * rather than the `src' addresses. */ ENTRY(copyout) - set KERNBASE, %o3 - cmp %o1, %o3 ! dst < KERNBASE? + set VM_MIN_KERNEL_ADDRESS, %o3 + cmp %o1, %o3 ! dst < VM_MIN_KERNEL_ADDRESS? blu,a Ldocopy sethi %hi(_C_LABEL(cpcb)), %o3 diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index 89f10c414a9..1dc00992d4c 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.142 2005/04/03 10:36:12 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.143 2005/04/17 18:47:50 miod Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -1018,17 +1018,17 @@ mmu_setup4m_L1(regtblptd, kpmap) /* * Here we scan the region table to copy any entries which appear. * We are only concerned with regions in kernel space and above - * (i.e. regions VA_VREG(KERNBASE)+1 to 0xff). We ignore the first - * region (at VA_VREG(KERNBASE)), since that is the 16MB L1 mapping - * that the ROM used to map the kernel in initially. Later, we will - * rebuild a new L3 mapping for the kernel and install it before - * switching to the new pagetables. + * (i.e. regions VA_VREG(VM_MIN_KERNEL_ADDRESS)+1 to 0xff). We ignore + * the first region (at VA_VREG(VM_MIN_KERNEL_ADDRESS)), since that + * is the 16MB L1 mapping that the ROM used to map the kernel in + * initially. Later, we will rebuild a new L3 mapping for the kernel + * and install it before switching to the new pagetables. */ regtblrover = ((regtblptd & ~SRMMU_TETYPE) << SRMMU_PPNPASHIFT) + - (VA_VREG(KERNBASE)+1) * sizeof(long); /* kernel only */ + (VA_VREG(VM_MIN_KERNEL_ADDRESS)+1) * sizeof(long); /* kernel only */ - for (i = VA_VREG(KERNBASE) + 1; i < SRMMU_L1SIZE; + for (i = VA_VREG(VM_MIN_KERNEL_ADDRESS) + 1; i < SRMMU_L1SIZE; i++, regtblrover += sizeof(long)) { /* The region we're dealing with */ @@ -2816,9 +2816,9 @@ pmap_bootstrap4_4c(nctx, nregion, nsegment) */ lastpage = NPTESG; - p = (caddr_t)KERNBASE; /* first va */ - vs = VA_VSEG(KERNBASE); /* first virtual segment */ - vr = VA_VREG(KERNBASE); /* first virtual region */ + p = (caddr_t)VM_MIN_KERNEL_ADDRESS; /* first va */ + vs = VA_VSEG(VM_MIN_KERNEL_ADDRESS); /* first virtual segment */ + vr = VA_VREG(VM_MIN_KERNEL_ADDRESS); /* first virtual region */ rp = &pmap_kernel()->pm_regmap[vr]; for (rcookie = 0, scookie = 0;;) { @@ -3121,12 +3121,12 @@ pmap_bootstrap4m(void) * Entering new region; install & build segtbl */ - rp = &pmap_kernel()->pm_regmap[reg + VA_VREG(KERNBASE)]; + rp = &pmap_kernel()->pm_regmap[reg + VA_VREG(VM_MIN_KERNEL_ADDRESS)]; kphyssegtbl = (caddr_t) &kernel_segtable_store[reg * SRMMU_L2SIZE]; - setpgt4m(&pmap_kernel()->pm_reg_ptps[reg + VA_VREG(KERNBASE)], + setpgt4m(&pmap_kernel()->pm_reg_ptps[reg + VA_VREG(VM_MIN_KERNEL_ADDRESS)], (VA2PA(kphyssegtbl) >> SRMMU_PPNPASHIFT) | SRMMU_TEPTD); rp->rg_seg_ptps = (int *)kphyssegtbl; @@ -3191,17 +3191,17 @@ pmap_bootstrap4m(void) /* * Now map the kernel into our new set of page tables, then * (finally) switch over to our running page tables. - * We map from KERNBASE to p into context 0's page tables (and - * the kernel pmap). + * We map from VM_MIN_KERNEL_ADDRESS to p into context 0's + * page tables (and the kernel pmap). */ #ifdef DEBUG /* Sanity checks */ if ((u_int)p % NBPG != 0) panic("pmap_bootstrap4m: p misaligned?!?"); - if (KERNBASE % NBPRG != 0) - panic("pmap_bootstrap4m: KERNBASE not region-aligned"); + if (VM_MIN_KERNEL_ADDRESS % NBPRG != 0) + panic("pmap_bootstrap4m: VM_MIN_KERNEL_ADDRESS not region-aligned"); #endif - for (q = (caddr_t) KERNBASE; q < p; q += NBPG) { + for (q = (caddr_t) VM_MIN_KERNEL_ADDRESS; q < p; q += NBPG) { struct regmap *rp; struct segmap *sp; int pte; @@ -3213,7 +3213,7 @@ pmap_bootstrap4m(void) sp = &rp->rg_segmap[VA_VSEG(q)]; sp->sg_npte++; - pte = ((int)q - KERNBASE) >> SRMMU_PPNPASHIFT; + pte = ((int)q - VM_MIN_KERNEL_ADDRESS) >> SRMMU_PPNPASHIFT; pte |= PPROT_N_RX | SRMMU_TEPTE; if ((cpuinfo.flags & CPUFLG_CACHEPAGETABLES) != 0 || @@ -3482,8 +3482,8 @@ pmap_create() /* Copy kernel regions */ for (i = 0; i < NKREG; i++) { - setpgt4m(&pm->pm_reg_ptps[VA_VREG(KERNBASE) + i], - cpuinfo.L1_ptps[VA_VREG(KERNBASE) + i]); + setpgt4m(&pm->pm_reg_ptps[VA_VREG(VM_MIN_KERNEL_ADDRESS) + i], + cpuinfo.L1_ptps[VA_VREG(VM_MIN_KERNEL_ADDRESS) + i]); } } #endif @@ -5337,8 +5337,8 @@ pmap_enk4m(pm, va, prot, flags, pv, pteproto) int wired = (flags & PMAP_WIRED) != 0; #ifdef DIAGNOSTIC - if (va < KERNBASE) - panic("pmap_enk4m: can't enter va 0x%lx below KERNBASE", va); + if (va < VM_MIN_KERNEL_ADDRESS) + panic("pmap_enk4m: can't enter va 0x%lx below VM_MIN_KERNEL_ADDRESS", va); #endif rp = &pm->pm_regmap[VA_VREG(va)]; sp = &rp->rg_segmap[VA_VSEG(va)]; @@ -5416,8 +5416,8 @@ pmap_enu4m(pm, va, prot, flags, pv, pteproto) int wired = (flags & PMAP_WIRED) != 0; #ifdef DEBUG - if (KERNBASE < va) - panic("pmap_enu4m: can't enter va 0x%lx above KERNBASE", va); + if (VM_MIN_KERNEL_ADDRESS < va) + panic("pmap_enu4m: can't enter va 0x%lx above VM_MIN_KERNEL_ADDRESS", va); #endif write_user_windows(); /* XXX conservative */ @@ -6258,12 +6258,12 @@ pm_check_u(s, pm) SRMMU_PPNPASHIFT) | SRMMU_TEPTD)) panic("%s: CHK(vr %d): SRMMU segtbl not installed",s,vr); #endif - if ((unsigned int)rp < KERNBASE) + if ((unsigned int)rp < VM_MIN_KERNEL_ADDRESS) panic("%s: rp=%p", s, rp); n = 0; for (vs = 0; vs < NSEGRG; vs++) { sp = &rp->rg_segmap[vs]; - if ((unsigned int)sp < KERNBASE) + if ((unsigned int)sp < VM_MIN_KERNEL_ADDRESS) panic("%s: sp=%p", s, sp); if (sp->sg_npte != 0) { n++; @@ -6572,8 +6572,8 @@ debug_pagetables() printf("Testing region 0xff: "); test_region(0xff,0,16*1024*1024); #if 0 /* XXX avail_start */ - printf("Testing kernel region 0x%x: ", VA_VREG(KERNBASE)); - test_region(VA_VREG(KERNBASE), 4096, avail_start); + printf("Testing kernel region 0x%x: ", VA_VREG(VM_MIN_KERNEL_ADDRESS)); + test_region(VA_VREG(VM_MIN_KERNEL_ADDRESS), 4096, avail_start); #endif cngetc(); @@ -6621,7 +6621,7 @@ VA2PAsw(ctx, addr, pte) return 0; } /* L1 */ - curtbl = ((curpte & ~0x3) << 4) | KERNBASE; /* correct for krn*/ + curtbl = ((curpte & ~0x3) << 4) | VM_MIN_KERNEL_ADDRESS; /* correct for krn*/ *pte = curpte = curtbl[VA_VREG(addr)]; #ifdef EXTREME_EXTREME_DEBUG printf("L1 table at 0x%x.\nGot L1 pte 0x%x\n",curtbl,curpte); @@ -6635,7 +6635,7 @@ VA2PAsw(ctx, addr, pte) return 0; } /* L2 */ - curtbl = ((curpte & ~0x3) << 4) | KERNBASE; /* correct for krn*/ + curtbl = ((curpte & ~0x3) << 4) | VM_MIN_KERNEL_ADDRESS; /* correct for krn*/ *pte = curpte = curtbl[VA_VSEG(addr)]; #ifdef EXTREME_EXTREME_DEBUG printf("L2 table at 0x%x.\nGot L2 pte 0x%x\n",curtbl,curpte); @@ -6649,7 +6649,7 @@ VA2PAsw(ctx, addr, pte) return 0; } /* L3 */ - curtbl = ((curpte & ~0x3) << 4) | KERNBASE; /* correct for krn*/ + curtbl = ((curpte & ~0x3) << 4) | VM_MIN_KERNEL_ADDRESS; /* correct for krn*/ *pte = curpte = curtbl[VA_VPG(addr)]; #ifdef EXTREME_EXTREME_DEBUG printf("L3 table at 0x%x.\nGot L3 pte 0x%x\n",curtbl,curpte); @@ -6690,7 +6690,7 @@ void test_region(reg, start, stop) printf("Mismatch at address 0x%x.\n",addr); if (cngetc()=='q') break; } - if (reg == VA_VREG(KERNBASE)) + if (reg == VA_VREG(VM_MIN_KERNEL_ADDRESS)) /* kernel permissions are different */ continue; if ((pte&SRMMU_PROT_MASK)!=(ptesw&SRMMU_PROT_MASK)) { diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c index ffb05eda902..cd10493565e 100644 --- a/sys/arch/sparc/sparc/trap.c +++ b/sys/arch/sparc/sparc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.42 2004/12/06 20:12:25 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.43 2005/04/17 18:47:51 miod Exp $ */ /* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */ /* @@ -704,7 +704,7 @@ mem_access_fault(type, ser, v, pc, psr, tf) */ if (cold) goto kfault; - if (va >= KERNBASE) { + if (va >= VM_MIN_KERNEL_ADDRESS) { if (uvm_fault(kernel_map, va, 0, ftype) == 0) return; goto kfault; @@ -950,7 +950,7 @@ mem_access_fault4m(type, sfsr, sfva, tf) */ if (cold) goto kfault; - if (va >= KERNBASE) { + if (va >= VM_MIN_KERNEL_ADDRESS) { if (uvm_fault(kernel_map, va, 0, ftype) == 0) return; goto kfault; diff --git a/sys/arch/sparc/sparc/vaddrs.h b/sys/arch/sparc/sparc/vaddrs.h index 8132e8c2ca9..e833b72416e 100644 --- a/sys/arch/sparc/sparc/vaddrs.h +++ b/sys/arch/sparc/sparc/vaddrs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vaddrs.h,v 1.6 2003/04/23 19:34:07 miod Exp $ */ +/* $OpenBSD: vaddrs.h,v 1.7 2005/04/17 18:47:51 miod Exp $ */ /* $NetBSD: vaddrs.h,v 1.8 1997/03/10 23:54:41 pk Exp $ */ /* @@ -70,7 +70,7 @@ */ #ifndef IODEV_0 -#define IODEV_0 0xfe000000 /* must match VM_MAX_KERNEL_ADDRESS */ +#define IODEV_0 IOSPACE_BASE #define _MAXNBPG 8192 /* fixed VAs, independent of actual NBPG */ #define _MAXNCPU 4 /* fixed VA allocation allows 4 CPUs */ @@ -88,7 +88,7 @@ #define PI_INTR_VA ( MSGBUF_VA + _MAXNBPG) /* [4m] */ #define SI_INTR_VA ( PI_INTR_VA + _MAXNBPG*_MAXNCPU) /* [4m] */ #define IODEV_BASE ( SI_INTR_VA + _MAXNBPG) -#define IODEV_END 0xff000000 /* 16 MB of iospace */ +#define IODEV_END (IOSPACE_BASE + IOSPACE_LEN) #define DVMA_BASE 0xfff00000 #define DVMA_END 0xfffc0000 |