diff options
Diffstat (limited to 'lib/libkvm/kvm_amd64.c')
-rw-r--r-- | lib/libkvm/kvm_amd64.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c index e73e6a2..af5eb28 100644 --- a/lib/libkvm/kvm_amd64.c +++ b/lib/libkvm/kvm_amd64.c @@ -73,7 +73,9 @@ static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"; #define ptob(x) (amd64_ptob(x)) #endif +/* minidump must be the first item! */ struct vmstate { + int minidump; /* 1 = minidump mode */ void *mmapbase; size_t mmapsize; pml4_entry_t *PML4; @@ -128,6 +130,8 @@ _kvm_freevtop(kvm_t *kd) { struct vmstate *vm = kd->vmst; + if (kd->vmst->minidump) + return (_kvm_minidump_freevtop(kd)); if (vm->mmapbase != NULL) munmap(vm->mmapbase, vm->mmapsize); if (vm->PML4) @@ -145,6 +149,11 @@ _kvm_initvtop(kvm_t *kd) pml4_entry_t *PML4; Elf_Ehdr *ehdr; size_t hdrsz; + char minihdr[8]; + + if (pread(kd->pmfd, &minihdr, 8, 0) == 8) + if (memcmp(&minihdr, "minidump", 8) == 0) + return (_kvm_minidump_initvtop(kd)); kd->vmst = (struct vmstate *)_kvm_malloc(kd, sizeof(*kd->vmst)); if (kd->vmst == 0) { @@ -333,6 +342,8 @@ int _kvm_kvatop(kvm_t *kd, u_long va, off_t *pa) { + if (kd->vmst->minidump) + return (_kvm_minidump_kvatop(kd, va, pa)); if (ISALIVE(kd)) { _kvm_err(kd, 0, "kvm_kvatop called in live kernel!"); return (0); |