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

Re: [Xen-devel] RIP register value in p2m_mem_access_check()



>>> On 06.03.13 at 11:55, Razvan Cojocaru <rzvncj@xxxxxxxxx> wrote:
> Hello again,
> 
> simple test case: added the following statement in 
> xen/arch/x86/mm/p2m.c, in function p2m_mem_access_check():
> 
> printk("v->arch.user_regs.eip: 0x%016lx, __vmread(GUEST_RIP): 
> 0x%016lx\n", v->arch.user_regs.eip, __vmread(GUEST_RIP));
> 
> (where v is current) which dutifully prints out (at the first page fault):
> 
> (XEN) v->arch.user_regs.eip: 0xfffff80002c13a7b, __vmread(GUEST_RIP): 
> 0xfffff8000269ec0a
> 
> They're not equal, and furthermore __vmread(GUEST_RIP) is the correct 
> one (the same value returned by xc_domain_hvm_getcontext_partial()).
> 
> The questions:
> 
> 1. What's the Xen-friendliest way to retrieve the _correct_ values for 
> RIP and all the other registers usually put in a struct hvm_hw_cpu 
> instance, in p2m_mem_access_check()?

v->arch.user_regs.eip is what you should look at. It's
expected to be in sync with the VMCS value as long as
nothing (e.g. emulation) modified the value. There's code in
vmx_asm_vmexit_handler to sync the fields, and in
vmx_asm_do_vmentry to sync them back in the opposite
direction.

> 2. What's the explanation for why things run as they do now?

If the above doesn't work, you're likely in bigger trouble. So
you will want to hunt down why the user_regs field isn't what
you expect it to be.

Jan


_______________________________________________
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®.