Mailing List Archive

CR3 Virtual Address
Hello everybody,

I have to work with the Xen 4.2 memory management code for a research
project and I have some questions.

1) Since I have to change and/or remove some entries in the hypervisor
page table, I would like to know the "virtual address" of the CR3
register.

2) I would also like to know if the VMCS virtual address is mapped inside
the
page table pointed by the HOST_CR3.

3) Are there functions to perform the page walking on the hypervisor
page tables?


Thank you for the attention,


Best Regards.
Re: CR3 Virtual Address [ In reply to ]
On 28/11/12 14:48, emdel wrote:
> Hello everybody,
>
> I have to work with the Xen 4.2 memory management code for a research
> project and I have some questions.
>
> 1) Since I have to change and/or remove some entries in the hypervisor
> page table, I would like to know the "virtual address" of the CR3
> register.

CR3 is a register, not memory mapped. Do you mean the virtual address
of the top level pagetable? That will depend on which mode you are
running in, and which CR3 you are actually looking for.

>
> 2) I would also like to know if the VMCS virtual address is mapped
> inside the
> page table pointed by the HOST_CR3.

The host cr3 is the set of pagetables to use when a VMEXIT happens. The
VCMS of the HVM guest in question will be mapped into this address space.

>
> 3) Are there functions to perform the page walking on the hypervisor
> page tables?

There are generic page walk functions, which can be used to walk the
hypervisor tables. Why do you want to do this?

~Andrew

>
>
> Thank you for the attention,
>
>
> Best Regards.

--
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
Re: CR3 Virtual Address [ In reply to ]
On 28/11/12 14:48, emdel wrote:
> Hello everybody,
>
> I have to work with the Xen 4.2 memory management code for a research
> project and I have some questions.
>
> 1) Since I have to change and/or remove some entries in the hypervisor
> page table, I would like to know the "virtual address" of the CR3
> register.
As per Andy Cooper's answer, but further:
Exactly (or at least roughly) what are you trying to achieve?
You want to "remove" some memory from the hypervisor itself? Who/what
will use this memory?
It is MUCH easier to advice on HOW to do something if we understand what
you are actually trying to do.
>
> 2) I would also like to know if the VMCS virtual address is mapped
> inside the
> page table pointed by the HOST_CR3.
The "HOST_CR3" is the Xen (VCPU's) true CR3 (for the "host" or "root"
mode, as Intel calls it - this is the hypervisor itself). it is set from
vcpu.arch.cr3. So the VMCS is available here, or the system would crash
when it returns from guest operation.
>
> 3) Are there functions to perform the page walking on the hypervisor
> page tables?
Yes. As per Andy Cooper's answer.

--
Mats
>
>
> Thank you for the attention,
>
>
> Best Regards.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
Re: CR3 Virtual Address [ In reply to ]
On Wed, Nov 28, 2012 at 4:06 PM, Mats Petersson
<mats.petersson@citrix.com>wrote:

> As per Andy Cooper's answer, but further:
> Exactly (or at least roughly) what are you trying to achieve?
> You want to "remove" some memory from the hypervisor itself? Who/what will
> use this memory?
> It is MUCH easier to advice on HOW to do something if we understand what
> you are actually trying to do.



For my project I'm trying to dump all physical memory of the machine from
hypervisor layer so I can get access to all physical memory. Then when I
obtained the dump of the physical pages I want to find out the VMCS
structures
of the running guests. In order to do that I was thinking that I can insert
an entry
into a HV page table that maps an arbitrary virtual address into a determine
physical address. By using this trick I should be able to map all the
physical
memory address and read/dump it by reading the virtual address.

So following this solution my problem now is to find out the virtual
address of
the page directory pointer table (pae address mode 32 bits).



> The "HOST_CR3" is the Xen (VCPU's) true CR3 (for the "host" or "root"
> mode, as Intel calls it - this is the hypervisor itself). it is set from
> vcpu.arch.cr3. So the VMCS is available here, or the system would crash
> when it returns from guest operation.



Ok, perfect.



>
> 3) Are there functions to perform the page walking on the hypervisor
>> page tables?
>>
> Yes. As per Andy Cooper's answer.
>


Actually we would like to know if there are any functions for mapping a
physical page into a virtual page. Could you please point me out in more
precisely way to the name of those functions? I'm working with pae address
mode 32 bits.


Thanks