Skip to content

Commit

Permalink
vmm: Dump RIP's page memory on triple fault
Browse files Browse the repository at this point in the history
  • Loading branch information
chp-io committed Feb 24, 2024
1 parent dd3d79b commit e6aabbd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vmm/src/hve/arch/intel_x64/vcpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,24 @@ bool vcpu::debug_triple_fault(::bfvmm::intel_x64::vcpu *vcpu)
auto insn = disasm()->disasm_single(map.get(), rip, len, mode);

printv("%s: ", __func__);
printf("%2" PRIx64 " ", insn->address);
printf("[0x%2x] ", insn->address);
for (int i = 0; i < insn->size; i++) {
if (i > 0)
putchar(' ');
printf("%02x", insn->bytes[i]);
}
printf(" %s %s\n", insn->mnemonic, insn->op_str);

printv("%s: dumping page:\n", __func__);
const auto start_addr = rip & 0xFFFFFFFFFFFFF000ULL;
const auto page_size = 0x1000ULL;
const auto map_page = vcpu->map_gva_4k<uint8_t>(start_addr, page_size);
const auto buf = map_page.get();
for (int i = 0; i < page_size; i++) {
printf(" %02x", buf[i]);
}
printf("\n");

vcpu->halt("debugging triple fault");

return true;
Expand Down

0 comments on commit e6aabbd

Please sign in to comment.