summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2002-12-27 01:45:05 +0000
committerjake <jake@FreeBSD.org>2002-12-27 01:45:05 +0000
commit49979268c1114288b74c15cebb07a7a1700f0df2 (patch)
treed9614cb129419d1a0e45810adf6c6331da8e19e5 /lib
parent8c4109166a72af33f7e06f0493c7b3f2db2145fa (diff)
downloadFreeBSD-src-49979268c1114288b74c15cebb07a7a1700f0df2.zip
FreeBSD-src-49979268c1114288b74c15cebb07a7a1700f0df2.tar.gz
Teach libkvm to deal with direct mapped addresses.
Diffstat (limited to 'lib')
-rw-r--r--lib/libkvm/kvm_sparc64.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/libkvm/kvm_sparc64.c b/lib/libkvm/kvm_sparc64.c
index 081ddf8..167d1f4 100644
--- a/lib/libkvm/kvm_sparc64.c
+++ b/lib/libkvm/kvm_sparc64.c
@@ -64,6 +64,7 @@ static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93";
#include <machine/kerneldump.h>
#include <machine/tte.h>
+#include <machine/tlb.h>
#include <machine/tsb.h>
#include <limits.h>
@@ -198,17 +199,21 @@ _kvm_kvatop(kvm_t *kd, u_long va, u_long *pa)
u_long pg_off, vpn;
int rest;
- vpn = btop(va);
pg_off = va & PAGE_MASK;
- tte_off = kd->vmst->vm_tsb_off +
- ((vpn & kd->vmst->vm_tsb_mask) << TTE_SHIFT);
-
- if (!_kvm_read_phys(kd, tte_off, &tte, sizeof(tte)))
- goto invalid;
- if (!tte_match(&tte, va))
- goto invalid;
+ if (va >= VM_MIN_DIRECT_ADDRESS)
+ pa_off = TLB_DIRECT_TO_PHYS(va) & ~PAGE_MASK;
+ else {
+ vpn = btop(va);
+ tte_off = kd->vmst->vm_tsb_off +
+ ((vpn & kd->vmst->vm_tsb_mask) << TTE_SHIFT);
+ if (!_kvm_read_phys(kd, tte_off, &tte, sizeof(tte)))
+ goto invalid;
+ if (!tte_match(&tte, va))
+ goto invalid;
+ pa_off = TTE_GET_PA(&tte);
+ }
rest = PAGE_SIZE - pg_off;
- pa_off = _kvm_find_off(kd->vmst, TTE_GET_PA(&tte), rest);
+ pa_off = _kvm_find_off(kd->vmst, pa_off, rest);
if (pa_off == KVM_OFF_NOTFOUND)
goto invalid;
*pa = pa_off + pg_off;
OpenPOWER on IntegriCloud