]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm
UefiCpuPkg: Update PiSmmCpuDxeSmm pass XCODE5 tool chain
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / X64 / SmiEntry.nasm
index dc56dc7852e278c90c72c89dde3b82e53c266214..697fd2bec7c616c8d1fd855dd3afccf4f846afcb 100644 (file)
@@ -1,5 +1,5 @@
 ;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2016 - 2018, 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
@@ -158,7 +158,8 @@ Base:
     mov     cr0, rbx\r
     retf\r
 @LongMode:                              ; long mode (64-bit code) starts here\r
-    mov     rax, ASM_PFX(gSmiHandlerIdtr)\r
+    mov     rax, strict qword 0         ;  mov     rax, ASM_PFX(gSmiHandlerIdtr)\r
+SmiHandlerIdtrAbsAddr:\r
     lidt    [rax]\r
     lea     ebx, [rdi + DSC_OFFSET]\r
     mov     ax, [rbx + DSC_DS]\r
@@ -169,7 +170,9 @@ Base:
     mov     gs, eax\r
     mov     ax, [rbx + DSC_SS]\r
     mov     ss, eax\r
-;   jmp     _SmiHandler                 ; instruction is not needed\r
+    mov     rax, strict qword 0         ;   mov     rax, _SmiHandler\r
+_SmiHandlerAbsAddr:\r
+    jmp     rax\r
 \r
 _SmiHandler:\r
     mov     rbx, [rsp + 0x8]             ; rcx <- CpuIndex\r
@@ -184,16 +187,13 @@ _SmiHandler:
     add     rsp, -0x20\r
 \r
     mov     rcx, rbx\r
-    mov     rax, ASM_PFX(CpuSmmDebugEntry)\r
-    call    rax\r
+    call    ASM_PFX(CpuSmmDebugEntry)\r
 \r
     mov     rcx, rbx\r
-    mov     rax, ASM_PFX(SmiRendezvous)  ; rax <- absolute addr of SmiRedezvous\r
-    call    rax\r
+    call    ASM_PFX(SmiRendezvous)\r
 \r
     mov     rcx, rbx\r
-    mov     rax, ASM_PFX(CpuSmmDebugExit)\r
-    call    rax\r
+    call    ASM_PFX(CpuSmmDebugExit)\r
 \r
     add     rsp, 0x20\r
 \r
@@ -205,7 +205,7 @@ _SmiHandler:
 \r
     add     rsp, 0x200\r
 \r
-    mov     rax, ASM_PFX(mXdSupported)\r
+    lea     rax, [ASM_PFX(mXdSupported)]\r
     mov     al, [rax]\r
     cmp     al, 0\r
     jz      .1\r
@@ -222,3 +222,13 @@ _SmiHandler:
 \r
 ASM_PFX(gcSmiHandlerSize)    DW      $ - _SmiEntryPoint\r
 \r
+global ASM_PFX(PiSmmCpuSmiEntryFixupAddress)\r
+ASM_PFX(PiSmmCpuSmiEntryFixupAddress):\r
+    lea    rax, [ASM_PFX(gSmiHandlerIdtr)]\r
+    lea    rcx, [SmiHandlerIdtrAbsAddr]\r
+    mov    qword [rcx - 8], rax\r
+\r
+    lea    rax, [_SmiHandler]\r
+    lea    rcx, [_SmiHandlerAbsAddr]\r
+    mov    qword [rcx - 8], rax\r
+    ret\r