All of lore.kernel.org
 help / color / mirror / Atom feed
* how can I find code of hypercall?
@ 2009-03-11  9:52 leilei175
  2009-03-11 10:08 ` Jayaraman, Bhaskar
  0 siblings, 1 reply; 6+ messages in thread
From: leilei175 @ 2009-03-11  9:52 UTC (permalink / raw)
  To: xen-devel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: how can I find code of hypercall?
  2009-03-11  9:52 how can I find code of hypercall? leilei175
@ 2009-03-11 10:08 ` Jayaraman, Bhaskar
  2009-03-11 10:26   ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: Jayaraman, Bhaskar @ 2009-03-11 10:08 UTC (permalink / raw)
  To: leilei175@gmail.com, xen-devel@lists.xensource.com

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how can I find code of hypercall?
  2009-03-11 10:08 ` Jayaraman, Bhaskar
@ 2009-03-11 10:26   ` Keir Fraser
  2009-03-11 11:46     ` Jayaraman, Bhaskar
  2009-03-11 12:37     ` leilei175
  0 siblings, 2 replies; 6+ messages in thread
From: Keir Fraser @ 2009-03-11 10:26 UTC (permalink / raw)
  To: Jayaraman, Bhaskar, leilei175@gmail.com,
	xen-devel@lists.xensource.com

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: how can I find code of hypercall?
  2009-03-11 10:26   ` Keir Fraser
@ 2009-03-11 11:46     ` Jayaraman, Bhaskar
  2009-03-11 14:16       ` Goswin von Brederlow
  2009-03-11 12:37     ` leilei175
  1 sibling, 1 reply; 6+ messages in thread
From: Jayaraman, Bhaskar @ 2009-03-11 11:46 UTC (permalink / raw)
  To: Keir Fraser, leilei175@gmail.com, xen-devel@lists.xensource.com

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 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how can I find code of hypercall?
  2009-03-11 10:26   ` Keir Fraser
  2009-03-11 11:46     ` Jayaraman, Bhaskar
@ 2009-03-11 12:37     ` leilei175
  1 sibling, 0 replies; 6+ messages in thread
From: leilei175 @ 2009-03-11 12:37 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel@lists.xensource.com, Jayaraman, Bhaskar

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
>
>
>
>   

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: how can I find code of hypercall?
  2009-03-11 11:46     ` Jayaraman, Bhaskar
@ 2009-03-11 14:16       ` Goswin von Brederlow
  0 siblings, 0 replies; 6+ messages in thread
From: Goswin von Brederlow @ 2009-03-11 14:16 UTC (permalink / raw)
  To: Jayaraman, Bhaskar
  Cc: leilei175@gmail.com, xen-devel@lists.xensource.com, Keir Fraser

"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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-11 14:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-11  9:52 how can I find code of hypercall? leilei175
2009-03-11 10:08 ` Jayaraman, Bhaskar
2009-03-11 10:26   ` Keir Fraser
2009-03-11 11:46     ` Jayaraman, Bhaskar
2009-03-11 14:16       ` Goswin von Brederlow
2009-03-11 12:37     ` leilei175

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.