[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] machine address



At 10:26 +0100 on 31 Mar (1427797566), George Dunlap wrote:
> On Mon, Mar 30, 2015 at 3:00 PM, HANNAS YAYA Issa
> <issa.hannasyaya@xxxxxxxxxxx> wrote:
> > Hi
> > When there is a page fault the trapper of the page fault in the hypervisor
> > is do_page_fault in xen/arch/x86/traps.c right?
> 
> That's for PV guests.  For HVM guests, the page fault causes a VMEXIT,
> which will be handled in
> xen/arch/x86/hvm/vmx/vmx.c:vmx_vmexit_handler()  (on Intel).
> 
> > in this funcion i found a method read_cr2() which return the virtual adrress
> > of the page who generate the page fault.
> > My question is : is it possible to get the machine address of the page table
> > entry for this virtual address?
> 
> In general the way you have to do that is to use the virtual address
> to walk the guest's pagetables (exactly the same way the hardware
> would do on a TLB miss).
> 
> For HVM guests (or PV guests in shadow mode) there's already code to
> do walk for you in xen/arch/x86/mm/guest_walk.c:guest_walk().  You can
> see how it's called from the HAP code and the shadow code if you want.
> 
> I don't immediately see a walker for PV guests.

There one in __page_fault_type().  You can also use the linear
pagetable mappings, if you know what you're doing -- see,
e.g., guest_map_l1e() which does something very like this.

Cheers,

Tim.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.