TianoCore EDK2 master
Loading...
Searching...
No Matches
SmmProfileArch.c File Reference
#include "PiSmmCpuCommon.h"
#include "SmmProfileInternal.h"

Go to the source code of this file.

Functions

VOID InitSmmS3Cr3 (OUT UINTN *Cr3)
 
VOID InitPagesForPFHandler (VOID)
 
VOID AcquirePage (UINT64 *Uplink)
 
VOID SmmProfileMapPFAddress (VOID)
 
VOID RestorePageTableAbove4G (UINT64 *PageTable, UINT64 PFAddress, UINTN CpuIndex, UINTN ErrorCode, BOOLEAN *IsValidPFAddress)
 
VOID ClearTrapFlag (IN OUT EFI_SYSTEM_CONTEXT SystemContext)
 

Variables

UINTN mPFPageIndex
 
UINT64 mPFPageBuffer
 
UINT64 * mPFPageUplink [MAX_PF_PAGE_COUNT]
 

Detailed Description

X64 processor specific functions to enable SMM profile.

Copyright (c) 2012 - 2024, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Incorporated. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SmmProfileArch.c.

Function Documentation

◆ AcquirePage()

VOID AcquirePage ( UINT64 *  Uplink)

Allocate one page for creating 4KB-page based on 2MB-page.

Parameters
UplinkThe address of Page-Directory entry.

Definition at line 84 of file SmmProfileArch.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 473 of file SmmProfileArch.c.

◆ InitPagesForPFHandler()

VOID InitPagesForPFHandler ( VOID  )

Allocate pages for creating 4KB-page based on 2MB-page when page fault happens.

Definition at line 56 of file SmmProfileArch.c.

◆ InitSmmS3Cr3()

VOID InitSmmS3Cr3 ( OUT UINTN Cr3)

Create SMM page table for S3 path.

Parameters
[out]Cr3The base address of the page tables.

Definition at line 36 of file SmmProfileArch.c.

◆ RestorePageTableAbove4G()

VOID RestorePageTableAbove4G ( UINT64 *  PageTable,
UINT64  PFAddress,
UINTN  CpuIndex,
UINTN  ErrorCode,
BOOLEAN *  IsValidPFAddress 
)

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.

Parameters
PageTablePageTable Address.
PFAddressThe memory address which caused page fault exception.
CpuIndexThe index of the processor.
ErrorCodeThe Error code of exception.
IsValidPFAddressThe flag indicates if SMM profile data need be added.

Definition at line 275 of file SmmProfileArch.c.

◆ SmmProfileMapPFAddress()

VOID SmmProfileMapPFAddress ( VOID  )

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

Definition at line 117 of file SmmProfileArch.c.

Variable Documentation

◆ mPFPageBuffer

UINT64 mPFPageBuffer

Definition at line 22 of file SmmProfileArch.c.

◆ mPFPageIndex

UINTN mPFPageIndex

Definition at line 17 of file SmmProfileArch.c.

◆ mPFPageUplink

UINT64* mPFPageUplink[MAX_PF_PAGE_COUNT]

Definition at line 27 of file SmmProfileArch.c.