TianoCore EDK2 master
Loading...
Searching...
No Matches
MmSaveStateCommon.c File Reference
#include "MmSaveState.h"

Go to the source code of this file.

Functions

UINTN MmSaveStateGetRegisterIndex (IN EFI_MM_SAVE_STATE_REGISTER Register, IN UINTN RegOffset)
 
EFI_STATUS MmSaveStateReadRegisterByIndex (IN UINTN CpuIndex, IN UINTN RegisterIndex, IN UINTN Width, OUT VOID *Buffer)
 

Variables

CONST CPU_MM_SAVE_STATE_REGISTER_RANGE mCpuRegisterRanges []
 
CONST CPU_MM_SAVE_STATE_LOOKUP_ENTRY mCpuWidthOffset []
 

Detailed Description

Provides common supporting function to access SMRAM Save State Map

Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.

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

Definition in file MmSaveStateCommon.c.

Function Documentation

◆ MmSaveStateGetRegisterIndex()

UINTN MmSaveStateGetRegisterIndex ( IN EFI_MM_SAVE_STATE_REGISTER  Register,
IN UINTN  RegOffset 
)

Read information from the CPU save state.

Parameters
RegisterSpecifies the CPU register to read form the save state.
RegOffsetOffset for the next register index.
Return values
0Register is not valid
>0Index into mCpuWidthOffset[] associated with Register

Definition at line 35 of file MmSaveStateCommon.c.

◆ MmSaveStateReadRegisterByIndex()

EFI_STATUS MmSaveStateReadRegisterByIndex ( IN UINTN  CpuIndex,
IN UINTN  RegisterIndex,
IN UINTN  Width,
OUT VOID *  Buffer 
)

Read a CPU Save State register on the target processor.

This function abstracts the differences that whether the CPU Save State register is in the IA32 CPU Save State Map or X64 CPU Save State Map.

This function supports reading a CPU Save State register in SMBase relocation handler.

Parameters
[in]CpuIndexSpecifies the zero-based index of the CPU save state.
[in]RegisterIndexIndex into mCpuWidthOffset[] look up table.
[in]WidthThe number of bytes to read from the CPU save state.
[out]BufferUpon return, this holds the CPU register value read from the save state.
Return values
EFI_SUCCESSThe register was read from Save State.
EFI_NOT_FOUNDThe register is not defined for the Save State of Processor.
EFI_INVALID_PARAMTERThis or Buffer is NULL.

Definition at line 73 of file MmSaveStateCommon.c.

Variable Documentation

◆ mCpuRegisterRanges

Initial value:
= {
MM_REGISTER_RANGE (EFI_MM_SAVE_STATE_REGISTER_GDTBASE, EFI_MM_SAVE_STATE_REGISTER_LDTINFO),
MM_REGISTER_RANGE (EFI_MM_SAVE_STATE_REGISTER_ES, EFI_MM_SAVE_STATE_REGISTER_RIP),
MM_REGISTER_RANGE (EFI_MM_SAVE_STATE_REGISTER_RFLAGS, EFI_MM_SAVE_STATE_REGISTER_CR4),
}
EFI_MM_SAVE_STATE_REGISTER
Definition: MmCpu.h:25
@ EFI_MM_SAVE_STATE_REGISTER_GDTBASE
Definition: MmCpu.h:29

Definition at line 15 of file MmSaveStateCommon.c.

◆ mCpuWidthOffset

CONST CPU_MM_SAVE_STATE_LOOKUP_ENTRY mCpuWidthOffset[]
extern

Lookup table used to retrieve the widths and offsets associated with each supported EFI_MM_SAVE_STATE_REGISTER value

Definition at line 30 of file AmdMmSaveState.c.