TianoCore EDK2 master
|
Go to the source code of this file.
Variables | |
UINT32 | mSmmProfileCr3 |
SMM_PROFILE_HEADER * | mSmmProfileBase |
MSR_DS_AREA_STRUCT * | mMsrDsAreaBase |
UINTN | mSmmProfileSize |
UINTN | mMsrDsAreaSize = SMM_PROFILE_DTS_SIZE |
BOOLEAN | mXdSupported = TRUE |
BOOLEAN | mXdEnabled = FALSE |
BOOLEAN | mBtsSupported = TRUE |
BOOLEAN | mSmmProfileEnabled = FALSE |
BOOLEAN | mSmmProfileStart = FALSE |
BOOLEAN | mSetupDebugTrap = FALSE |
UINTN * | mPFEntryCount |
UINT64(* | mLastPFEntryValue )[MAX_PF_ENTRY_COUNT] |
UINT64 *(* | mLastPFEntryPointer )[MAX_PF_ENTRY_COUNT] |
MSR_DS_AREA_STRUCT ** | mMsrDsArea |
BRANCH_TRACE_RECORD ** | mMsrBTSRecord |
UINTN | mBTSRecordNumber |
PEBS_RECORD ** | mMsrPEBSRecord |
MEMORY_PROTECTION_RANGE * | mProtectionMemRange = NULL |
UINTN | mProtectionMemRangeCount = 0 |
MEMORY_PROTECTION_RANGE | mProtectionMemRangeTemplate [] |
MEMORY_RANGE * | mSplitMemRange = NULL |
UINTN | mSplitMemRangeCount = 0 |
UINT32 | mSmiCommandPort |
Enable SMM profile.
Copyright (c) 2012 - 2024, Intel Corporation. All rights reserved.
Copyright (c) 2017 - 2020, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SmmProfile.c.
Enable branch trace store.
CpuIndex | The index of the processor. |
Definition at line 963 of file SmmProfile.c.
VOID ActivateLBR | ( | VOID | ) |
Enable last branch.
Definition at line 941 of file SmmProfile.c.
VOID ActivateSingleStepDB | ( | VOID | ) |
Enable single step.
Definition at line 921 of file SmmProfile.c.
Initialize processor environment for SMM profile.
CpuIndex | The index of the processor. |
Definition at line 1007 of file SmmProfile.c.
Check if feature is supported by a processor.
CpuIndex | The index of the CPU. |
Definition at line 859 of file SmmProfile.c.
VOID EFIAPI DebugExceptionHandler | ( | IN EFI_EXCEPTION_TYPE | InterruptType, |
IN EFI_SYSTEM_CONTEXT | SystemContext | ||
) |
SMM profile specific INT 1 (single-step) exception handler.
InterruptType | Defines the type of interrupt or exception that occurred on the processor.This parameter is processor architecture specific. |
SystemContext | A pointer to the processor context when the interrupt occurred on the processor. |
Definition at line 247 of file SmmProfile.c.
VOID DisableBTS | ( | VOID | ) |
Disable branch trace store.
Definition at line 130 of file SmmProfile.c.
VOID EnableBTS | ( | VOID | ) |
Enable branch trace store.
Definition at line 148 of file SmmProfile.c.
UINTN GetCpuIndex | ( | VOID | ) |
Get CPU Index from APIC ID.
Definition at line 166 of file SmmProfile.c.
UINT64 GetSourceFromDestinationOnBts | ( | UINTN | CpuIndex, |
UINT64 | DestinationIP | ||
) |
Get the source of IP after execute-disable exception is triggered.
CpuIndex | The index of CPU. |
DestinationIP | The destination address. |
Definition at line 193 of file SmmProfile.c.
VOID GuardPagePFHandler | ( | UINTN | ErrorCode | ) |
Handler for Page Fault triggered by Guard page.
ErrorCode | The Error code of exception. |
Definition at line 1208 of file SmmProfile.c.
VOID InitIdtr | ( | VOID | ) |
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.
VOID InitProtectedMemRange | ( | VOID | ) |
Initialize the protected memory ranges and the 4KB-page mapped memory ranges.
Definition at line 420 of file SmmProfile.c.
VOID InitSmmProfile | ( | UINT32 | Cr3 | ) |
Initialize SMM profile in SMM CPU entry point.
[in] | Cr3 | The base address of the page tables to use in SMM. |
Definition at line 1036 of file SmmProfile.c.
EFI_STATUS EFIAPI InitSmmProfileCallBack | ( | IN CONST EFI_GUID * | Protocol, |
IN VOID * | Interface, | ||
IN EFI_HANDLE | Handle | ||
) |
Initialize SMM profile in SmmReadyToLock protocol callback function.
Protocol | Points to the protocol's unique identifier. |
Interface | Points to the interface instance. |
Handle | The handle on which the interface was installed. |
EFI_SUCCESS | SmmReadyToLock protocol callback runs successfully. |
Definition at line 708 of file SmmProfile.c.
VOID InitSmmProfileInternal | ( | VOID | ) |
Initialize SMM profile data structures.
Definition at line 742 of file SmmProfile.c.
BOOLEAN IsAddressSplit | ( | IN EFI_PHYSICAL_ADDRESS | Address | ) |
Check if the memory address will be mapped by 4KB-page.
Address | The address of Memory. |
Definition at line 356 of file SmmProfile.c.
BOOLEAN IsInSmmRanges | ( | IN EFI_PHYSICAL_ADDRESS | Address | ) |
Check if the input address is in SMM ranges.
[in] | Address | The input address. |
TRUE | The input address is in SMM. |
FALSE | The input address is not in SMM. |
Definition at line 296 of file SmmProfile.c.
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.
[in] | Address | The address of Memory. |
[out] | Nx | The flag indicates if the memory is execute-disable. |
TRUE | The input address is in protected range. |
FALSE | The input address is not in protected range. |
Definition at line 328 of file SmmProfile.c.
Function to compare 2 MEMORY_PROTECTION_RANGE based on range base.
[in] | Buffer1 | pointer to Device Path poiner to compare |
[in] | Buffer2 | pointer to second DevicePath pointer to compare |
0 | Buffer1 equal to Buffer2 |
<0 | Buffer1 is less than Buffer2 |
>0 | Buffer1 is greater than Buffer2 |
Definition at line 401 of file SmmProfile.c.
VOID RestorePageTableBelow4G | ( | UINT64 * | PageTable, |
UINT64 | PFAddress, | ||
UINTN | CpuIndex, | ||
UINTN | ErrorCode | ||
) |
Update page table to map the memory correctly in order to make the instruction which caused page fault execute successfully. And it also save the original page table to be restored in single-step exception.
PageTable | PageTable Address. |
PFAddress | The memory address which caused page fault exception. |
CpuIndex | The index of the processor. |
ErrorCode | The Error code of exception. |
Definition at line 1078 of file SmmProfile.c.
The Page fault handler to save SMM profile data.
Rip | The RIP when exception happens. |
ErrorCode | The Error code of exception. |
Definition at line 1249 of file SmmProfile.c.
VOID SmmProfileRecordSmiNum | ( | VOID | ) |
Increase SMI number in each SMI entry.
Definition at line 991 of file SmmProfile.c.
VOID SmmProfileStart | ( | VOID | ) |
Updates page table to make some memory ranges (like system memory) absent and make some memory ranges (like MMIO) present and execute disable. It also update 2MB-page to 4KB-page for some memory ranges.
Definition at line 682 of file SmmProfile.c.
VOID SmmProfileUpdateMemoryAttributes | ( | VOID | ) |
This function updates memory attribute according to mProtectionMemRangeCount.
Definition at line 597 of file SmmProfile.c.
UINTN mBTSRecordNumber |
Definition at line 68 of file SmmProfile.c.
BOOLEAN mBtsSupported = TRUE |
Definition at line 41 of file SmmProfile.c.
UINT64*(* mLastPFEntryPointer)[MAX_PF_ENTRY_COUNT] |
Definition at line 64 of file SmmProfile.c.
UINT64(* mLastPFEntryValue)[MAX_PF_ENTRY_COUNT] |
Definition at line 63 of file SmmProfile.c.
BRANCH_TRACE_RECORD** mMsrBTSRecord |
Definition at line 67 of file SmmProfile.c.
MSR_DS_AREA_STRUCT** mMsrDsArea |
Definition at line 66 of file SmmProfile.c.
MSR_DS_AREA_STRUCT* mMsrDsAreaBase |
Definition at line 17 of file SmmProfile.c.
UINTN mMsrDsAreaSize = SMM_PROFILE_DTS_SIZE |
Definition at line 26 of file SmmProfile.c.
PEBS_RECORD** mMsrPEBSRecord |
Definition at line 69 of file SmmProfile.c.
UINTN* mPFEntryCount |
Definition at line 61 of file SmmProfile.c.
MEMORY_PROTECTION_RANGE* mProtectionMemRange = NULL |
Definition at line 75 of file SmmProfile.c.
UINTN mProtectionMemRangeCount = 0 |
Definition at line 76 of file SmmProfile.c.
MEMORY_PROTECTION_RANGE mProtectionMemRangeTemplate[] |
Definition at line 81 of file SmmProfile.c.
BOOLEAN mSetupDebugTrap = FALSE |
Definition at line 56 of file SmmProfile.c.
UINT32 mSmiCommandPort |
Definition at line 123 of file SmmProfile.c.
SMM_PROFILE_HEADER* mSmmProfileBase |
Definition at line 16 of file SmmProfile.c.
UINT32 mSmmProfileCr3 |
Definition at line 14 of file SmmProfile.c.
BOOLEAN mSmmProfileEnabled = FALSE |
Definition at line 46 of file SmmProfile.c.
UINTN mSmmProfileSize |
Definition at line 21 of file SmmProfile.c.
BOOLEAN mSmmProfileStart = FALSE |
Definition at line 51 of file SmmProfile.c.
MEMORY_RANGE* mSplitMemRange = NULL |
Definition at line 117 of file SmmProfile.c.
UINTN mSplitMemRangeCount = 0 |
Definition at line 118 of file SmmProfile.c.
BOOLEAN mXdEnabled = FALSE |
Definition at line 36 of file SmmProfile.c.
BOOLEAN mXdSupported = TRUE |
Definition at line 31 of file SmmProfile.c.