hi,all I am trying to check how hypercall works. For example , one guest call HYPERVISOR_update_va_mapping(), next thing is to call _hypercall4(int, update_va_mapping, va,new_val.pte_low, pte_hi, flags) Then I find the core of _hypercall14 is call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32). The hypercalls are mapped into a page so guest call call it through functions in that page. However, I couldn''t trace deeper from here. grep for "hypercall_page" gets no answer. My question is when is this page filled with hypercall functions and Where can I find codes of this core functions? Any advice is appreciated. Thanks _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jayaraman, Bhaskar
2009-Mar-11 10:08 UTC
RE: [Xen-devel] how can I find code of hypercall?
I''ve done this on an HVM. For Intel, you can go to platform-pci and dump the hypercall page on the console 4 bytes at a time. Each 4 byte value on the hypercall page constitutes an Intel x86 instruction, and you should find something like this: - 0xc1010f00 0xccccccc3 0xcccccccc 0xcccccccc 0xcccccccc 0xcccccccc 0xcccccccc 0x1b8 . . The first instruction is the vmcall opcode. You can also check this mail thread I had once with the community: - http://markmail.org/message/p2qbgp7caqhyijks#query:vmcall%200f01c1+page:1+mid:oszzmoks45ilqjuz+state:results Regards, Bhaskar. -----Original Message----- From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of leilei175@gmail.com Sent: Wednesday, March 11, 2009 3:23 PM To: xen-devel@lists.xensource.com Subject: [Xen-devel] how can I find code of hypercall? hi,all I am trying to check how hypercall works. For example , one guest call HYPERVISOR_update_va_mapping(), next thing is to call _hypercall4(int, update_va_mapping, va,new_val.pte_low, pte_hi, flags) Then I find the core of _hypercall14 is call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32). The hypercalls are mapped into a page so guest call call it through functions in that page. However, I couldn''t trace deeper from here. grep for "hypercall_page" gets no answer. My question is when is this page filled with hypercall functions and Where can I find codes of this core functions? Any advice is appreciated. Thanks _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 11/03/2009 10:08, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote:> I''ve done this on an HVM. For Intel, you can go to platform-pci and dump the > hypercall page on the console 4 bytes at a time. Each 4 byte value on the > hypercall page constitutes an Intel x86 instruction, and you should find > something like this: - > 0xc1010f00 > 0xccccccc3You know x86 instructions are not fixed-length, right? Actually the instruction sequence is: 0xb8 <imm32> : mov imm32,%eax (5-byte instruction) 0x0f 0x01 0xc1 : vmcall (3-byte instruction) 0xc3 : ret (1-byte instruction) See xen/arch/x86/hvm/vmx/vmx.c:vmx_init_hypercall_page(). -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jayaraman, Bhaskar
2009-Mar-11 11:46 UTC
RE: [Xen-devel] how can I find code of hypercall?
I''m sorry I wasn''t aware of this, and I assumed that an instruction prefetch operation would always fetch fixed amount of bytes. Not sure now how prefetch works in Intel. Thank you, Bhaskar. -----Original Message----- From: Keir Fraser [mailto:keir.fraser@eu.citrix.com] Sent: Wednesday, March 11, 2009 3:56 PM To: Jayaraman, Bhaskar; leilei175@gmail.com; xen-devel@lists.xensource.com Subject: Re: [Xen-devel] how can I find code of hypercall? On 11/03/2009 10:08, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote:> I''ve done this on an HVM. For Intel, you can go to platform-pci and dump the > hypercall page on the console 4 bytes at a time. Each 4 byte value on the > hypercall page constitutes an Intel x86 instruction, and you should find > something like this: - > 0xc1010f00 > 0xccccccc3You know x86 instructions are not fixed-length, right? Actually the instruction sequence is: 0xb8 <imm32> : mov imm32,%eax (5-byte instruction) 0x0f 0x01 0xc1 : vmcall (3-byte instruction) 0xc3 : ret (1-byte instruction) See xen/arch/x86/hvm/vmx/vmx.c:vmx_init_hypercall_page(). -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Hi, keir and Jayaraman, Thanks for your explanation Keir Fraser wrote:> On 11/03/2009 10:08, "Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> wrote: > > >> I''ve done this on an HVM. For Intel, you can go to platform-pci and dump the >> hypercall page on the console 4 bytes at a time. Each 4 byte value on the >> hypercall page constitutes an Intel x86 instruction, and you should find >> something like this: - >> 0xc1010f00 >> 0xccccccc3 >> > > You know x86 instructions are not fixed-length, right? Actually the > instruction sequence is: > 0xb8 <imm32> : mov imm32,%eax (5-byte instruction) > 0x0f 0x01 0xc1 : vmcall (3-byte instruction) > 0xc3 : ret (1-byte instruction) > > See xen/arch/x86/hvm/vmx/vmx.c:vmx_init_hypercall_page(). > > -- Keir > > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Goswin von Brederlow
2009-Mar-11 14:16 UTC
Re: [Xen-devel] how can I find code of hypercall?
"Jayaraman, Bhaskar" <Bhaskar.Jayaraman@lsi.com> writes:> I''m sorry I wasn''t aware of this, and I assumed that an instruction prefetch operation would always fetch fixed amount of bytes. Not sure now how prefetch works in Intel. > Thank you, > Bhaskar.Magically or near enough. There is a reason why basically any modern cpu has fixed length. MfG Goswin _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel