#------------------------------------------------------------------------------\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
ASM_GLOBAL ASM_PFX(gSmiMtrrs)\r
ASM_GLOBAL ASM_PFX(gcSmiIdtr)\r
ASM_GLOBAL ASM_PFX(gcSmiGdtr)\r
+ASM_GLOBAL ASM_PFX(gTaskGateDescriptor)\r
ASM_GLOBAL ASM_PFX(gcPsd)\r
ASM_GLOBAL ASM_PFX(FeaturePcdGet (PcdCpuSmmProfileEnable))\r
\r
ASM_PFX(gcSmiGdtr): .word GDT_SIZE - 1\r
.long NullSeg\r
\r
-ASM_PFX(gcSmiIdtr): .word IDT_SIZE - 1\r
- .long _SmiIDT\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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-# 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
-\r
-.equ IDT_SIZE, . - _SmiIDT\r
-\r
-TaskGateDescriptor:\r
+ASM_PFX(gcSmiIdtr): .word 0\r
+ .long 0\r
+\r
+ASM_PFX(gTaskGateDescriptor):\r
.word 0 # Reserved\r
.word EXCEPTION_TSS_SEL # TSS Segment selector\r
.byte 0 # Reserved\r
#\r
clts\r
iret\r
-\r
-ASM_GLOBAL ASM_PFX(InitializeIDTSmmStackGuard)\r
-ASM_PFX(InitializeIDTSmmStackGuard):\r
- pushl %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 occurs,\r
-# the processors can use a known good stack in case stack ran out.\r
-#\r
- leal _SmiIDT + 14 * 8, %ebx\r
- leal TaskGateDescriptor, %edx\r
- movl (%edx), %eax\r
- movl %eax, (%ebx)\r
- movl 4(%edx), %eax\r
- movl %eax, 4(%ebx)\r
-\r
- popl %ebx\r
- ret\r