public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "jemmy858585" <jemmy858585@gmail.com>
To: "kvm" <kvm@vger.kernel.org>
Subject: some question in function do_vmx_vcpu_run, if anyone knows , please tell me,thanks.
Date: Sun, 31 Oct 2010 16:50:23 +0800	[thread overview]
Message-ID: <201010311650185006548@gmail.com> (raw)

in the function do_vmx_vcpu_run ,  there are some code which i didn't understand.

question one:
		".Lkvm_vmx_return: "
		/* Save guest registers, load host registers, keep flags */
		"xchg %0,     (%%"R"sp) \n\t"
		"mov %%"R"ax, %c[rax](%0) \n\t"
		"mov %%"R"bx, %c[rbx](%0) \n\t"
		"push"Q" (%%"R"sp); pop"Q" %c[rcx](%0) \n\t"
		"mov %%"R"dx, %c[rdx](%0) \n\t"
		"mov %%"R"si, %c[rsi](%0) \n\t"
		"mov %%"R"di, %c[rdi](%0) \n\t"
		"mov %%"R"bp, %c[rbp](%0) \n\t"

why need 
"xchg %0,     (%%"R"sp) \n\t" 
and 
"push"Q" (%%"R"sp); pop"Q" %c[rcx](%0) \n\t"
I think rsp will restore when vm exits, why we change it?

question two:
before vm entry
		/* Store host registers */
		"push %%"R"dx; push %%"R"bp;"
		"push %%"R"cx \n\t"
and  after vm exit
		"pop  %%"R"bp; pop  %%"R"bp; pop  %%"R"dx \n\t"

why we need push rdx,rbp,rcx, and didn't pop rcx; and why we didn't save other register?


			
--------------
jemmy858585
2010-10-31


                 reply	other threads:[~2010-10-31  8:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=201010311650185006548@gmail.com \
    --to=jemmy858585@gmail.com \
    --cc=kvm@vger.kernel.org \
    /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