]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiException.S
MdePkg/BaseLib: add PatchInstructionX86()
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / X64 / SmiException.S
index 6dbcaa5b671490d53ca0388fd73730377bd56fd4..338bb70dd82161eb905d5cf043eca0a52982b182 100644 (file)
@@ -1,6 +1,6 @@
 #------------------------------------------------------------------------------\r
 #\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
@@ -20,7 +20,6 @@
 #------------------------------------------------------------------------------\r
 \r
 ASM_GLOBAL  ASM_PFX(SmiPFHandler)\r
-ASM_GLOBAL  ASM_PFX(gSmiMtrrs)\r
 ASM_GLOBAL  ASM_PFX(gcSmiIdtr)\r
 ASM_GLOBAL  ASM_PFX(gcSmiGdtr)\r
 ASM_GLOBAL  ASM_PFX(gcPsd)\r
@@ -79,11 +78,11 @@ CodeSeg64:
             .byte 0                     # BaseHigh\r
 # TSS Segment for X64 specially\r
 TssSeg:\r
-            .word TSS_DESC_SIZE         # LimitLow\r
+            .word TSS_DESC_SIZE - 1     # LimitLow\r
             .word 0                     # BaseLow\r
             .byte 0                     # BaseMid\r
             .byte 0x89\r
-            .byte 0xDB                  # LimitHigh\r
+            .byte 0x00                  # LimitHigh\r
             .byte 0                     # BaseHigh\r
             .long 0                     # BaseUpper\r
             .long 0                     # Reserved\r
@@ -113,7 +112,7 @@ ASM_PFX(gcPsd):
             .long      GDT_SIZE\r
             .long 0\r
             .space 24, 0\r
-            .quad      ASM_PFX(gSmiMtrrs)\r
+            .quad      0\r
 .equ  PSD_SIZE,  . - ASM_PFX(gcPsd)\r
 \r
 #\r
@@ -128,244 +127,8 @@ ASM_PFX(gcSmiGdtr):
     .quad      NullSeg\r
 \r
 ASM_PFX(gcSmiIdtr):\r
-    .word      IDT_SIZE - 1\r
-    .quad      _SmiIDT\r
-\r
-\r
-#\r
-# Here is the IDT. There are 32 (not 255) entries in it since only processor\r
-# generated exceptions will be handled.\r
-#\r
-_SmiIDT:\r
-# The following segment repeats 32 times:\r
-# No. 1\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 2\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 3\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 4\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 5\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 6\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 7\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 8\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 9\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 10\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 11\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 12\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 13\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 14\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 15\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 16\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 17\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 18\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 19\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 20\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 21\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 22\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 23\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 24\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 25\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 26\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 27\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 28\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 29\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 30\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 31\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-# No. 32\r
-    .word 0                             # Offset 0:15\r
-    .word CODE_SEL\r
-    .byte 0                             # Unused\r
-    .byte 0x8e                          # Interrupt Gate, Present\r
-    .word 0                             # Offset 16:31\r
-    .quad 0                             # Offset 32:63\r
-\r
-_SmiIDTEnd:\r
-\r
-.equ  IDT_SIZE, (_SmiIDTEnd - _SmiIDT)\r
+    .word      0\r
+    .quad      0\r
 \r
     .text\r
 \r
@@ -600,11 +363,3 @@ L5:
     addq    $16, %rsp                    # skip INT# & ErrCode\r
     iretq\r
 \r
-ASM_GLOBAL ASM_PFX(InitializeIDTSmmStackGuard)\r
-ASM_PFX(InitializeIDTSmmStackGuard):\r
-# If SMM Stack Guard feature is enabled, set the IST field of\r
-# the interrupt gate for Page Fault Exception to be 1\r
-#\r
-    movabsq  $_SmiIDT + 14 * 16, %rax\r
-    movb     $1, 4(%rax)\r
-    ret\r