]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/X64/Thunk16.asm
Use rsp instead of esp to save 64-bit stack pointer.
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / Thunk16.asm
index 8b208fdb584bab799c0117479eeea0e31994fc94..e01de272d22bc0bbddacd216fcc71305f80c0a1f 100644 (file)
@@ -3,7 +3,7 @@
 \r
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -142,8 +142,8 @@ SavedCr0    DD      ?
 SavedCs     DW      ?\r
 @64BitCode:\r
     db      090h \r
-    db      067h, 0bch                 ; mov esp, imm32\r
-SavedSp     DD   ?                     ; restore stack\r
+    db      048h, 0bch                 ; mov rsp, imm64\r
+SavedSp     DQ   ?                     ; restore stack\r
     nop\r
     ret\r
 _BackFromUserCode   ENDP\r
@@ -282,7 +282,7 @@ InternalAsmThunk16  PROC    USES    rbp rbx rsi rdi
     and     eax, 7ffffffeh              ; clear PE, PG bits\r
     mov     rbp, cr4\r
     mov     [rcx], ebp                  ; save CR4 in SavedCr4\r
-    and     ebp, 300h                   ; clear all but PCE and OSFXSR bits\r
+    and     ebp, NOT 30h                ; clear PAE, PSE bits\r
     mov     esi, r8d                    ; esi <- 16-bit stack segment\r
     DB      6ah, DATA32                 ; push DATA32\r
     pop     rdx                         ; rdx <- 32-bit data segment selector\r
@@ -294,7 +294,7 @@ InternalAsmThunk16  PROC    USES    rbp rbx rsi rdi
     push    r8\r
     mov     r8d, cs\r
     mov     [rcx + (SavedCs - SavedCr4)], r8w\r
-    mov     [rcx + (SavedSp - SavedCr4)], esp\r
+    mov     [rcx + (SavedSp - SavedCr4)], rsp\r
     jmp     fword ptr [rcx + (_EntryPoint - SavedCr4)]\r
 @RetFromRealMode:\r
     popfq\r