Convert guest logical address to host physical address
Hi Everybody,
I need to get the task_struct's address of current process in a virtual machine monitor (such as Bitvisor).
Because of, in kernel mode, each process has an 8kb-sized (or 4kb) memory area which contains a stack starts at the beginning of the area (with highest address) and a struct named "thread_info" start at the end. An operation: esp & 0xffffe000 (esp & 0xfffff000 for 4Kb stack size) helps bring out the address of "thread_info". Since the task_struct's address can be calculated from the first field of "thread_info", I want to convert guest virtual address of thread_info struct to host physical address i hyoervisor level as below:
thread_info_guest_logical = VMCS.rsp & 0xffffe000
thread_info_host_logical =guest_logic_to_host_physic(....);
I need a proper C function such as guest_logic_to_host_physic in the Intel platform.
Anybody know about this or have suggestion ?
Many thanks.
|