]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/X64/DisablePaging64.S
1. Remove .extern from GCC assembly.
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / DisablePaging64.S
index a55059e3bec99bd7c4c7d9f80dde23f012a3f3a1..f3ed29ed402d3bc5cb37f37572af6948d4e08f3d 100644 (file)
@@ -35,7 +35,7 @@
 #   );\r
 #------------------------------------------------------------------------------\r
 \r
-.global ASM_PFX(InternalX86DisablePaging64)\r
+ASM_GLOBAL ASM_PFX(InternalX86DisablePaging64)\r
 ASM_PFX(InternalX86DisablePaging64):\r
     cli    \r
     shl    $0x20,%rcx                     # rcx[32..47] <- Cs\r
@@ -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