From mboxrd@z Thu Jan 1 00:00:00 1970 From: "jemmy858585" 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 Message-ID: <201010311650185006548@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "kvm" Return-path: Received: from mail-gw0-f46.google.com ([74.125.83.46]:52736 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331Ab0JaIsy (ORCPT ); Sun, 31 Oct 2010 04:48:54 -0400 Received: by gwj21 with SMTP id 21so2677353gwj.19 for ; Sun, 31 Oct 2010 01:48:53 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: 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