Read guest virtual memory in KVM
I am new to KVM. I need to write a KVM ioctl that on being called from host userland, takes a specified virtual address in guest OS, reads a number of bytes at the guest Virtual address, and returns the contents to the host userland application.
I understand that I will have to write some user app which can ioctl into /dev/kvm (which is probably tricky anyway to start).
The main issue for me right now is, how to read contents at guest virtual address. Lets say the hose userland application has knowledge only about virtual addresses. I see kvm_main.c has a function kvm_read_guest which uses guest physical address. Should I use this function and convert all my virtual addresses to Physical before issuing the read? Or is there any better function to read virtual memory directly?
Thanks in advance for the reply.