]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiException.nasm
UefiCpuPkg/PiSmmCpuDxeSmm: use mnemonics for FXSAVE(64)/FXRSTOR(64)
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / Ia32 / SmiException.nasm
index 6a328289a8af5e60ee7df5d13b61a40be86176de..fa02c1016ce70c1e92745195ed4886c542c9ec2a 100644 (file)
@@ -1,5 +1,5 @@
 ;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2009 - 2016, 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
 ;-------------------------------------------------------------------------------\r
 \r
 extern  ASM_PFX(FeaturePcdGet (PcdCpuSmmProfileEnable))\r
-extern  ASM_PFX(gSmiMtrrs)\r
 extern  ASM_PFX(SmiPFHandler)\r
 \r
 global  ASM_PFX(gcSmiIdtr)\r
 global  ASM_PFX(gcSmiGdtr)\r
+global  ASM_PFX(gTaskGateDescriptor)\r
 global  ASM_PFX(gcPsd)\r
 \r
     SECTION .data\r
@@ -242,7 +242,7 @@ ASM_PFX(gcPsd):
             DD      0\r
             times   24 DB 0\r
             DD      0\r
-            DD      ASM_PFX(gSmiMtrrs)\r
+            DD      0\r
 PSD_SIZE  equ $ - ASM_PFX(gcPsd)\r
 \r
 ASM_PFX(gcSmiGdtr):\r
@@ -250,21 +250,10 @@ ASM_PFX(gcSmiGdtr):
     DD      NullSeg\r
 \r
 ASM_PFX(gcSmiIdtr):\r
-    DW      IDT_SIZE - 1\r
-    DD      _SmiIDT\r
-\r
-_SmiIDT:\r
-%rep 32\r
-    DW      0                           ; Offset 0:15\r
-    DW      CODE_SEL                    ; Segment selector\r
-    DB      0                           ; Unused\r
-    DB      0x8e                         ; Interrupt Gate, Present\r
-    DW      0                           ; Offset 16:31\r
-%endrep\r
+    DW      0\r
+    DD      0\r
 \r
-IDT_SIZE equ $ - _SmiIDT\r
-\r
-TaskGateDescriptor:\r
+ASM_PFX(gTaskGateDescriptor):\r
     DW      0                           ; Reserved\r
     DW      EXCEPTION_TSS_SEL           ; TSS Segment selector\r
     DB      0                           ; Reserved\r
@@ -393,7 +382,7 @@ ASM_PFX(PageFaultIdtHandlerSmmProfile):
 ;; FX_SAVE_STATE_IA32 FxSaveState;\r
     sub     esp, 512\r
     mov     edi, esp\r
-    db      0xf, 0xae, 0x7 ;fxsave [edi]\r
+    fxsave  [edi]\r
 \r
 ; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear\r
     cld\r
@@ -421,7 +410,7 @@ ASM_PFX(PageFaultIdtHandlerSmmProfile):
 \r
 ;; FX_SAVE_STATE_IA32 FxSaveState;\r
     mov     esi, esp\r
-    db      0xf, 0xae, 0xe ; fxrstor [esi]\r
+    fxrstor [esi]\r
     add     esp, 512\r
 \r
 ;; UINT32  Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
@@ -593,7 +582,7 @@ PFHandlerEntry:
     clts\r
     sub     esp, 512\r
     mov     edi, esp\r
-    db      0xf, 0xae, 0x7 ;fxsave [edi]\r
+    fxsave  [edi]\r
 \r
 ; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear\r
     cld\r
@@ -623,7 +612,7 @@ PFHandlerEntry:
 \r
 ;; FX_SAVE_STATE_IA32 FxSaveState;\r
     mov     esi, esp\r
-    db      0xf, 0xae, 0xe ; fxrstor [esi]\r
+    fxrstor [esi]\r
     add     esp, 512\r
 \r
 ;; UINT32  Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
@@ -717,19 +706,3 @@ ASM_PFX(PageFaultStubFunction):
     clts\r
     iretd\r
 \r
-global ASM_PFX(InitializeIDTSmmStackGuard)\r
-ASM_PFX(InitializeIDTSmmStackGuard):\r
-    push    ebx\r
-;\r
-; If SMM Stack Guard feature is enabled, the Page Fault Exception entry in IDT\r
-; is a Task Gate Descriptor so that when a Page Fault Exception occurrs,\r
-; the processors can use a known good stack in case stack is ran out.\r
-;\r
-    lea     ebx, [_SmiIDT + 14 * 8]\r
-    lea     edx, [TaskGateDescriptor]\r
-    mov     eax, [edx]\r
-    mov     [ebx], eax\r
-    mov     eax, [edx + 4]\r
-    mov     [ebx + 4], eax\r
-    pop     ebx\r
-    ret\r