summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2013-12-26 07:10:54 +0000
committermarcel <marcel@FreeBSD.org>2013-12-26 07:10:54 +0000
commitd9cb31b8aec01ac93a633f10e1cf3e972cd51e70 (patch)
tree5210f6dbc23214585f0ebde5d6a47404418acb4f
parentdf5d69cc0da0425416664581e54124acda435772 (diff)
downloadFreeBSD-src-d9cb31b8aec01ac93a633f10e1cf3e972cd51e70.zip
FreeBSD-src-d9cb31b8aec01ac93a633f10e1cf3e972cd51e70.tar.gz
Fix "kptdir is itself virtual" error, caused by having the kptdir in PBVM.
While here improve errors by having them include addresses (either virtual or physical).
-rw-r--r--lib/libkvm/kvm_ia64.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/libkvm/kvm_ia64.c b/lib/libkvm/kvm_ia64.c
index 74e2b80..f6df7cc 100644
--- a/lib/libkvm/kvm_ia64.c
+++ b/lib/libkvm/kvm_ia64.c
@@ -100,20 +100,23 @@ _kvm_pa2off(kvm_t *kd, uint64_t pa, off_t *ofs, size_t pgsz)
Elf64_Phdr *p = (Elf64_Phdr*)((char*)e + e->e_phoff);
int n = e->e_phnum;
- if (pa != REGION_ADDR(pa)) {
- _kvm_err(kd, kd->program, "internal error");
- return (0);
- }
+ if (pa != REGION_ADDR(pa))
+ goto fail;
while (n && (pa < p->p_paddr || pa >= p->p_paddr + p->p_memsz))
p++, n--;
if (n == 0)
- return (0);
+ goto fail;
*ofs = (pa - p->p_paddr) + p->p_offset;
if (pgsz == 0)
return (p->p_memsz - (pa - p->p_paddr));
return (pgsz - ((size_t)pa & (pgsz - 1)));
+
+ fail:
+ _kvm_err(kd, kd->program, "invalid physical address %#llx",
+ (unsigned long long)pa);
+ return (0);
}
static ssize_t
@@ -225,7 +228,7 @@ _kvm_initvtop(kvm_t *kd)
return (-1);
}
- if (va < REGION_BASE(6)) {
+ if (va == REGION_BASE(5)) {
_kvm_err(kd, kd->program, "kptdir is itself virtual");
return (-1);
}
@@ -286,7 +289,8 @@ _kvm_kvatop(kvm_t *kd, u_long va, off_t *ofs)
}
fail:
- _kvm_err(kd, kd->program, "invalid kernel virtual address");
+ _kvm_err(kd, kd->program, "invalid kernel virtual address %#llx",
+ (unsigned long long)va);
*ofs = ~0UL;
return (0);
}
OpenPOWER on IntegriCloud