From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [RFC PATCH] kvm-unit-tests : Basic architecture of VMX nested test case Date: Wed, 24 Jul 2013 12:03:52 +0200 Message-ID: <51EFA688.9040504@web.de> 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> <51EF76E2.2030201@redhat.com> <51EF78B9.9090908@redhat.com> <51EF9B88.5040001@redhat.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2BGJESSDBQAGLOQMFSBVD" Cc: Paolo Bonzini , Gleb Natapov , kvm To: Arthur Chunqi Li Return-path: Received: from mout.web.de ([212.227.15.3]:65095 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752239Ab3GXKD4 (ORCPT ); Wed, 24 Jul 2013 06:03:56 -0400 Received: from mchn199C.mchp.siemens.de ([95.157.58.223]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LilNJ-1UP1nj3O9N-00d20t for ; Wed, 24 Jul 2013 12:03:54 +0200 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2BGJESSDBQAGLOQMFSBVD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2013-07-24 11:56, Arthur Chunqi Li wrote: > So what about this one. I merged all the exit reason to "ret" and > remove the flag detection after vmlaunch/vmresume (because I think > this detection is useless). Currently we support only one guest, so > variant "launched" is located in vmx_run(). If we want to support > multiple guest, we could move it to some structures (e.g. > environment_ctxt). Now I just put it here. >=20 > static int vmx_run() > { > u32 ret =3D 0; > bool launched =3D 0; >=20 > asm volatile( > "mov %%rsp, %%rsi\n\t" > "mov %2, %%edi\n\t" > "call vmcs_write\n\t" >=20 > "0: " > LOAD_GPR_C > "cmp $0, %1\n\t" > "jne 1f\n\t" > "vmlaunch\n\t" > SAVE_GPR_C > /* vmlaunch error, return VMX_TEST_LAUNCH_ERR */ > "mov %3, %0\n\t" > "jmp 2f\n\t" > "1: " > "vmresume\n\t" > SAVE_GPR_C > /* vmresume error, return VMX_TEST_RESUME_ERR */ > "mov %4, %0\n\t" > "jmp 2f\n\t" Where do you store the flags now? You may want to differentiate / test if ZF of CF is set. Jan > "vmx_return:\n\t" > SAVE_GPR_C > "call exit_handler\n\t" > /* set launched =3D 1 */ > "mov $0x1, %1\n\t" > "cmp %5, %%eax\n\t" > "je 0b\n\t" > "mov %%eax, %0\n\t" > "2: " > : "=3Dr"(ret), "=3Dr"(launched) > : "i"(HOST_RSP), "i"(VMX_TEST_LAUNCH_ERR), > "i"(VMX_TEST_RESUME_ERR), "i"(VMX_TEST_RESUME) > : "rax", "rbx", "rdi", "rsi", > "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", > "memory", "cc" > ); > switch (ret) { > case VMX_TEST_VMEXIT: > return 0; > case VMX_TEST_LAUNCH_ERR: > printf("%s : vmlaunch failed.\n", __func__); > break; > case VMX_TEST_RESUME_ERR: > printf("%s : vmresume failed.\n", __func__); > break; > default: > printf("%s : unhandled ret from exit_handler, ret=3D%d.\n", > __func__, ret); > break; > } > return 1; > } >=20 ------enig2BGJESSDBQAGLOQMFSBVD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlHvpogACgkQitSsb3rl5xSB4ACg7Kj7GmOxcEimtgxqRYdNinfM NmEAn0COQ7W+MagERaAPRoW4F4dkZsBc =6E/R -----END PGP SIGNATURE----- ------enig2BGJESSDBQAGLOQMFSBVD--