summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-11-22 00:07:05 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-11-22 00:07:05 +0000
commita2feff6f6e67265d6246eedb1e93779a5540bfc0 (patch)
treebf99709c25a5b2d09c035aa8ead704e037ecf9a8 /sys
parentcd1108ad13a0da9d29d3357b59a3a562df545780 (diff)
Allow mips ports to override VM_{MIN,MAX}_KERNEL_ADDRESS, and provide the
address as a kernel variable for use by libkvm. On sgi IP27 and IP30 kernels, use XKSEG instead of CKSSEG; this will allow kernel KVM size to grow in the future if necessary.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mips64/include/vmparam.h6
-rw-r--r--sys/arch/mips64/mips64/pmap.c3
-rw-r--r--sys/arch/mips64/mips64/trap.c14
-rw-r--r--sys/arch/sgi/include/vmparam.h20
4 files changed, 34 insertions, 9 deletions
diff --git a/sys/arch/mips64/include/vmparam.h b/sys/arch/mips64/include/vmparam.h
index 5572ee262ed..38a1d72c423 100644
--- a/sys/arch/mips64/include/vmparam.h
+++ b/sys/arch/mips64/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.17 2009/10/22 18:20:21 miod Exp $ */
+/* $OpenBSD: vmparam.h,v 1.18 2009/11/22 00:07:04 miod Exp $ */
/* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */
/*
@@ -98,8 +98,10 @@
#define VM_MIN_ADDRESS ((vaddr_t)0x0000000000001000L)
#define VM_MAXUSER_ADDRESS ((vaddr_t)0x0000000080000000L)
#define VM_MAX_ADDRESS ((vaddr_t)0x0000000080000000L)
-#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xffffffffc0000000L)
+#ifndef VM_MIN_KERNEL_ADDRESS
+#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xffffffffc0000000L)
#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xfffffffffffff000L)
+#endif
/* map PIE below 256MB (non-pie link address) to avoid mmap pressure */
#define VM_PIE_MIN_ADDR PAGE_SIZE
diff --git a/sys/arch/mips64/mips64/pmap.c b/sys/arch/mips64/mips64/pmap.c
index c678c37c08b..07aa52ca417 100644
--- a/sys/arch/mips64/mips64/pmap.c
+++ b/sys/arch/mips64/mips64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.39 2009/11/19 20:16:27 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.40 2009/11/22 00:07:04 miod Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -131,6 +131,7 @@ u_int tlbpid_cnt = 2; /* next available TLB PID */
pt_entry_t *Sysmap; /* kernel pte table */
u_int Sysmapsize; /* number of pte's in Sysmap */
+const vaddr_t Sysmapbase = VM_MIN_KERNEL_ADDRESS; /* for libkvm */
/*
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c
index d460179aa70..91c3085d574 100644
--- a/sys/arch/mips64/mips64/trap.c
+++ b/sys/arch/mips64/mips64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.50 2009/11/21 23:28:15 syuu Exp $ */
+/* $OpenBSD: trap.c,v 1.51 2009/11/22 00:07:04 miod Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -1122,6 +1122,10 @@ stacktrace(regs)
stacktrace_subr(regs, printf);
}
+#define VALID_ADDRESS(va) \
+ (((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS) || \
+ IS_XKPHYS(va) || ((va) >= CKSEG0_BASE && (va) < CKSSEG_BASE))
+
void
stacktrace_subr(regs, printfn)
struct trap_frame *regs;
@@ -1132,7 +1136,6 @@ stacktrace_subr(regs, printfn)
unsigned instr, mask;
InstFmt i;
int more, stksize;
- extern char edata[];
unsigned int frames = 0;
/* get initial values from the exception frame */
@@ -1157,7 +1160,7 @@ loop:
}
/* check for bad SP: could foul up next frame */
- if (sp & 3 || (!IS_XKPHYS(sp) && sp < CKSEG0_BASE)) {
+ if (sp & 3 || !VALID_ADDRESS(sp)) {
(*printfn)("SP %p: not in kernel\n", sp);
ra = 0;
subr = 0;
@@ -1189,8 +1192,7 @@ loop:
Between((vaddr_t)a, pc, (vaddr_t)b)
/* check for bad PC */
- if (pc & 3 || (!IS_XKPHYS(pc) && pc < CKSEG0_BASE) ||
- pc >= (vaddr_t)edata) {
+ if (pc & 3 || !VALID_ADDRESS(pc)) {
(*printfn)("PC %p: not in kernel\n", pc);
ra = 0;
goto done;
@@ -1336,6 +1338,8 @@ done:
}
}
+#undef VALID_ADDRESS
+
#if !defined(DDB)
/*
* Functions ``special'' enough to print by name
diff --git a/sys/arch/sgi/include/vmparam.h b/sys/arch/sgi/include/vmparam.h
index a55866983c4..210a1aebfee 100644
--- a/sys/arch/sgi/include/vmparam.h
+++ b/sys/arch/sgi/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.4 2009/10/14 20:18:26 miod Exp $ */
+/* $OpenBSD: vmparam.h,v 1.5 2009/11/22 00:07:04 miod Exp $ */
/* public domain */
#ifndef _SGI_VMPARAM_H_
#define _SGI_VMPARAM_H_
@@ -19,6 +19,24 @@
#define VM_NFREELIST 2
#define VM_FREELIST_DMA32 1 /* memory suitable for 32-bit DMA */
+/*
+ * On systems with may use R5000 processors, we limit the kernel virtual
+ * address space to KSSEG and KSEG3.
+ * On systems with R10000 family processors, we use the XKSEG which allows
+ * for a much larger virtual memory size.
+ *
+ * All Octane and Origin class systems are R10000 family based only,
+ * so TGT_COHERENT is safe to use so far.
+ */
+
+#ifdef TGT_COHERENT
+#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xc000000000000000L)
+#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xc000000040000000L)
+#else
+#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0xffffffffc0000000L)
+#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xfffffffffffff000L)
+#endif
+
#include <mips64/vmparam.h>
#endif /* _SGI_VMPARAM_H_ */