From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case Date: Wed, 24 Jul 2013 08:40:34 +0200 Message-ID: <51EF76E2.2030201@redhat.com> References: <1374087242-6125-1-git-send-email-yzt356@gmail.com> <51E78295.2010700@redhat.com> <20130718072652.GB11772@redhat.com> <51E7C7D2.5040303@redhat.com> <20130718110639.GA26173@redhat.com> <51E7DAD3.8000906@redhat.com> <20130718195712.GN13732@redhat.com> <51E8DFCC.8060108@redhat.com> <20130719094027.GY13732@redhat.com> <51E92BE2.1080600@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , kvm , Jan Kiszka To: Arthur Chunqi Li Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50278 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752066Ab3GXGku (ORCPT ); Wed, 24 Jul 2013 02:40:50 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Il 24/07/2013 08:11, Arthur Chunqi Li ha scritto: > > static int vmx_run() > { > u32 eax; > bool ret; > > vmcs_write(HOST_RSP, get_rsp()); > ret = vmlaunch(); The compiler can still change rsp between here... > while (!ret) { > asm volatile( > "vmx_return:\n\t" ... and here. If you want to write it in C, the only thing that can be after vmlaunch/vmresume is "exit()". Else it has to be asm. Paolo > SAVE_GPR > ); > eax = exit_handler(); > switch (eax) { > case VMX_TEST_VMEXIT: > return 0; > case VMX_TEST_RESUME: > break; > default: > printf("%s : unhandled ret from exit_handler.\n", __func__); > return 1; > } > ret = vmresume(); > } > printf("%s : vmenter failed.\n", __func__); > return 1; > }