TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmProfileInternal.h File Reference
#include <Protocol/SmmReadyToLock.h>
#include <Library/CpuLib.h>
#include <IndustryStandard/Acpi.h>
#include "SmmProfileArch.h"

Go to the source code of this file.

Data Structures

struct  MEMORY_RANGE
 
struct  MEMORY_PROTECTION_RANGE
 
struct  SMM_PROFILE_HEADER
 
struct  SMM_PROFILE_ENTRY
 

Macros

#define SMM_PROFILE_DTS_SIZE   (4 * 1024 * 1024)
 
#define MAX_PF_PAGE_COUNT   0x2
 
#define PEBS_RECORD_NUMBER   0x2
 
#define MAX_PF_ENTRY_COUNT   10
 
#define IA32_PF_EC_ID   (1u << 4)
 
#define SMM_PROFILE_NAME   L"SmmProfileData"
 
#define MSR_EFER_XD   0x800
 
#define CPUID1_EDX_BTS_AVAILABLE   0x200000
 
#define DR6_SINGLE_STEP   0x4000
 
#define MSR_DS_AREA   0x600
 
#define HEAP_GUARD_NONSTOP_MODE    ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT6|BIT3|BIT2)) > BIT6)
 
#define NULL_DETECTION_NONSTOP_MODE    ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & (BIT6|BIT1)) > BIT6)
 

Functions

VOID InitIdtr (VOID)
 
BOOLEAN IsAddressSplit (IN EFI_PHYSICAL_ADDRESS Address)
 
BOOLEAN IsSmmProfilePFAddressAbove4GValid (IN EFI_PHYSICAL_ADDRESS Address, OUT BOOLEAN *Nx)
 
UINT64 AllocPage (VOID)
 
VOID SmmProfileMapPFAddress (VOID)
 
VOID ClearTrapFlag (IN OUT EFI_SYSTEM_CONTEXT SystemContext)
 

Variables

UINTN gSmiExceptionHandlers []
 
BOOLEAN mXdSupported
 
X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported
 
X86_ASSEMBLY_PATCH_LABEL gPatchMsrIa32MiscEnableSupported
 
UINTNmPFEntryCount
 
UINT64(* mLastPFEntryValue )[MAX_PF_ENTRY_COUNT]
 
UINT64 *(* mLastPFEntryPointer )[MAX_PF_ENTRY_COUNT]
 

Detailed Description

SMM profile internal header file.

Copyright (c) 2012 - 2024, Intel Corporation. All rights reserved.
Copyright (c) 2020, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SmmProfileInternal.h.

Macro Definition Documentation

◆ CPUID1_EDX_BTS_AVAILABLE

#define CPUID1_EDX_BTS_AVAILABLE   0x200000

Definition at line 44 of file SmmProfileInternal.h.

◆ DR6_SINGLE_STEP

#define DR6_SINGLE_STEP   0x4000

Definition at line 46 of file SmmProfileInternal.h.

◆ HEAP_GUARD_NONSTOP_MODE

#define HEAP_GUARD_NONSTOP_MODE    ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT6|BIT3|BIT2)) > BIT6)

Definition at line 50 of file SmmProfileInternal.h.

◆ IA32_PF_EC_ID

#define IA32_PF_EC_ID   (1u << 4)

Definition at line 35 of file SmmProfileInternal.h.

◆ MAX_PF_ENTRY_COUNT

#define MAX_PF_ENTRY_COUNT   10

Definition at line 28 of file SmmProfileInternal.h.

◆ MAX_PF_PAGE_COUNT

#define MAX_PF_PAGE_COUNT   0x2

Definition at line 24 of file SmmProfileInternal.h.

◆ MSR_DS_AREA

#define MSR_DS_AREA   0x600

Definition at line 48 of file SmmProfileInternal.h.

◆ MSR_EFER_XD

#define MSR_EFER_XD   0x800

Definition at line 42 of file SmmProfileInternal.h.

◆ NULL_DETECTION_NONSTOP_MODE

#define NULL_DETECTION_NONSTOP_MODE    ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & (BIT6|BIT1)) > BIT6)

Definition at line 53 of file SmmProfileInternal.h.

◆ PEBS_RECORD_NUMBER

#define PEBS_RECORD_NUMBER   0x2

Definition at line 26 of file SmmProfileInternal.h.

◆ SMM_PROFILE_DTS_SIZE

#define SMM_PROFILE_DTS_SIZE   (4 * 1024 * 1024)

Definition at line 22 of file SmmProfileInternal.h.

◆ SMM_PROFILE_NAME

#define SMM_PROFILE_NAME   L"SmmProfileData"

Definition at line 37 of file SmmProfileInternal.h.

Function Documentation

◆ AllocPage()

UINT64 AllocPage ( VOID  )

Allocate free Page for PageFault handler use.

Returns
Page address.

Definition at line 76 of file PageTbl.c.

◆ ClearTrapFlag()

VOID ClearTrapFlag ( IN OUT EFI_SYSTEM_CONTEXT  SystemContext)

Clear TF in FLAGS.

Parameters
SystemContextA pointer to the processor context when the interrupt occurred on the processor.

Definition at line 73 of file SmmProfileArch.c.

◆ InitIdtr()

VOID InitIdtr ( VOID  )

Update IDT table to replace page fault handler and INT 1 handler.

Replace INT1 exception handler to restore page table to absent/execute-disable state in order to trigger page fault again to save SMM profile data..

Definition at line 1394 of file SmmProfile.c.

◆ IsAddressSplit()

BOOLEAN IsAddressSplit ( IN EFI_PHYSICAL_ADDRESS  Address)

Check if the memory address will be mapped by 4KB-page.

Parameters
AddressThe address of Memory.

Definition at line 356 of file SmmProfile.c.

◆ IsSmmProfilePFAddressAbove4GValid()

BOOLEAN IsSmmProfilePFAddressAbove4GValid ( IN EFI_PHYSICAL_ADDRESS  Address,
OUT BOOLEAN *  Nx 
)

Check if the SMM profile page fault address above 4GB is in protected range or not.

Parameters
[in]AddressThe address of Memory.
[out]NxThe flag indicates if the memory is execute-disable.
Return values
TRUEThe input address is in protected range.
FALSEThe input address is not in protected range.

Definition at line 328 of file SmmProfile.c.

◆ SmmProfileMapPFAddress()

VOID SmmProfileMapPFAddress ( VOID  )

Create new entry in page table for page fault address in SmmProfilePFHandler.

Definition at line 85 of file SmmProfileArch.c.

Variable Documentation

◆ gPatchMsrIa32MiscEnableSupported

X86_ASSEMBLY_PATCH_LABEL gPatchMsrIa32MiscEnableSupported

Definition at line 92 of file SmmProfileInternal.h.

◆ gPatchXdSupported

X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported

Definition at line 91 of file SmmProfileInternal.h.

◆ mLastPFEntryPointer

UINT64*(* mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT]
extern

Definition at line 99 of file CpuPageTable.c.

◆ mLastPFEntryValue

UINT64(* mLastPFEntryValue)[MAX_PF_ENTRY_COUNT]
extern

Definition at line 63 of file SmmProfile.c.

◆ mPFEntryCount

UINTN* mPFEntryCount
extern

Definition at line 98 of file CpuPageTable.c.

◆ mXdSupported

BOOLEAN mXdSupported
extern

Definition at line 31 of file SmmProfile.c.