Hi Dave and manager of qemu-discuss,
I have implemented an extension module for translating KVM guest's
physical address to host's address. The related command is
"qemu-vtop".
The attachment is the code I implemented. Please copy the file to the
crash-<version>/extensions subdirectory and from the top-level
crash-<version> directory, enter:
$ make extensions
(please refer to
http://people.redhat.com/anderson/extensions.html)
To add the module's command(s) to a running crash session, enter:
crash> extend qemu-vtop.so
"mod -s kvm" is needed to load kvm debug-info to offer some data to
qemu-vtop command.
The command uses information of struct "kvm_memslots" to get the
relationship between gpa and hva. Struct "kvm_memslots" is holded by a
file, called "anon_inode:kvm-vm", opened by qemu-kvm. Then, "do_vtop"
is
called to get hpa. About the detailed implementation, please refer to
attachment.
The functionality is limited, but I think it is useful when debugging a
qemu-kvm virtual machine. So I post it.
--
--
Regards
Qiao Nuohan
Nicely done!
I've also added a link to the the module on the extensions page.
Let me know if you ever update or enhance the command, so that
the latest version is always available to download from there.
Thanks,
Dave