TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmProfileInternal.h
Go to the documentation of this file.
1
10#ifndef _SMM_PROFILE_INTERNAL_H_
11#define _SMM_PROFILE_INTERNAL_H_
12
14#include <Library/CpuLib.h>
16
17#include "SmmProfileArch.h"
18
19//
20// Configure the SMM_PROFILE DTS region size
21//
22#define SMM_PROFILE_DTS_SIZE (4 * 1024 * 1024) // 4M
23
24#define MAX_PF_PAGE_COUNT 0x2
25
26#define PEBS_RECORD_NUMBER 0x2
27
28#define MAX_PF_ENTRY_COUNT 10
29
30//
31// This MACRO just enable unit test for the profile
32// Please disable it.
33//
34
35#define IA32_PF_EC_ID (1u << 4)
36
37#define SMM_PROFILE_NAME L"SmmProfileData"
38
39//
40// CPU generic definition
41//
42#define MSR_EFER_XD 0x800
43
44#define CPUID1_EDX_BTS_AVAILABLE 0x200000
45
46#define DR6_SINGLE_STEP 0x4000
47
48#define MSR_DS_AREA 0x600
49
50#define HEAP_GUARD_NONSTOP_MODE \
51 ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT6|BIT3|BIT2)) > BIT6)
52
53#define NULL_DETECTION_NONSTOP_MODE \
54 ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & (BIT6|BIT1)) > BIT6)
55
56typedef struct {
60
61typedef struct {
62 MEMORY_RANGE Range;
63 BOOLEAN Present;
64 BOOLEAN Nx;
66
67typedef struct {
68 UINT64 HeaderSize;
69 UINT64 MaxDataEntries;
70 UINT64 MaxDataSize;
71 UINT64 CurDataEntries;
72 UINT64 CurDataSize;
73 UINT64 TsegStart;
74 UINT64 TsegSize;
75 UINT64 NumSmis;
76 UINT64 NumCpus;
78
79typedef struct {
80 UINT64 SmiNum;
81 UINT64 CpuNum;
82 UINT64 ApicId;
83 UINT64 ErrorCode;
84 UINT64 Instruction;
85 UINT64 Address;
86 UINT64 SmiCmd;
88
89extern UINTN gSmiExceptionHandlers[];
90extern BOOLEAN mXdSupported;
91X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported;
92X86_ASSEMBLY_PATCH_LABEL gPatchMsrIa32MiscEnableSupported;
93extern UINTN *mPFEntryCount;
94extern UINT64 (*mLastPFEntryValue)[MAX_PF_ENTRY_COUNT];
95extern UINT64 *(*mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT];
96
97//
98// Internal functions
99//
100
105VOID
106InitIdtr (
107 VOID
108 );
109
116BOOLEAN
119 );
120
131BOOLEAN
133 IN EFI_PHYSICAL_ADDRESS Address,
134 OUT BOOLEAN *Nx
135 );
136
143UINT64
144AllocPage (
145 VOID
146 );
147
152VOID
154 VOID
155 );
156
164VOID
166 IN OUT EFI_SYSTEM_CONTEXT SystemContext
167 );
168
169#endif // _SMM_PROFILE_H_
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
VOID ClearTrapFlag(IN OUT EFI_SYSTEM_CONTEXT SystemContext)
VOID SmmProfileMapPFAddress(VOID)
UINT64 AllocPage(VOID)
Definition: PageTbl.c:76
BOOLEAN IsSmmProfilePFAddressAbove4GValid(IN EFI_PHYSICAL_ADDRESS Address, OUT BOOLEAN *Nx)
Definition: SmmProfile.c:328
BOOLEAN IsAddressSplit(IN EFI_PHYSICAL_ADDRESS Address)
Definition: SmmProfile.c:356
VOID InitIdtr(VOID)
Definition: SmmProfile.c:1394
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50