2 SMM STM support functions
4 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/DebugLib.h>
23 #define IA32_PG_P BIT0
24 #define IA32_PG_RW BIT1
25 #define IA32_PG_PS BIT7
29 Create 4G page table for STM.
30 4M Non-PAE page table in IA32 version.
32 @param PageTableBase The page table base in MSEG
37 IN UINTN PageTableBase
44 Pte
= (UINT32
*)(UINTN
)PageTableBase
;
47 for (Index
= 0; Index
< SIZE_4KB
/ sizeof (*Pte
); Index
++) {
48 *Pte
= Address
| IA32_PG_PS
| IA32_PG_RW
| IA32_PG_P
;
55 This is SMM exception handle.
56 Consumed by STM when exception happen.
58 @param Context STM protection exception stack frame
60 @return the EBX value for STM reference.
61 EBX = 0: resume SMM guest using register state found on exception stack.
62 EBX = 1 to 0x0F: EBX contains a BIOS error code which the STM must record in the
63 TXT.ERRORCODE register and subsequently reset the system via
64 TXT.CMD.SYS_RESET. The value of the TXT.ERRORCODE register is calculated as
65 follows: TXT.ERRORCODE = (EBX & 0x0F) | STM_CRASH_BIOS_PANIC
66 EBX = 0x10 to 0xFFFFFFFF - reserved, do not use.
71 SmmStmExceptionHandler (
72 IN OUT STM_PROTECTION_EXCEPTION_STACK_FRAME Context
75 // TBD - SmmStmExceptionHandler, record information
76 DEBUG ((DEBUG_ERROR
, "SmmStmExceptionHandler ...\n"));
78 // Skip this instruction and continue;
80 Context
.Ia32StackFrame
->Rip
+= Context
.Ia32StackFrame
->VmcsExitInstructionLength
;