Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libkvm fix handling of large pages.
details: https://anonhg.NetBSD.org/src/rev/df4a926843ca
branches: trunk
changeset: 772649:df4a926843ca
user: chs <chs%NetBSD.org@localhost>
date: Tue Jan 10 16:01:16 2012 +0000
description:
fix handling of large pages.
diffstat:
lib/libkvm/kvm_x86_64.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diffs (59 lines):
diff -r 4140a44a31af -r df4a926843ca lib/libkvm/kvm_x86_64.c
--- a/lib/libkvm/kvm_x86_64.c Tue Jan 10 15:23:11 2012 +0000
+++ b/lib/libkvm/kvm_x86_64.c Tue Jan 10 16:01:16 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_x86_64.c,v 1.8 2010/09/20 23:23:16 jym Exp $ */
+/* $NetBSD: kvm_x86_64.c,v 1.9 2012/01/10 16:01:16 chs Exp $ */
/*-
* Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: kvm_x86_64.c,v 1.8 2010/09/20 23:23:16 jym Exp $");
+__RCSID("$NetBSD: kvm_x86_64.c,v 1.9 2012/01/10 16:01:16 chs Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -105,7 +105,6 @@
}
cpu_kh = kd->cpu_data;
- page_off = va & PGOFSET;
/*
* Find and read all entries to get to the pa.
@@ -138,6 +137,11 @@
_kvm_err(kd, 0, "invalid translation (invalid level 3 PDE)");
goto lose;
}
+ if (pde & PG_PS) {
+ page_off = va & (NBPD_L3 - 1);
+ *pa = (pde & PG_1GFRAME) + page_off;
+ return (int)(NBPD_L3 - page_off);
+ }
/*
* Level 2.
@@ -152,7 +156,11 @@
_kvm_err(kd, 0, "invalid translation (invalid level 2 PDE)");
goto lose;
}
-
+ if (pde & PG_PS) {
+ page_off = va & (NBPD_L2 - 1);
+ *pa = (pde & PG_2MFRAME) + page_off;
+ return (int)(NBPD_L2 - page_off);
+ }
/*
* Level 1.
@@ -170,6 +178,7 @@
_kvm_err(kd, 0, "invalid translation (invalid PTE)");
goto lose;
}
+ page_off = va & PGOFSET;
*pa = (pte & PG_FRAME) + page_off;
return (int)(NBPG - page_off);
Home |
Main Index |
Thread Index |
Old Index