summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_mips64.c
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 /lib/libkvm/kvm_mips64.c
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 'lib/libkvm/kvm_mips64.c')
-rw-r--r--lib/libkvm/kvm_mips64.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/libkvm/kvm_mips64.c b/lib/libkvm/kvm_mips64.c
index a2d4df5038d..0537c65796a 100644
--- a/lib/libkvm/kvm_mips64.c
+++ b/lib/libkvm/kvm_mips64.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_mips64.c,v 1.9 2009/10/27 23:59:28 deraadt Exp $ */
+/* $OpenBSD: kvm_mips64.c,v 1.10 2009/11/22 00:07:02 miod Exp $ */
/* $NetBSD: kvm_mips.c,v 1.3 1996/03/18 22:33:44 thorpej Exp $ */
/*-
@@ -60,6 +60,7 @@
struct vmstate {
pt_entry_t *Sysmap;
u_int Sysmapsize;
+ vaddr_t Sysmapbase;
};
void
@@ -96,6 +97,17 @@ _kvm_initvtop(kvm_t *kd)
_kvm_err(kd, kd->program, "cannot read Sysmapsize");
return (-1);
}
+
+ /*
+ * Older kernels might not have this symbol; in which case
+ * we use the value of VM_MIN_KERNEL_ADDRESS they must have.
+ */
+ nlist[0].n_name = "Sysmapbase";
+ nlist[1].n_name = 0;
+ if (kvm_nlist(kd, nlist) != 0 ||
+ KREAD(kd, (u_long)nlist[0].n_value, &vm->Sysmapbase))
+ vm->Sysmapbase = (vaddr_t)KSSEG_BASE;
+
return (0);
}
@@ -134,9 +146,9 @@ _kvm_kvatop(kvm_t *kd, u_long va, paddr_t *pa)
*pa = KSEG0_TO_PHYS(va);
return (int)(PAGE_SIZE - offset);
}
- if (va < VM_MIN_KERNEL_ADDRESS)
+ if (va < vm->Sysmapbase)
goto invalid;
- idx = (va - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT;
+ idx = (va - vm->Sysmapbase) >> PGSHIFT;
if (idx >= vm->Sysmapsize)
goto invalid;
addr = (u_long)(vm->Sysmap + idx);