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
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: - 0xc1010f000xccccccc30xcccccccc0xcccccccc0xcccccccc0xcccccccc0xcccccccc0x1b8
.
.
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: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Wednesday, March 11, 2009 3:23 PM
To: [email protected]
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
[email protected]
http://lists.xensource.com/xen-devel
Quoted 6 lines · Bhaskar
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: -
0xc1010f000xccccccc3
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
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:[email protected]]
Sent: Wednesday, March 11, 2009 3:56 PM
To: Jayaraman, Bhaskar; [email protected]; [email protected]
Subject: Re: [Xen-devel] how can I find code of hypercall?
Quoted 6 lines · Bhaskar
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: -
0xc1010f000xccccccc3
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
Quoted 3 lines · Bhaskar
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
Hi, keir and Jayaraman,
Thanks for your explanation
Quoted 23 lines · Keir Fraser
Quoted 6 lines · Bhaskar
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: -
0xc1010f000xccccccc3You know x86 instructions are not fixed-length, right? Actually the instruction sequence is:
0xb8<imm32> : mov imm32,%eax (5-byte instruction)
0x0f0x010xc1: vmcall (3-byte instruction)
0xc3: ret (1-byte instruction)See xen/arch/x86/hvm/vmx/vmx.c:vmx_init_hypercall_page().
-- Keir