* about using vmcall instruction
@ 2010-07-22 10:11 吴忠远
2010-07-22 13:13 ` Andre Przywara
0 siblings, 1 reply; 2+ messages in thread
From: 吴忠远 @ 2010-07-22 10:11 UTC (permalink / raw)
To: kvm
an module is executed in guest using vmcall instruction. then host
handler the vmcall exit and read the registers value. but ax,cx,dx get
the correct values while bx and si get the worong. what is the
problem.
code in guest is :
__asm__ ("mov $10,%ax");
__asm__ ("mov $20,%bx");
__asm__ ("mov $30,%cx");
__asm__ ("mov $40,%dx");
__asm__ ("mov $50,%si");
__asm__ ("vmcall");
host output :
HYPER CALL IS CALLED AND THE NR IS 10,bx is -526778348,cx is 30,dx is
40,si is -1017839566
so ax(NR) ,cx,dx values are correct .but bx and si values are wrong.why?
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: about using vmcall instruction
2010-07-22 10:11 about using vmcall instruction 吴忠远
@ 2010-07-22 13:13 ` Andre Przywara
0 siblings, 0 replies; 2+ messages in thread
From: Andre Przywara @ 2010-07-22 13:13 UTC (permalink / raw)
To: 吴忠远; +Cc: kvm@vger.kernel.org
吴忠远 wrote:
> an module is executed in guest using vmcall instruction. then host
> handler the vmcall exit and read the registers value. but ax,cx,dx get
> the correct values while bx and si get the worong. what is the
> problem.
> code in guest is :
> __asm__ ("mov $10,%ax");
> __asm__ ("mov $20,%bx");
> __asm__ ("mov $30,%cx");
> __asm__ ("mov $40,%dx");
> __asm__ ("mov $50,%si");
> __asm__ ("vmcall");
> host output :
> HYPER CALL IS CALLED AND THE NR IS 10,bx is -526778348,cx is 30,dx is
> 40,si is -1017839566
> so ax(NR) ,cx,dx values are correct .but bx and si values are wrong.why?
Nothing, you just set the lower 16 bits of the registers and output at
least 32 bits on the host. The upper 16 bits are left from the previous
code in the guest. So EBX is 0xe09a0014 (with the lower 16 bits being
0x14=20) and ESI is c3550032 with the lower 16 bits being 0x32=50.
Please either use ebx and esi in the guest code or mask the registers to
16 bits in the host.
Regards,
Andre.
--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 448-3567-12
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-22 13:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22 10:11 about using vmcall instruction 吴忠远
2010-07-22 13:13 ` Andre Przywara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox