public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@amd.com>
To: 吴忠远 <wzhongyuan@gmail.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: about using vmcall instruction
Date: Thu, 22 Jul 2010 15:13:16 +0200	[thread overview]
Message-ID: <4C4843EC.1060003@amd.com> (raw)
In-Reply-To: <AANLkTin7QHFJlUzTaZtHSkiT1pGsOXXt36GWWRYIUWFa@mail.gmail.com>

吴忠远 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


      reply	other threads:[~2010-07-22 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 10:11 about using vmcall instruction 吴忠远
2010-07-22 13:13 ` Andre Przywara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C4843EC.1060003@amd.com \
    --to=andre.przywara@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=wzhongyuan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox