[edk2-devel] [RFC PATCH v2 04/44] OvmfPkg/ResetVector: Add support for a 32-bit SEV check
Lendacky, Thomas
thomas.lendacky at amd.com
Mon Sep 30 19:55:20 UTC 2019
On 9/30/19 2:29 PM, Laszlo Ersek via Groups.Io wrote:
> 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 <https://bugzilla.nasm.us/>, 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).
Yeah, missed that. I'm so used to the GCC/GAS syntax.
>
> Second, when I remove the semicolon, NASM indeed complains in 32-bit
> mode "error: instruction not supported in 32-bit mode".
Right, that was why I moved to the DBs.
>
> But the following does work:
>
> BITS 64
> rep vmmcall
> BITS 32
>
> and for it, NASM generates the bytes seen above (f3 0f 01 d9).
Excellent, I'll use that.
>
> 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
>
Will do.
Thanks,
Tom
> Thanks!
> Laszlo
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#48298): https://edk2.groups.io/g/devel/message/48298
Mute This Topic: https://groups.io/mt/34203539/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list