2 SMM STM support functions
4 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/DebugLib.h>
17 #define IA32_PG_P BIT0
18 #define IA32_PG_RW BIT1
19 #define IA32_PG_PS BIT7
23 Create 4G page table for STM.
24 4M Non-PAE page table in IA32 version.
26 @param PageTableBase The page table base in MSEG
31 IN UINTN PageTableBase
38 Pte
= (UINT32
*)(UINTN
)PageTableBase
;
41 for (Index
= 0; Index
< SIZE_4KB
/ sizeof (*Pte
); Index
++) {
42 *Pte
= Address
| IA32_PG_PS
| IA32_PG_RW
| IA32_PG_P
;
49 This is SMM exception handle.
50 Consumed by STM when exception happen.
52 @param Context STM protection exception stack frame
54 @return the EBX value for STM reference.
55 EBX = 0: resume SMM guest using register state found on exception stack.
56 EBX = 1 to 0x0F: EBX contains a BIOS error code which the STM must record in the
57 TXT.ERRORCODE register and subsequently reset the system via
58 TXT.CMD.SYS_RESET. The value of the TXT.ERRORCODE register is calculated as
59 follows: TXT.ERRORCODE = (EBX & 0x0F) | STM_CRASH_BIOS_PANIC
60 EBX = 0x10 to 0xFFFFFFFF - reserved, do not use.
65 SmmStmExceptionHandler (
66 IN OUT STM_PROTECTION_EXCEPTION_STACK_FRAME Context
69 // TBD - SmmStmExceptionHandler, record information
70 DEBUG ((DEBUG_ERROR
, "SmmStmExceptionHandler ...\n"));
72 // Skip this instruction and continue;
74 Context
.Ia32StackFrame
->Rip
+= Context
.Ia32StackFrame
->VmcsExitInstructionLength
;