TianoCore EDK2 master
Loading...
Searching...
No Matches
AmdSmramSaveStateConfig.c File Reference

Go to the source code of this file.

Functions

UINT8 GetMmSaveStateRegisterLma (VOID)
 
VOID EFIAPI ConfigureSmBase (IN UINT64 SmBase)
 
UINT64 EFIAPI HookReturnFromSmm (IN OUT SMRAM_SAVE_STATE_MAP *CpuState, IN UINT64 NewInstructionPointer32, IN UINT64 NewInstructionPointer)
 

Detailed Description

Config SMRAM Save State for SmmBases Relocation.

Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file AmdSmramSaveStateConfig.c.

Function Documentation

◆ ConfigureSmBase()

VOID EFIAPI ConfigureSmBase ( IN UINT64  SmBase)

This function configures the SmBase on the currently executing CPU.

Parameters
[in]SmBaseThe SmBase on the currently executing CPU.

Definition at line 46 of file AmdSmramSaveStateConfig.c.

◆ GetMmSaveStateRegisterLma()

UINT8 GetMmSaveStateRegisterLma ( VOID  )

Get the mode of the CPU at the time an SMI occurs

Return values
EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT32 bit.
EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT64 bit.

Definition at line 20 of file AmdSmramSaveStateConfig.c.

◆ HookReturnFromSmm()

UINT64 EFIAPI HookReturnFromSmm ( IN OUT SMRAM_SAVE_STATE_MAP CpuState,
IN UINT64  NewInstructionPointer32,
IN UINT64  NewInstructionPointer 
)

This function updates the SMRAM save state on the currently executing CPU to resume execution at a specific address after an RSM instruction. This function must evaluate the SMRAM save state to determine the execution mode the RSM instruction resumes and update the resume execution address with either NewInstructionPointer32 or NewInstructionPoint. The auto HALT restart flag in the SMRAM save state must always be cleared. This function returns the value of the instruction pointer from the SMRAM save state that was replaced. If this function returns 0, then the SMRAM save state was not modified.

This function is called during the very first SMI on each CPU after SmmCpuFeaturesInitializeProcessor() to set a flag in normal execution mode to signal that the SMBASE of each CPU has been updated before the default SMBASE address is used for the first SMI to the next CPU.

Parameters
[in,out]CpuStatePointer to SMRAM Save State Map for the currently executing CPU.
[in]NewInstructionPointer32Instruction pointer to use if resuming to 32-bit mode from 64-bit SMM.
[in]NewInstructionPointerInstruction pointer to use if resuming to same mode as SMM.
Return values
Thevalue of the original instruction pointer before it was hooked.

Definition at line 85 of file AmdSmramSaveStateConfig.c.