public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH] UefiCpuPkg/CpuDxe: Fix boot error
@ 2020-12-24 20:04 Guo Dong
  2021-01-05  4:31 ` Michael D Kinney
  0 siblings, 1 reply; 17+ messages in thread
From: Guo Dong @ 2020-12-24 20:04 UTC (permalink / raw)
  To: devel; +Cc: eric.dong, ray.ni, lersek, rahul1.kumar

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@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


^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [edk2-devel] [PATCH] UefiCpuPkg/CpuDxe: Fix boot error
@ 2020-12-02 21:38 Guo Dong
  2020-12-03  2:23 ` Ni, Ray
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Guo Dong @ 2020-12-02 21:38 UTC (permalink / raw)
  To: devel; +Cc: eric.dong, ray.ni, lersek, rahul1.kumar

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3084

When DXE drivers are dispatched above 4GB memory and
the system is already in 64bit mode, the address
setCodeSelectorLongJump in stack will be override
by parameter. so change to use 64bit address and
jump to qword address.

Signed-off-by: Guo Dong <guo.dong@intel.com>
---
 UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
index c3489bcc3e..6ad32b49f4 100644
--- a/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
+++ b/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
@@ -23,8 +23,8 @@ ASM_PFX(SetCodeSelector):
     sub     rsp, 0x10
     lea     rax, [setCodeSelectorLongJump]
     mov     [rsp], rax
-    mov     [rsp+4], cx
-    jmp     dword far [rsp]
+    mov     [rsp+8], cx
+    jmp     qword far [rsp]
 setCodeSelectorLongJump:
     add     rsp, 0x10
     ret
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-01-06 15:37 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-24 20:04 [edk2-devel] [PATCH] UefiCpuPkg/CpuDxe: Fix boot error Guo Dong
2021-01-05  4:31 ` Michael D Kinney
2021-01-06  0:51   ` Guo Dong
2021-01-06  2:00     ` Michael D Kinney
2021-01-06 15:37       ` Laszlo Ersek
2021-01-06 14:25   ` Laszlo Ersek
  -- strict thread matches above, loose matches on Subject: below --
2020-12-02 21:38 Guo Dong
2020-12-03  2:23 ` Ni, Ray
2020-12-03  7:08 ` Dong, Eric
2020-12-03 10:21 ` Laszlo Ersek
2020-12-08 21:39   ` Guo Dong
2020-12-09 20:02 ` Lendacky, Thomas
2020-12-10  8:49   ` Laszlo Ersek
2020-12-10 14:37     ` Lendacky, Thomas
2020-12-10 16:54       ` Guo Dong
2020-12-11  1:47         ` Ni, Ray
2020-12-11  3:11           ` Guo Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox