Module Name: src
Committed By: matt
Date: Thu Jan 28 17:16:42 UTC 2010
Modified Files:
src/lib/libkvm [matt-nb5-mips64]: kvm_mips.c
Log Message:
Teach KVM about where the kernel is when _LP64 is defined.
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.16.1 src/lib/libkvm/kvm_mips.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libkvm/kvm_mips.c
diff -u src/lib/libkvm/kvm_mips.c:1.18 src/lib/libkvm/kvm_mips.c:1.18.16.1
--- src/lib/libkvm/kvm_mips.c:1.18 Tue Jan 15 13:57:42 2008
+++ src/lib/libkvm/kvm_mips.c Thu Jan 28 17:16:42 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_mips.c,v 1.18 2008/01/15 13:57:42 ad Exp $ */
+/* $NetBSD: kvm_mips.c,v 1.18.16.1 2010/01/28 17:16:42 matt Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: kvm_mips.c,v 1.18 2008/01/15 13:57:42 ad Exp $");
+__RCSID("$NetBSD: kvm_mips.c,v 1.18.16.1 2010/01/28 17:16:42 matt Exp $");
#endif /* LIBC_SCCS and not lint */
/*
@@ -102,6 +102,23 @@
cpu_kh = kd->cpu_data;
page_off = va & PGOFSET;
+#ifdef _LP64
+ if (MIPS_XKPHYS_P(va)) {
+ /*
+ * Direct-mapped cached address: just convert it.
+ */
+ *pa = MIPS_XKPHYS_TO_PHYS(va);
+ return (NBPG - page_off);
+ }
+
+ if (va < MIPS_XKPHYS_START) {
+ /*
+ * XUSEG (user virtual address space) - invalid.
+ */
+ _kvm_err(kd, 0, "invalid kernel virtual address");
+ goto lose;
+ }
+#else
if (va < MIPS_KSEG0_START) {
/*
* KUSEG (user virtual address space) - invalid.
@@ -109,8 +126,9 @@
_kvm_err(kd, 0, "invalid kernel virtual address");
goto lose;
}
+#endif
- if (va >= MIPS_KSEG0_START && va < MIPS_KSEG1_START) {
+ if (MIPS_KSEG0_P(va)) {
/*
* Direct-mapped cached address: just convert it.
*/
@@ -118,7 +136,7 @@
return (NBPG - page_off);
}
- if (va >= MIPS_KSEG1_START && va < MIPS_KSEG2_START) {
+ if (MIPS_KSEG1_P(va)) {
/*
* Direct-mapped uncached address: just convert it.
*/
@@ -126,6 +144,16 @@
return (NBPG - page_off);
}
+#ifdef _LP64
+ if (va >= MIPS_KSEG2_START) {
+ /*
+ * KUSEG (user virtual address space) - invalid.
+ */
+ _kvm_err(kd, 0, "invalid kernel virtual address");
+ goto lose;
+ }
+#endif
+
/*
* We now know that we're a KSEG2 (kernel virtually mapped)
* address. Translate the address using the pmap's kernel
@@ -136,10 +164,17 @@
* Step 1: Make sure the kernel page table has a translation
* for the address.
*/
+#ifdef _LP64
+ if (va >= (MIPS_XKSEG_START + (cpu_kh->sysmapsize * NBPG))) {
+ _kvm_err(kd, 0, "invalid XKSEG address");
+ goto lose;
+ }
+#else
if (va >= (MIPS_KSEG2_START + (cpu_kh->sysmapsize * NBPG))) {
_kvm_err(kd, 0, "invalid KSEG2 address");
goto lose;
}
+#endif
/*
* Step 2: Locate and read the PTE.