summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm_i386.c
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>1997-08-17 17:42:59 +0000
committertegge <tegge@FreeBSD.org>1997-08-17 17:42:59 +0000
commit3dbac0faf6b7dc794192d426b80fe2adba124c7a (patch)
treefb189c0892fc4a0504279cd73195abde5d4d92d5 /lib/libkvm/kvm_i386.c
parente1e14dc94ca2d5ba5c9c722980c0c9aed6b07765 (diff)
downloadFreeBSD-src-3dbac0faf6b7dc794192d426b80fe2adba124c7a.zip
FreeBSD-src-3dbac0faf6b7dc794192d426b80fe2adba124c7a.tar.gz
Copy code from gnu/usr.bin/gdb/gdb/kvm-fbsd.c to deal with 4 MB pages.
Diffstat (limited to 'lib/libkvm/kvm_i386.c')
-rw-r--r--lib/libkvm/kvm_i386.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c
index c32fd53..d36b922 100644
--- a/lib/libkvm/kvm_i386.c
+++ b/lib/libkvm/kvm_i386.c
@@ -151,6 +151,19 @@ _kvm_vatop(kvm_t *kd, u_long va, u_long *pa)
if (((u_long)pde & PG_V) == 0)
goto invalid;
+ if ((u_long)pde & PG_PS) {
+ /*
+ * No second-level page table; ptd describes one 4MB page.
+ * (We assume that the kernel wouldn't set PG_PS without enabling
+ * it cr0, and that the kernel doesn't support 36-bit physical
+ * addresses).
+ */
+#define PAGE4M_MASK (NBPDR - 1)
+#define PG_FRAME4M (~PAGE4M_MASK)
+ *pa = ((u_long)pde & PG_FRAME4M) + (va & PAGE4M_MASK);
+ return (NBPDR - (va & PAGE4M_MASK));
+ }
+
pteindex = (va >> PAGE_SHIFT) & (NPTEPG-1);
pte_pa = ((u_long)pde & PG_FRAME) + (pteindex * sizeof(pt_entry_t));
OpenPOWER on IntegriCloud