summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc/include/kcore.h4
-rw-r--r--sys/arch/sparc/include/param.h4
-rw-r--r--sys/arch/sparc/include/pmap.h21
-rw-r--r--sys/arch/sparc/include/vmparam.h49
-rw-r--r--sys/arch/sparc/sparc/autoconf.c21
-rw-r--r--sys/arch/sparc/sparc/machdep.c13
-rw-r--r--sys/arch/sparc/sparc/pmap.c144
-rw-r--r--sys/arch/sparc/sparc/trap.c6
8 files changed, 173 insertions, 89 deletions
diff --git a/sys/arch/sparc/include/kcore.h b/sys/arch/sparc/include/kcore.h
index 7e56c7fc315..719a49b6fc3 100644
--- a/sys/arch/sparc/include/kcore.h
+++ b/sys/arch/sparc/include/kcore.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kcore.h,v 1.2 2008/06/26 05:42:13 ray Exp $ */
+/* $OpenBSD: kcore.h,v 1.3 2015/03/18 20:56:40 miod Exp $ */
/* $NetBSD: kcore.h,v 1.1 1996/11/09 22:52:22 pk Exp $ */
/*-
@@ -46,5 +46,5 @@ typedef struct cpu_kcore_hdr {
int npmeg; /* # of PMEGs; [sun4/sun4c] only */
int pmegoffset; /* start of pmeg array (relative */
/* to the start of this header) */
- struct segmap segmap_store[NKREG*NSEGRG]; /* MMU data... */
+ struct segmap segmap_store[NKREG_MAX*NSEGRG]; /* MMU data... */
} cpu_kcore_hdr_t;
diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h
index 8a5ee594150..7c8abf3a9ff 100644
--- a/sys/arch/sparc/include/param.h
+++ b/sys/arch/sparc/include/param.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: param.h,v 1.49 2013/03/26 05:04:10 deraadt Exp $ */
+/* $OpenBSD: param.h,v 1.50 2015/03/18 20:56:40 miod Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -90,8 +90,6 @@
#ifdef _KERNEL
-#define KERNTEXTOFF 0xf8004000 /* start of kernel text */
-
#define NBPG PAGE_SIZE /* bytes/page */
#define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */
#define PGOFSET PAGE_MASK /* byte offset into page */
diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h
index 11b50654fea..e774a05dfb4 100644
--- a/sys/arch/sparc/include/pmap.h
+++ b/sys/arch/sparc/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.57 2015/02/15 21:34:33 miod Exp $ */
+/* $OpenBSD: pmap.h,v 1.58 2015/03/18 20:56:40 miod Exp $ */
/* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */
/*
@@ -131,8 +131,14 @@
* pointers to each other. These must (unfortunately) be kept in sync.
*
*/
-#define NKREG ((int)((-(unsigned)VM_MIN_KERNEL_ADDRESS) / NBPRG)) /* 8 */
-#define NUREG (256 - NKREG) /* 248 */
+#define NKREG_4C \
+ ((unsigned int)(-VM_MIN_KERNEL_ADDRESS_OLD / NBPRG)) /* 8 */
+#define NUREG_4C (256 - NKREG_4C) /* 248 */
+#define NKREG_4M \
+ ((unsigned int)(-VM_MIN_KERNEL_ADDRESS_SRMMU / NBPRG)) /* 64 */
+#define NUREG_4M (256 - NKREG_4M) /* 192 */
+
+#define NKREG_MAX NKREG_4M
struct regmap {
struct segmap *rg_segmap; /* point to NSGPRG PMEGs */
@@ -181,15 +187,6 @@ struct pmap {
typedef struct pmap *pmap_t;
-#if 0
-struct kvm_cpustate {
- int kvm_npmemarr;
- struct memarr kvm_pmemarr[MA_SIZE];
- int kvm_seginval; /* [4,4c] */
- struct segmap kvm_segmap_store[NKREG*NSEGRG]; /* [4,4c] */
-}/*not yet used*/;
-#endif
-
#define PMAP_NULL ((pmap_t)0)
extern struct pmap kernel_pmap_store;
diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h
index 57948a0c08f..5e678c920e6 100644
--- a/sys/arch/sparc/include/vmparam.h
+++ b/sys/arch/sparc/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.42 2014/05/31 20:11:11 miod Exp $ */
+/* $OpenBSD: vmparam.h,v 1.43 2015/03/18 20:56:40 miod Exp $ */
/* $NetBSD: vmparam.h,v 1.13 1997/07/12 16:20:03 perry Exp $ */
/*
@@ -45,17 +45,10 @@
#define _MACHINE_VMPARAM_H_
/*
- * Machine dependent constants for Sun-4c SPARC
+ * Machine dependent constants for SPARC
*/
/*
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack.
- */
-#define USRTEXT 0x2000 /* Start of user text */
-#define USRSTACK VM_MIN_KERNEL_ADDRESS /* Start of user stack */
-
-/*
* Virtual memory related constants, all in bytes
*/
#ifndef MAXTSIZ
@@ -92,10 +85,39 @@
* IO space virtual base, which must be the same as VM_MAX_KERNEL_ADDRESS:
* tread with care.
*/
+
+#define VM_MIN_KERNEL_ADDRESS_OLD ((vaddr_t)KERNBASE)
+#define VM_MIN_KERNEL_ADDRESS_SRMMU ((vaddr_t)0xc0000000)
+
+#if defined(SMALL_KERNEL)
+/* limit to small KVA regardless of the cpu type */
+#define VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS_OLD
+#define VM_MAXUSER_ADDRESS VM_MIN_KERNEL_ADDRESS
+#define VM_MAX_ADDRESS VM_MIN_KERNEL_ADDRESS
+#define USRSTACK VM_MIN_KERNEL_ADDRESS
+#elif (defined(SUN4) || defined(SUN4C) || defined(SUN4E)) && \
+ (defined(SUN4D) || defined(SUN4M))
+/* user/kernel bound will de determined at run time */
+extern vsize_t vm_kernel_space_size;
+#define VM_KERNEL_SPACE_SIZE vm_kernel_space_size
+#define VM_MAXUSER_ADDRESS vm_min_kernel_address
+#define VM_MAX_ADDRESS vm_min_kernel_address
+#define USRSTACK vm_min_kernel_address
+#elif (defined(SUN4) || defined(SUN4C) || defined(SUN4E))
+/* old Sun MMU with address hole */
+#define VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS_OLD
+#define VM_MAXUSER_ADDRESS VM_MIN_KERNEL_ADDRESS
+#define VM_MAX_ADDRESS VM_MIN_KERNEL_ADDRESS
+#define USRSTACK VM_MIN_KERNEL_ADDRESS
+#else
+/* SRMMU without address hole */
+#define VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS_SRMMU
+#define VM_MAXUSER_ADDRESS VM_MIN_KERNEL_ADDRESS
+#define VM_MAX_ADDRESS VM_MIN_KERNEL_ADDRESS
+#define USRSTACK VM_MIN_KERNEL_ADDRESS
+#endif
+
#define VM_MIN_ADDRESS ((vaddr_t)0x2000)
-#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
@@ -105,11 +127,12 @@
#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */
-#if defined (_KERNEL) && !defined(_LOCORE)
+#if defined (_KERNEL)
struct vm_map;
#define dvma_mapin(map,va,len,canwait) dvma_mapin_space(map,va,len,canwait,0)
vaddr_t dvma_mapin_space(struct vm_map *, vaddr_t, int, int, int);
void dvma_mapout(vaddr_t, vaddr_t, int);
+
#endif
#endif /* _MACHINE_VMPARAM_H_ */
diff --git a/sys/arch/sparc/sparc/autoconf.c b/sys/arch/sparc/sparc/autoconf.c
index 766bfcb3eb1..05955e3936a 100644
--- a/sys/arch/sparc/sparc/autoconf.c
+++ b/sys/arch/sparc/sparc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.97 2014/11/22 22:48:38 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.98 2015/03/18 20:56:40 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.73 1997/07/29 09:41:53 fair Exp $ */
/*
@@ -159,6 +159,11 @@ struct promvec promvecdat;
struct om_vector *oldpvec = (struct om_vector *)PROM_BASE;
#endif
+#if (defined(SUN4) || defined(SUN4C) || defined(SUN4E)) && \
+ (defined(SUN4D) || defined(SUN4M)) && !defined(SMALL_KERNEL)
+vaddr_t vm_kernel_space_size;
+#endif
+
/*
* locore.s code calls bootstrap() just before calling main(), after double
* mapping the kernel to high memory and setting up the trap base register.
@@ -238,6 +243,20 @@ bootstrap()
}
#endif /* SUN4 */
+ /*
+ * Decide upon which address space partition to use if it could not
+ * be decided at compile-time (i.e. for GENERIC kernels supporting
+ * both the old Sun MMU and the SRMMU).
+ */
+#if (defined(SUN4) || defined(SUN4C) || defined(SUN4E)) && \
+ (defined(SUN4D) || defined(SUN4M)) && !defined(SMALL_KERNEL)
+ if (CPU_ISSUN4OR4COR4E)
+ vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS_OLD;
+ else
+ vm_min_kernel_address = VM_MIN_KERNEL_ADDRESS_SRMMU;
+ vm_kernel_space_size = VM_MAX_KERNEL_ADDRESS - vm_min_kernel_address;
+#endif
+
bzero(&cpuinfo, sizeof(struct cpu_softc));
cpuinfo.master = 1;
getcpuinfo(&cpuinfo, 0);
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index c7555a4d90c..017ccc0d5b2 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.168 2015/02/09 11:52:47 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.169 2015/03/18 20:56:40 miod Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -175,6 +175,17 @@ cpu_startup()
printf("real mem = %lu (%luMB)\n", ptoa(physmem),
ptoa(physmem)/1024/1024);
+#if (defined(SUN4D) || defined(SUN4M)) && !defined(SMALL_KERNEL)
+ /*
+ * uvm_km_init() has allocated all the virtual memory below the
+ * end of the kernel image. If VM_MIN_KERNEL_ADDRESS is below
+ * KERNBASE, we need to reclaim that range.
+ */
+ if (vm_min_kernel_address < (vaddr_t)KERNBASE) {
+ uvm_unmap(kernel_map, vm_min_kernel_address, (vaddr_t)KERNBASE);
+ }
+#endif
+
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c
index a5f31f3fb8b..ce0116198a5 100644
--- a/sys/arch/sparc/sparc/pmap.c
+++ b/sys/arch/sparc/sparc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.175 2015/03/18 20:49:40 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.176 2015/03/18 20:56:40 miod Exp $ */
/* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */
/*
@@ -82,6 +82,19 @@
#include <sparc/sparc/vaddrs.h>
#include <sparc/sparc/cpuvar.h>
+#ifdef SMALL_KERNEL
+/*
+ * Force the SRMMU code to be limited to the Sun-4 compatible VM layout.
+ * (this is done here to allow installation kernels to be loaded by older
+ * boot blocks which do not map enough data after the kernel image to
+ * cover pmap_bootstrap() needs.)
+ */
+#undef NUREG_4M
+#undef NKREG_4M
+#define NUREG_4M NUREG_4C
+#define NKREG_4M NKREG_4C
+#endif
+
#ifdef DEBUG
#define PTE_BITS "\20\40V\37W\36S\35NC\33IO\32U\31M"
#define PTE_BITS4M "\20\10C\7M\6R\5ACC3\4ACC2\3ACC1\2TYP2\1TYP1"
@@ -184,6 +197,20 @@ pvhead(int pnum)
struct pool pvpool;
+unsigned int nureg, nkreg;
+#if (defined(SUN4) || defined(SUN4C) || defined(SUN4E)) && \
+ !(defined(SUN4D) || defined(SUN4M))
+#define NUREG NUREG_4C
+#define NKREG NKREG_4C
+#elif (defined(SUN4D) || defined(SUN4M)) && \
+ !(defined(SUN4) || defined(SUN4C) || defined(SUN4E))
+#define NUREG NUREG_4M
+#define NKREG NKREG_4M
+#else
+#define NUREG nureg
+#define NKREG nkreg
+#endif
+
#if defined(SUN4M)
/*
* Memory pools and back-end supplier for SRMMU page tables.
@@ -361,13 +388,13 @@ caddr_t vpage[2]; /* two reserved MD virtual pages */
smeg_t tregion; /* [4/3mmu] Region for temporary mappings */
struct pmap kernel_pmap_store; /* the kernel's pmap */
-struct regmap kernel_regmap_store[NKREG]; /* the kernel's regmap */
-struct segmap kernel_segmap_store[NKREG*NSEGRG];/* the kernel's segmaps */
+struct regmap kernel_regmap_store[NKREG_MAX]; /* the kernel's regmap */
+struct segmap kernel_segmap_store[NKREG_MAX*NSEGRG];/* the kernel's segmaps */
#if defined(SUN4M)
-u_int *kernel_regtable_store; /* 1k of storage to map the kernel */
-u_int *kernel_segtable_store; /* 2k of storage to map the kernel */
-u_int *kernel_pagtable_store; /* 128k of storage to map the kernel */
+u_int *kernel_regtable_store; /* 8k of storage to map the kernel */
+u_int *kernel_segtable_store; /* 16k of storage to map the kernel */
+u_int *kernel_pagtable_store; /* 1M of storage to map the kernel */
#endif
struct memarr *pmemarr; /* physical memory regions */
@@ -860,7 +887,7 @@ pmap_page_upload(void)
if (end < chop)
chop = end;
#ifdef DEBUG
- prom_printf("bootstrap gap: start %lx, chop %lx, end %lx\n",
+ printf("bootstrap gap: start %lx, chop %lx, end %lx\n",
start, chop, end);
#endif
uvm_page_physload(atop(start), atop(chop),
@@ -1086,18 +1113,21 @@ 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(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.
+ * (i.e. regions VA_VREG(VM_MIN_KERNEL_ADDRESS_SRMMU) == NUREG to 0xff).
*/
- regtblrover =
- ((regtblptd & ~SRMMU_TETYPE) << SRMMU_PPNPASHIFT) +
- (VA_VREG(VM_MIN_KERNEL_ADDRESS)+1) * sizeof(long); /* kernel only */
+ regtblrover = ((regtblptd & ~SRMMU_TETYPE) << SRMMU_PPNPASHIFT) +
+ NUREG_4M * sizeof(long); /* kernel only */
- for (i = VA_VREG(VM_MIN_KERNEL_ADDRESS) + 1; i < SRMMU_L1SIZE;
- i++, regtblrover += sizeof(long)) {
+ for (i = NUREG_4M; i < SRMMU_L1SIZE; i++, regtblrover += sizeof(long)) {
+ /*
+ * Ignore the region spanning the area where the kernel has
+ * been loaded, since this 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.
+ */
+ if (i == VA_VREG(KERNBASE))
+ continue;
/* The region we're dealing with */
rp = &kpmap->pm_regmap[i];
@@ -1660,7 +1690,7 @@ mmu_pagein(pm, va, prot)
rp = &pm->pm_regmap[vr];
#ifdef DEBUG
if (pm == pmap_kernel())
-printf("mmu_pagein: kernel wants map at va 0x%x, vr %d, vs %d\n", va, vr, vs);
+printf("mmu_pagein: kernel wants map at va 0x%lx, vr %d, vs %d\n", va, vr, vs);
#endif
/* return 0 if we have no PMEGs to load */
@@ -1798,7 +1828,7 @@ ctx_alloc(pm)
cache_flush_context();
rp = pm->pm_regmap;
- for (va = 0, i = NUREG; --i >= 0; ) {
+ for (va = 0, i = NUREG_4C; --i >= 0; ) {
if (VA_VREG(va) >= gap_start) {
va = VRTOVA(gap_end);
i -= gap_end - gap_start;
@@ -1806,7 +1836,7 @@ ctx_alloc(pm)
if (i < 0)
break;
/* mustn't re-enter this branch */
- gap_start = NUREG;
+ gap_start = NUREG_4C;
}
if (HASSUN4_MMU3L) {
setregmap(va, rp++->rg_smeg);
@@ -2241,7 +2271,7 @@ pv_link4_4c(pv, pm, va, nc)
printf(
"pv_link: badalias: pid %d, 0x%lx<=>0x%lx, pa 0x%lx\n",
curproc ? curproc->p_pid : -1,
- va, npv->pv_va, -1); /* XXX -1 */
+ va, npv->pv_va, (vaddr_t)-1); /* XXX -1 */
#endif
/* Mark list head `uncached due to aliases' */
pmap_stats.ps_alias_uncache++;
@@ -2567,7 +2597,7 @@ pv_link4m(pv, pm, va, nc)
printf(
"pv_link: badalias: pid %d, 0x%lx<=>0x%lx, pa 0x%lx\n",
curproc ? curproc->p_pid : -1,
- va, npv->pv_va, -1); /* XXX -1 */
+ va, npv->pv_va, (vaddr_t)-1); /* XXX -1 */
#endif
/* Mark list head `uncached due to aliases' */
pmap_stats.ps_alias_uncache++;
@@ -2706,6 +2736,9 @@ pmap_bootstrap4_4c(void *top, int nctx, int nregion, int nsegment)
int lastpage;
extern char kernel_text[];
+ nureg = NUREG_4C;
+ nkreg = NKREG_4C;
+
/*
* Compute `va2pa_offset'.
* Use `kernel_text' to probe the MMU translation since
@@ -2740,7 +2773,7 @@ pmap_bootstrap4_4c(void *top, int nctx, int nregion, int nsegment)
#endif
#endif
-#if defined(SUN4M) /* We're in a dual-arch kernel. Setup 4/4c fn. ptrs */
+#if defined(SUN4D) || defined(SUN4M) /* We're in a dual-arch kernel. Setup 4/4c fn. ptrs */
pmap_clear_modify_p = pmap_clear_modify4_4c;
pmap_clear_reference_p = pmap_clear_reference4_4c;
pmap_copy_page_p = pmap_copy_page4_4c;
@@ -2778,8 +2811,8 @@ pmap_bootstrap4_4c(void *top, int nctx, int nregion, int nsegment)
#endif
TAILQ_INIT(&kernel_pmap_store.pm_seglist);
- kernel_pmap_store.pm_regmap = &kernel_regmap_store[-NUREG];
- for (i = NKREG; --i >= 0;) {
+ kernel_pmap_store.pm_regmap = &kernel_regmap_store[-NUREG_4C];
+ for (i = NKREG_4C; --i >= 0;) {
#if defined(SUN4_MMU3L)
kernel_regmap_store[i].rg_smeg = reginval;
#endif
@@ -2886,9 +2919,9 @@ pmap_bootstrap4_4c(void *top, int nctx, int nregion, int nsegment)
*/
lastpage = NPTESG;
- 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 */
+ p = (caddr_t)VM_MIN_KERNEL_ADDRESS_OLD; /* first va */
+ vs = VA_VSEG(VM_MIN_KERNEL_ADDRESS_OLD);/* first virtual segment */
+ vr = VA_VREG(VM_MIN_KERNEL_ADDRESS_OLD);/* first virtual region */
rp = &pmap_kernel()->pm_regmap[vr];
/* Get region/segment where kernel addresses start */
@@ -3031,10 +3064,10 @@ pmap_bootstrap4_4c(void *top, int nctx, int nregion, int nsegment)
for (i = 1; i < ncontext; i++) {
setcontext4(i);
if (HASSUN4_MMU3L)
- for (p = 0, j = NUREG; --j >= 0; p += NBPRG)
+ for (p = 0, j = NUREG_4C; --j >= 0; p += NBPRG)
setregmap(p, reginval);
else
- for (p = 0, vr = 0; vr < NUREG; vr++) {
+ for (p = 0, vr = 0; vr < NUREG_4C; vr++) {
if (VA_INHOLE(p)) {
p = (caddr_t)MMU_HOLE_END;
vr = VA_VREG(p);
@@ -3087,6 +3120,9 @@ pmap_bootstrap4m(void *top)
extern char kernel_text[];
extern caddr_t reserve_dumppages(caddr_t);
+ nureg = NUREG_4M;
+ nkreg = NKREG_4M;
+
/*
* Compute `va2pa_offset'.
* Use `kernel_text' to probe the MMU translation since
@@ -3118,17 +3154,17 @@ pmap_bootstrap4m(void *top)
kernel_pmap_store.pm_refcount = 1;
/*
- * Set up pm_regmap for kernel to point NUREG *below* the beginning
+ * Set up pm_regmap for kernel to point NUREG_4M *below* the beginning
* of kernel regmap storage. Since the kernel only uses regions
- * above NUREG, we save storage space and can index kernel and
+ * above NUREG_4M, we save storage space and can index kernel and
* user regions in the same way
*/
- kernel_pmap_store.pm_regmap = &kernel_regmap_store[-NUREG];
+ kernel_pmap_store.pm_regmap = &kernel_regmap_store[-NUREG_4M];
kernel_pmap_store.pm_reg_ptps = NULL;
kernel_pmap_store.pm_reg_ptps_pa = 0;
- bzero(kernel_regmap_store, NKREG * sizeof(struct regmap));
- bzero(kernel_segmap_store, NKREG * NSEGRG * sizeof(struct segmap));
- for (i = NKREG; --i >= 0;) {
+ bzero(kernel_regmap_store, NKREG_4M * sizeof(struct regmap));
+ bzero(kernel_segmap_store, NKREG_4M * NSEGRG * sizeof(struct segmap));
+ for (i = NKREG_4M; --i >= 0;) {
kernel_regmap_store[i].rg_segmap =
&kernel_segmap_store[i * NSEGRG];
kernel_regmap_store[i].rg_seg_ptps = NULL;
@@ -3169,14 +3205,14 @@ pmap_bootstrap4m(void *top)
* Allocate context table.
* To keep supersparc happy, minimum alignment is on a 4K boundary.
*/
- ctxtblsize = max(ncontext,1024) * sizeof(int);
+ ctxtblsize = max(ncontext, 1024) * sizeof(int);
cpuinfo.ctx_tbl = (int *)roundup((u_int)p, ctxtblsize);
p = (caddr_t)((u_int)cpuinfo.ctx_tbl + ctxtblsize);
qzero(cpuinfo.ctx_tbl, ctxtblsize);
/*
* Reserve memory for segment and page tables needed to map the entire
- * kernel. This takes (2k + NKREG * 16k) of space, but
+ * kernel. This takes (2k + NKREG_4M * 16k) of space, but
* unfortunately is necessary since pmap_enk *must* be able to enter
* a kernel mapping without resorting to malloc, or else the
* possibility of deadlock arises (pmap_enk4m is called to enter a
@@ -3192,12 +3228,12 @@ pmap_bootstrap4m(void *top)
p = (caddr_t) roundup((u_int)p, SRMMU_L2SIZE * sizeof(long));
kernel_segtable_store = (u_int *)p;
- p += (SRMMU_L2SIZE * sizeof(long)) * NKREG;
+ p += (SRMMU_L2SIZE * sizeof(long)) * NKREG_4M;
bzero(kernel_segtable_store, p - (caddr_t)kernel_segtable_store);
p = (caddr_t) roundup((u_int)p, SRMMU_L3SIZE * sizeof(long));
kernel_pagtable_store = (u_int *)p;
- p += ((SRMMU_L3SIZE * sizeof(long)) * NKREG) * NSEGRG;
+ p += ((SRMMU_L3SIZE * sizeof(long)) * NKREG_4M) * NSEGRG;
bzero(kernel_pagtable_store, p - (caddr_t)kernel_pagtable_store);
/* Round to next page and mark end of stolen pages */
@@ -3225,7 +3261,7 @@ pmap_bootstrap4m(void *top)
/* XXX:rethink - Store pointer to region table address */
cpuinfo.L1_ptps = pmap_kernel()->pm_reg_ptps;
- for (reg = 0; reg < NKREG; reg++) {
+ for (reg = 0; reg < NKREG_4M; reg++) {
struct regmap *rp;
caddr_t kphyssegtbl;
@@ -3233,12 +3269,12 @@ pmap_bootstrap4m(void *top)
* Entering new region; install & build segtbl
*/
- rp = &pmap_kernel()->pm_regmap[reg + VA_VREG(VM_MIN_KERNEL_ADDRESS)];
+ rp = &pmap_kernel()->pm_regmap[reg + NUREG];
kphyssegtbl = (caddr_t)
&kernel_segtable_store[reg * SRMMU_L2SIZE];
- setpgt4m(&pmap_kernel()->pm_reg_ptps[reg + VA_VREG(VM_MIN_KERNEL_ADDRESS)],
+ setpgt4m(&pmap_kernel()->pm_reg_ptps[reg + NUREG],
(PMAP_BOOTSTRAP_VA2PA(kphyssegtbl) >> SRMMU_PPNPASHIFT) |
SRMMU_TEPTD);
@@ -3305,11 +3341,11 @@ pmap_bootstrap4m(void *top)
#ifdef DEBUG /* Sanity checks */
if ((u_int)p % NBPG != 0)
panic("pmap_bootstrap4m: p misaligned?!?");
- if (VM_MIN_KERNEL_ADDRESS % NBPRG != 0)
+ if (VM_MIN_KERNEL_ADDRESS_SRMMU % NBPRG != 0)
panic("pmap_bootstrap4m: VM_MIN_KERNEL_ADDRESS not region-aligned");
#endif
- for (q = (caddr_t) VM_MIN_KERNEL_ADDRESS; q < p; q += NBPG) {
+ for (q = (caddr_t) KERNBASE; q < p; q += NBPG) {
struct regmap *rp;
struct segmap *sp;
int pte, *ptep;
@@ -3567,7 +3603,7 @@ pmap_create()
TAILQ_INIT(&pm->pm_reglist);
if (HASSUN4_MMU3L) {
int i;
- for (i = NUREG; --i >= 0;)
+ for (i = NUREG_4C; --i >= 0;)
pm->pm_regmap[i].rg_smeg = reginval;
}
#endif
@@ -3591,13 +3627,13 @@ pmap_create()
pm->pm_reg_ptps_pa = VA2PA(urp);
/* Invalidate user mappings */
- for (i = 0; i < NUREG; i++)
+ for (i = 0; i < NUREG_4M; i++)
setpgt4m(&pm->pm_reg_ptps[i], SRMMU_TEINVALID);
/* Copy kernel regions */
- for (i = 0; i < NKREG; i++) {
- setpgt4m(&pm->pm_reg_ptps[VA_VREG(VM_MIN_KERNEL_ADDRESS) + i],
- cpuinfo.L1_ptps[VA_VREG(VM_MIN_KERNEL_ADDRESS) + i]);
+ for (i = 0; i < NKREG_4M; i++) {
+ setpgt4m(&pm->pm_reg_ptps[NUREG_4M + i],
+ cpuinfo.L1_ptps[NUREG_4M + i]);
}
}
#endif
@@ -4317,7 +4353,7 @@ pmap_page_protect4_4c(struct vm_page *pg, vm_prot_t prot)
#ifdef DEBUG
if ((pmapdebug & PDB_CHANGEPROT) ||
(pmapdebug & PDB_REMOVE && prot == PROT_NONE))
- printf("pmap_page_protect(0x%lx, 0x%x)\n", pg, prot);
+ printf("pmap_page_protect(%p, 0x%x)\n", pg, prot);
#endif
pv = &pg->mdpage.pv_head;
/*
@@ -4712,7 +4748,7 @@ pmap_page_protect4m(struct vm_page *pg, vm_prot_t prot)
#ifdef DEBUG
if ((pmapdebug & PDB_CHANGEPROT) ||
(pmapdebug & PDB_REMOVE && prot == PROT_NONE))
- printf("pmap_page_protect(0x%lx, 0x%x)\n", pg, prot);
+ printf("pmap_page_protect(%p, 0x%x)\n", pg, prot);
#endif
pv = &pg->mdpage.pv_head;
/*
@@ -5447,7 +5483,7 @@ pmap_enk4m(pm, va, prot, flags, pv, pteproto)
int wired = (flags & PMAP_WIRED) != 0;
#ifdef DIAGNOSTIC
- if (va < VM_MIN_KERNEL_ADDRESS)
+ if (VA_VREG(va) < NUREG_4M)
panic("pmap_enk4m: can't enter va 0x%lx below VM_MIN_KERNEL_ADDRESS", va);
#endif
rp = &pm->pm_regmap[VA_VREG(va)];
@@ -5528,7 +5564,7 @@ pmap_enu4m(pm, va, prot, flags, pv, pteproto)
int wired = (flags & PMAP_WIRED) != 0;
#ifdef DEBUG
- if (VM_MIN_KERNEL_ADDRESS < va)
+ if (VA_VREG(va) >= NUREG_4M)
panic("pmap_enu4m: can't enter va 0x%lx above VM_MIN_KERNEL_ADDRESS", va);
#endif
diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c
index 6dd2af60776..11478c6c26b 100644
--- a/sys/arch/sparc/sparc/trap.c
+++ b/sys/arch/sparc/sparc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.69 2014/11/16 12:30:59 deraadt Exp $ */
+/* $OpenBSD: trap.c,v 1.70 2015/03/18 20:56:40 miod Exp $ */
/* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */
/*
@@ -633,7 +633,7 @@ mem_access_fault(type, ser, v, pc, psr, tf)
*/
if (cold)
goto kfault;
- if (va >= VM_MIN_KERNEL_ADDRESS) {
+ if (va >= VM_MIN_KERNEL_ADDRESS_OLD) {
if (uvm_fault(kernel_map, va, 0, ftype) == 0)
return;
goto kfault;
@@ -870,7 +870,7 @@ mem_access_fault4m(type, sfsr, sfva, tf)
*/
if (cold)
goto kfault;
- if (va >= VM_MIN_KERNEL_ADDRESS) {
+ if (va >= vm_min_kernel_address) {
if (uvm_fault(kernel_map, va, 0, ftype) == 0)
return;
goto kfault;