TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmStmSupport.c
Go to the documentation of this file.
1
9#include <PiMm.h>
10#include <Library/DebugLib.h>
11
12#include "SmmStm.h"
13
17#define IA32_PG_P BIT0
18#define IA32_PG_RW BIT1
19#define IA32_PG_PS BIT7
20
29VOID
31 IN UINTN PageTableBase
32 )
33{
34 UINTN Index;
35 UINTN SubIndex;
36 UINT64 *Pde;
37 UINT64 *Pte;
38 UINT64 *Pml4;
39
40 Pml4 = (UINT64 *)(UINTN)PageTableBase;
41 PageTableBase += SIZE_4KB;
42 *Pml4 = PageTableBase | IA32_PG_RW | IA32_PG_P;
43
44 Pde = (UINT64 *)(UINTN)PageTableBase;
45 PageTableBase += SIZE_4KB;
46 Pte = (UINT64 *)(UINTN)PageTableBase;
47
48 for (Index = 0; Index < 4; Index++) {
49 *Pde = PageTableBase | IA32_PG_RW | IA32_PG_P;
50 Pde++;
51 PageTableBase += SIZE_4KB;
52
53 for (SubIndex = 0; SubIndex < SIZE_4KB / sizeof (*Pte); SubIndex++) {
54 *Pte = (((Index << 9) + SubIndex) << 21) | IA32_PG_PS | IA32_PG_RW | IA32_PG_P;
55 Pte++;
56 }
57 }
58}
59
75UINT32
76EFIAPI
79 )
80{
81 // TBD - SmmStmExceptionHandler, record information
82 DEBUG ((DEBUG_ERROR, "SmmStmExceptionHandler ...\n"));
83 //
84 // Skip this instruction and continue;
85 //
86 Context.X64StackFrame->Rip += Context.X64StackFrame->VmcsExitInstructionLength;
87
88 return 0;
89}
UINT64 UINTN
#define IA32_PG_P
Definition: SmmStmSupport.c:17
VOID StmGen4GPageTable(IN UINTN PageTableBase)
Definition: SmmStmSupport.c:30
UINT32 EFIAPI SmmStmExceptionHandler(IN OUT STM_PROTECTION_EXCEPTION_STACK_FRAME Context)
Definition: SmmStmSupport.c:65
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434