[edk2-devel] [PATCH] UefiCpuPkg/CpuDxe: Fix boot error

Laszlo Ersek lersek at redhat.com
Wed Jan 6 14:25:34 UTC 2021


On 01/05/21 05:31, Michael D Kinney wrote:
> Hi Guo,
> 
> NASM has good support for instructions.  Can the DB be removed and replaced with the equivalent instruction?

Indeed. Thanks!
Laszlo

> 
> Thanks,
> 
> Mike
> 
>> -----Original Message-----
>> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Guo Dong
>> Sent: Thursday, December 24, 2020 12:04 PM
>> To: devel at edk2.groups.io
>> Cc: Dong, Eric <eric.dong at intel.com>; Ni, Ray <ray.ni at intel.com>; lersek at redhat.com; Kumar, Rahul1
>> <rahul1.kumar at intel.com>
>> Subject: [edk2-devel] [PATCH] UefiCpuPkg/CpuDxe: Fix boot error
>>
>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3084
>>
>> When DXE drivers are dispatched above 4GB memory in 64bit
>> mode, the address setCodeSelectorLongJump in stack will
>> be override by parameter. Jump to Qword is not supported
>> by some processors. So use retfq instead.
>>
>> Signed-off-by: Guo Dong <guo.dong at intel.com>
>> ---
>>  UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm | 8 +++-----
>>  1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
>> index c3489bcc3e..e33ddb2784 100644
>> --- a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
>> +++ b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
>> @@ -20,13 +20,11 @@
>>  ;------------------------------------------------------------------------------
>>  global ASM_PFX(SetCodeSelector)
>>  ASM_PFX(SetCodeSelector):
>> -    sub     rsp, 0x10
>> +    push    rcx,
>>      lea     rax, [setCodeSelectorLongJump]
>> -    mov     [rsp], rax
>> -    mov     [rsp+4], cx
>> -    jmp     dword far [rsp]
>> +    push    rax
>> +    DB 0x48, 0xcb                      ; retfq
>>  setCodeSelectorLongJump:
>> -    add     rsp, 0x10
>>      ret
>>
>>  ;------------------------------------------------------------------------------
>> --
>> 2.16.2.windows.1
>>
>>
>>
>>
>>
> 
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69827): https://edk2.groups.io/g/devel/message/69827
Mute This Topic: https://groups.io/mt/79209121/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