Fix bugs in SmmBaseHelper driver.

1. Should use sizeof(EFI_SMM_CPU_SAVE_STATE) instead of sizeof (EFI_SMI_CPU_SAVE_STATE) to allocate buffer for CpuSaveState in Framework SMST;
2. The type of Width parameter for ReadSaveState() and WriteSaveState() functions of SMM CPU Protocol is UINTN instead of an enumeration type.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9678 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
rsun3 2010-01-05 09:28:48 +00:00
parent 76bc52ed4f
commit f76edcfd29
1 changed files with 4 additions and 4 deletions

View File

@ -124,11 +124,11 @@ ConstructFrameworkSmst (
Status = gSmst->SmmAllocatePool ( Status = gSmst->SmmAllocatePool (
EfiRuntimeServicesData, EfiRuntimeServicesData,
gSmst->NumberOfCpus * sizeof (EFI_SMI_CPU_SAVE_STATE), gSmst->NumberOfCpus * sizeof (EFI_SMM_CPU_SAVE_STATE),
(VOID **)&FrameworkSmst->CpuSaveState (VOID **)&FrameworkSmst->CpuSaveState
); );
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
ZeroMem (FrameworkSmst->CpuSaveState, gSmst->NumberOfCpus * sizeof (EFI_SMI_CPU_SAVE_STATE)); ZeroMem (FrameworkSmst->CpuSaveState, gSmst->NumberOfCpus * sizeof (EFI_SMM_CPU_SAVE_STATE));
/// ///
/// Do not support floating point state now /// Do not support floating point state now
@ -430,7 +430,7 @@ CallbackThunk (
/// ///
Status = mSmmCpu->ReadSaveState ( Status = mSmmCpu->ReadSaveState (
mSmmCpu, mSmmCpu,
EFI_SMM_SAVE_STATE_IO_WIDTH_UINT32, (UINTN)sizeof (UINT32),
mCpuSaveStateConvTable[Index].Register, mCpuSaveStateConvTable[Index].Register,
CpuIndex, CpuIndex,
((UINT8 *)SaveState) + mCpuSaveStateConvTable[Index].Offset ((UINT8 *)SaveState) + mCpuSaveStateConvTable[Index].Offset
@ -462,7 +462,7 @@ CallbackThunk (
for (Index = 0; Index < sizeof (mCpuSaveStateConvTable) / sizeof (CPU_SAVE_STATE_CONVERSION); Index++) { for (Index = 0; Index < sizeof (mCpuSaveStateConvTable) / sizeof (CPU_SAVE_STATE_CONVERSION); Index++) {
Status = mSmmCpu->WriteSaveState ( Status = mSmmCpu->WriteSaveState (
mSmmCpu, mSmmCpu,
EFI_SMM_SAVE_STATE_IO_WIDTH_UINT32, (UINTN)sizeof (UINT32),
mCpuSaveStateConvTable[Index].Register, mCpuSaveStateConvTable[Index].Register,
CpuIndex, CpuIndex,
((UINT8 *)&mFrameworkSmst->CpuSaveState[CpuIndex].Ia32SaveState) + ((UINT8 *)&mFrameworkSmst->CpuSaveState[CpuIndex].Ia32SaveState) +