mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
UefiCpuPkg/PiSmmCpuDxeSmm: Skip if AllocatedSize is 0
Needn't to copy register table if AllocatedSize is 0. v4: Fix potential uninitialized variable issue. v5: Set DestinationRegisterTableList[Index].RegisterTableEntry before RegisterTableEntry is updated. Cc: Feng Tian <feng.tian@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
This commit is contained in:
parent
8b371e93f2
commit
30d995ee08
@ -826,21 +826,25 @@ CopyRegisterTable (
|
|||||||
|
|
||||||
CopyMem (DestinationRegisterTableList, SourceRegisterTableList, NumberOfCpus * sizeof (CPU_REGISTER_TABLE));
|
CopyMem (DestinationRegisterTableList, SourceRegisterTableList, NumberOfCpus * sizeof (CPU_REGISTER_TABLE));
|
||||||
for (Index = 0; Index < NumberOfCpus; Index++) {
|
for (Index = 0; Index < NumberOfCpus; Index++) {
|
||||||
RegisterTableEntry = AllocatePool (DestinationRegisterTableList[Index].AllocatedSize);
|
if (DestinationRegisterTableList[Index].AllocatedSize != 0) {
|
||||||
ASSERT (RegisterTableEntry != NULL);
|
RegisterTableEntry = AllocateCopyPool (
|
||||||
CopyMem (RegisterTableEntry, (VOID *)(UINTN)SourceRegisterTableList[Index].RegisterTableEntry, DestinationRegisterTableList[Index].AllocatedSize);
|
DestinationRegisterTableList[Index].AllocatedSize,
|
||||||
//
|
(VOID *)(UINTN)SourceRegisterTableList[Index].RegisterTableEntry
|
||||||
// Go though all MSRs in register table to initialize MSR spin lock
|
);
|
||||||
//
|
ASSERT (RegisterTableEntry != NULL);
|
||||||
for (Index1 = 0; Index1 < DestinationRegisterTableList[Index].TableLength; Index1++, RegisterTableEntry++) {
|
DestinationRegisterTableList[Index].RegisterTableEntry = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTableEntry;
|
||||||
if ((RegisterTableEntry->RegisterType == Msr) && (RegisterTableEntry->ValidBitLength < 64)) {
|
//
|
||||||
//
|
// Go though all MSRs in register table to initialize MSR spin lock
|
||||||
// Initialize MSR spin lock only for those MSRs need bit field writing
|
//
|
||||||
//
|
for (Index1 = 0; Index1 < DestinationRegisterTableList[Index].TableLength; Index1++, RegisterTableEntry++) {
|
||||||
InitMsrSpinLockByIndex (RegisterTableEntry->Index);
|
if ((RegisterTableEntry->RegisterType == Msr) && (RegisterTableEntry->ValidBitLength < 64)) {
|
||||||
|
//
|
||||||
|
// Initialize MSR spin lock only for those MSRs need bit field writing
|
||||||
|
//
|
||||||
|
InitMsrSpinLockByIndex (RegisterTableEntry->Index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DestinationRegisterTableList[Index].RegisterTableEntry = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTableEntry;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user