diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-03-18 20:49:41 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-03-18 20:49:41 +0000 |
commit | 44145833fa4d853a4ea0ca793a37e840fd50fb77 (patch) | |
tree | 7e6edb199ea5c5920b6601eae13fb12e8b76702c | |
parent | bdc242fe7e1afac5de289c044b863316286b9e77 (diff) |
Allow for VM_MIN_KERNEL_ADDRESS to not be a constant.
-rw-r--r-- | sys/arch/sparc/sparc/db_trace.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/genassym.cf | 4 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/locore.s | 22 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/pmap.c | 21 |
4 files changed, 37 insertions, 14 deletions
diff --git a/sys/arch/sparc/sparc/db_trace.c b/sys/arch/sparc/sparc/db_trace.c index f5ed6354608..386ba139db8 100644 --- a/sys/arch/sparc/sparc/db_trace.c +++ b/sys/arch/sparc/sparc/db_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_trace.c,v 1.8 2015/03/18 20:49:10 miod Exp $ */ +/* $OpenBSD: db_trace.c,v 1.9 2015/03/18 20:49:40 miod Exp $ */ /* $NetBSD: db_trace.c,v 1.9 1997/07/29 09:42:00 fair Exp $ */ /* @@ -36,7 +36,7 @@ #include <ddb/db_interface.h> #include <ddb/db_output.h> -#define INKERNEL(va) (((vaddr_t)(va)) >= VM_MIN_KERNEL_ADDRESS) +#define INKERNEL(va) (((vaddr_t)(va)) >= vm_min_kernel_address) #define INKERNELTEXT(va) (((vaddr_t)(va)) >= KERNBASE) void diff --git a/sys/arch/sparc/sparc/genassym.cf b/sys/arch/sparc/sparc/genassym.cf index 273be0cd646..244983a20b7 100644 --- a/sys/arch/sparc/sparc/genassym.cf +++ b/sys/arch/sparc/sparc/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.24 2015/02/09 09:21:30 miod Exp $ +# $OpenBSD: genassym.cf,v 1.25 2015/03/18 20:49:40 miod Exp $ # $NetBSD: genassym.cf,v 1.2 1997/06/28 19:59:04 pk Exp $ # @@ -73,7 +73,9 @@ include <sparc/dev/fdvar.h> export SUN4_PGSHIFT export SUN4CM_PGSHIFT export IOSPACE_BASE +if defined(VM_MIN_KERNEL_ADDRESS) export VM_MIN_KERNEL_ADDRESS +endif # proc fields and values struct proc diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s index 6dcca8efb8d..2c85c17f2d9 100644 --- a/sys/arch/sparc/sparc/locore.s +++ b/sys/arch/sparc/sparc/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.98 2015/03/18 20:49:10 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.99 2015/03/18 20:49:40 miod Exp $ */ /* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */ /* @@ -4067,7 +4067,12 @@ ENTRY(copyinstr) beq,a Lcstoolong0 ! yes, return ENAMETOOLONG sethi %hi(_C_LABEL(cpcb)), %o4 +#ifdef VM_MIN_KERNEL_ADDRESS set VM_MIN_KERNEL_ADDRESS, %o4 +#else + sethi %hi(_C_LABEL(vm_min_kernel_address)), %o4 + ld [%o4 + %lo(_C_LABEL(vm_min_kernel_address))], %o4 +#endif cmp %o0, %o4 ! fromaddr < VM_MIN_KERNEL_ADDRESS? blu Lcsdocopyi ! yes, go do it sethi %hi(_C_LABEL(cpcb)), %o4 ! (first instr of copy) @@ -4088,7 +4093,12 @@ ENTRY(copyoutstr) beq,a Lcstoolong0 ! yes, return ENAMETOOLONG sethi %hi(_C_LABEL(cpcb)), %o4 +#ifdef VM_MIN_KERNEL_ADDRESS set VM_MIN_KERNEL_ADDRESS, %o4 +#else + sethi %hi(_C_LABEL(vm_min_kernel_address)), %o4 + ld [%o4 + %lo(_C_LABEL(vm_min_kernel_address))], %o4 +#endif cmp %o1, %o4 ! toaddr < VM_MIN_KERNEL_ADDRESS? blu Lcsdocopyo ! yes, go do it sethi %hi(_C_LABEL(cpcb)), %o4 ! (first instr of copy) @@ -4198,7 +4208,12 @@ ENTRY(copystr) * Copy specified amount of data from user space into the kernel. */ ENTRY(copyin) +#ifdef VM_MIN_KERNEL_ADDRESS set VM_MIN_KERNEL_ADDRESS, %o3 +#else + sethi %hi(_C_LABEL(vm_min_kernel_address)), %o3 + ld [%o3 + %lo(_C_LABEL(vm_min_kernel_address))], %o3 +#endif cmp %o0, %o3 ! src < VM_MIN_KERNEL_ADDRESS? blu,a Ldocopy ! yes, can try it sethi %hi(_C_LABEL(cpcb)), %o3 @@ -4215,7 +4230,12 @@ ENTRY(copyin) * rather than the `src' addresses. */ ENTRY(copyout) +#ifdef VM_MIN_KERNEL_ADDRESS set VM_MIN_KERNEL_ADDRESS, %o3 +#else + sethi %hi(_C_LABEL(vm_min_kernel_address)), %o3 + ld [%o3 + %lo(_C_LABEL(vm_min_kernel_address))], %o3 +#endif 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 fdd0d195374..a5f31f3fb8b 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.174 2015/02/15 21:34:33 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.175 2015/03/18 20:49:40 miod Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -6371,12 +6371,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 < VM_MIN_KERNEL_ADDRESS) + 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 < VM_MIN_KERNEL_ADDRESS) + if ((unsigned int)sp < vm_min_kernel_address) panic("%s: sp=%p", s, sp); if (sp->sg_npte != 0) { n++; @@ -6685,8 +6685,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(VM_MIN_KERNEL_ADDRESS)); - test_region(VA_VREG(VM_MIN_KERNEL_ADDRESS), 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 cnpollc(1); cngetc(); @@ -6738,7 +6738,7 @@ VA2PAsw(ctx, addr, pte) return 0; } /* L1 */ - curtbl = ((curpte & ~0x3) << 4) | VM_MIN_KERNEL_ADDRESS; /* 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); @@ -6752,7 +6752,7 @@ VA2PAsw(ctx, addr, pte) return 0; } /* L2 */ - curtbl = ((curpte & ~0x3) << 4) | VM_MIN_KERNEL_ADDRESS; /* 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); @@ -6766,7 +6766,7 @@ VA2PAsw(ctx, addr, pte) return 0; } /* L3 */ - curtbl = ((curpte & ~0x3) << 4) | VM_MIN_KERNEL_ADDRESS; /* 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); @@ -6782,7 +6782,8 @@ VA2PAsw(ctx, addr, pte) printf("Bizarreness with address 0x%x!\n",addr); } -void test_region(reg, start, stop) +void +test_region(reg, start, stop) int reg; int start, stop; { @@ -6808,7 +6809,7 @@ void test_region(reg, start, stop) printf("Mismatch at address 0x%x.\n",addr); if (cngetc()=='q') break; } - if (reg == VA_VREG(VM_MIN_KERNEL_ADDRESS)) + if (reg == VA_VREG(vm_min_kernel_address)) /* kernel permissions are different */ continue; if ((pte&SRMMU_PROT_MASK)!=(ptesw&SRMMU_PROT_MASK)) { |