]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/X64/DisablePaging64.asm
Fix the bug that EntryPoint of DisablePaging64() is corrupted.
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / DisablePaging64.asm
index 518137ddc9ee3f8777024bec5b18795f6aac3cf6..29bf558e6c8df6154e3d0e0a5691363a0a0ae70b 100644 (file)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2006, Intel Corporation\r
+; Copyright (c) 2006 - 2008, Intel Corporation\r
 ; All rights reserved. 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
@@ -49,6 +49,8 @@ InternalX86DisablePaging64    PROC
     mov     rax, cr0\r
     btr     eax, 31\r
     mov     cr0, rax                    ; disable paging\r
+\r
+    mov     rbx, rdx                    ; save EntryPoint to rbx, for rdmsr will overwrite rdx\r
     mov     ecx, 0c0000080h\r
     rdmsr\r
     and     ah, NOT 1                   ; clear LME\r
@@ -58,7 +60,7 @@ InternalX86DisablePaging64    PROC
     mov     cr4, rax\r
     push    rdi                         ; push Context2\r
     push    rsi                         ; push Context1\r
-    call    rdx                         ; transfer control to EntryPoint\r
+    call    rbx                         ; transfer control to EntryPoint\r
     hlt                                 ; no one should get here\r
 InternalX86DisablePaging64    ENDP\r
 \r