From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Mon, 30 Sep 2019 12:29:17 -0700 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 507FA8A218D; Mon, 30 Sep 2019 19:29:16 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-121-111.rdu2.redhat.com [10.10.121.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25C4A19C58; Mon, 30 Sep 2019 19:29:13 +0000 (UTC) Subject: Re: [edk2-devel] [RFC PATCH v2 04/44] OvmfPkg/ResetVector: Add support for a 32-bit SEV check To: "Lendacky, Thomas" , "devel@edk2.groups.io" Cc: Jordan Justen , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , "Singh, Brijesh" References: <54ebf48fe05c20a1181a3dc90496e4835912ebf2.1568922728.git.thomas.lendacky@amd.com> <4dda0b6e-c464-ef55-2745-ad6beabb98b7@amd.com> From: "Laszlo Ersek" Message-ID: Date: Mon, 30 Sep 2019 21:29:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <4dda0b6e-c464-ef55-2745-ad6beabb98b7@amd.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Mon, 30 Sep 2019 19:29:16 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/24/19 20:57, Lendacky, Thomas wrote: > On 9/24/19 8:42 AM, Laszlo Ersek wrote: >> On 09/19/19 21:52, Lendacky, Thomas wrote: >>> + ; Issue VMGEXIT (rep; vmmcall) >>> + db 0xf3 >>> + db 0x0f >>> + db 0x01 >>> + db 0xd9 >> >> (8) Can you please file an RFE at , for >> supporting this instruction, and add the link here, as a comment? I've >> been fighting an uphill battle against DB-encoded instructions in edk2 >> assembly code. > > Yes, let me look into that. Actually, from peeking ahead at patch "MdePkg/BaseLib: Add support for the VMGEXIT instruction", it looks like "rep; vmmcall" is already understood by NASM. Can you use that here? ... In case that sequence of mnemonics is specific to NASM's 64-bit mode: can you bracket it with BITS 64 / BITS 32, just so we can avoid the DBs? Something like (if necessary): ; Issue VMGEXIT BITS 64 rep; vmmcall BITS 32 Hmmm why don't I try this out myself... ... So, first, the semicolon (;) seems wrong in the NASM source. It turns vmmcall into a comment, and NASM assembles only the REP prefix (to a single 0xF3 byte). Second, when I remove the semicolon, NASM indeed complains in 32-bit mode "error: instruction not supported in 32-bit mode". But the following does work: BITS 64 rep vmmcall BITS 32 and for it, NASM generates the bytes seen above (f3 0f 01 d9). So I suggest: - using this pattern in the present patch - using this pattern in the Ia32/VmgExit.nasm source file in the MdePkg/BaseLib patch - removing the semicolon in the X64/VmgExit.nasm source file in the MdePkg/BaseLib patch Thanks! Laszlo