UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic
This patch is to remove legacy SmBase relocation in PiSmmCpuDxeSmm Driver. The responsibility for SmBase relocation has been transferred to the SmmRelocationInit interface, which now handles the following tasks: 1. Relocates the SmBase for each processor. 2. Generates the gSmmBaseHobGuid HOB. As a result of this change, the PiSmmCpuDxeSmm driver's role in SMM environment setup is simplified to: 1. Utilize the gSmmBaseHobGuid to determine the SmBase. 2. Perform the ExecuteFirstSmiInit() to do early SMM initialization. Cc: Ray Ni <ray.ni@intel.com> Cc: Zeng Star <star.zeng@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
@@ -69,75 +69,6 @@ IA32_DESCRIPTOR gSmiHandlerIdtr;
|
||||
///
|
||||
UINT8 mSmmSaveStateRegisterLma;
|
||||
|
||||
/**
|
||||
Hook the code executed immediately after an RSM instruction on the currently
|
||||
executing CPU. The mode of code executed immediately after RSM must be
|
||||
detected, and the appropriate hook must be selected. Always clear the auto
|
||||
HALT restart flag if it is set.
|
||||
|
||||
@param[in] CpuIndex The processor index for the currently
|
||||
executing CPU.
|
||||
@param[in] CpuState Pointer to SMRAM Save State Map for the
|
||||
currently executing CPU.
|
||||
@param[in] NewInstructionPointer32 Instruction pointer to use if resuming to
|
||||
32-bit mode from 64-bit SMM.
|
||||
@param[in] NewInstructionPointer Instruction pointer to use if resuming to
|
||||
same mode as SMM.
|
||||
|
||||
@retval The value of the original instruction pointer before it was hooked.
|
||||
|
||||
**/
|
||||
UINT64
|
||||
EFIAPI
|
||||
HookReturnFromSmm (
|
||||
IN UINTN CpuIndex,
|
||||
SMRAM_SAVE_STATE_MAP *CpuState,
|
||||
UINT64 NewInstructionPointer32,
|
||||
UINT64 NewInstructionPointer
|
||||
)
|
||||
{
|
||||
UINT64 OriginalInstructionPointer;
|
||||
|
||||
OriginalInstructionPointer = SmmCpuFeaturesHookReturnFromSmm (
|
||||
CpuIndex,
|
||||
CpuState,
|
||||
NewInstructionPointer32,
|
||||
NewInstructionPointer
|
||||
);
|
||||
if (OriginalInstructionPointer != 0) {
|
||||
return OriginalInstructionPointer;
|
||||
}
|
||||
|
||||
if (mSmmSaveStateRegisterLma == EFI_SMM_SAVE_STATE_REGISTER_LMA_32BIT) {
|
||||
OriginalInstructionPointer = (UINT64)CpuState->x86._EIP;
|
||||
CpuState->x86._EIP = (UINT32)NewInstructionPointer;
|
||||
//
|
||||
// Clear the auto HALT restart flag so the RSM instruction returns
|
||||
// program control to the instruction following the HLT instruction.
|
||||
//
|
||||
if ((CpuState->x86.AutoHALTRestart & BIT0) != 0) {
|
||||
CpuState->x86.AutoHALTRestart &= ~BIT0;
|
||||
}
|
||||
} else {
|
||||
OriginalInstructionPointer = CpuState->x64._RIP;
|
||||
if ((CpuState->x64.IA32_EFER & LMA) == 0) {
|
||||
CpuState->x64._RIP = (UINT32)NewInstructionPointer32;
|
||||
} else {
|
||||
CpuState->x64._RIP = (UINT32)NewInstructionPointer;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the auto HALT restart flag so the RSM instruction returns
|
||||
// program control to the instruction following the HLT instruction.
|
||||
//
|
||||
if ((CpuState->x64.AutoHALTRestart & BIT0) != 0) {
|
||||
CpuState->x64.AutoHALTRestart &= ~BIT0;
|
||||
}
|
||||
}
|
||||
|
||||
return OriginalInstructionPointer;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the size of the SMI Handler in bytes.
|
||||
|
||||
|
Reference in New Issue
Block a user