]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix the bug that EntryPoint of DisablePaging64() is corrupted.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Jan 2009 04:20:22 +0000 (04:20 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Jan 2009 04:20:22 +0000 (04:20 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7250 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseLib/X64/DisablePaging64.S
MdePkg/Library/BaseLib/X64/DisablePaging64.asm

index a55059e3bec99bd7c4c7d9f80dde23f012a3f3a1..8c71d2d49e25425a19bb6873b92c8aaeea00186a 100644 (file)
@@ -51,6 +51,8 @@ L1:
     mov    %cr0,%rax\r
     btr    $0x1f,%eax\r
     mov    %rax,%cr0                      # disable paging\r
+\r
+    mov    %rdx,%rbx                      # save EntryPoint to rbx, for rdmsr will overwrite rdx\r
     mov    $0xc0000080,%ecx\r
     rdmsr  \r
     and    $0xfe,%ah                      # clear LME\r
@@ -60,6 +62,6 @@ L1:
     mov    %rax,%cr4\r
     push   %rdi                           # push Context2\r
     push   %rsi                           # push Context1\r
-    callq  *%rdx                          # transfer control to EntryPoint\r
+    callq  *%rbx                          # transfer control to EntryPoint\r
     jmp    .                              # no one should get here\r
 \r
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