diff --git a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c index 95f265558c..3e7e0254a6 100644 --- a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c +++ b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.c @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -117,15 +118,19 @@ DxeTscTimerLibConstructor ( } EndTSC = AsmReadTsc(); // TSC value 1ms later - mTscFrequency = MultU64x32 ( - (EndTSC - StartTSC), // Number of TSC counts in 1ms - 1000 // Number of ms in a second - ); - // - // mTscFrequency is now equal to the number of TSC counts per second, install system configuration table for it. - // - gBS->InstallConfigurationTable (&gEfiTscFrequencyGuid, &mTscFrequency); + Status = gBS->AllocatePool (EfiBootServicesData, sizeof (UINT64), &TscFrequency); + ASSERT_EFI_ERROR (Status); + *TscFrequency = MultU64x32 ( + (EndTSC - StartTSC), // Number of TSC counts in 1ms + 1000 // Number of ms in a second + ); + // + // TscFrequency now points to the number of TSC counts per second, install system configuration table for it. + // + gBS->InstallConfigurationTable (&gEfiTscFrequencyGuid, TscFrequency); + + mTscFrequency = *TscFrequency; return EFI_SUCCESS; } diff --git a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf index 28978d78c7..8d2e6cf8bb 100644 --- a/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf +++ b/PerformancePkg/Library/DxeTscTimerLib/DxeTscTimerLib.inf @@ -49,6 +49,7 @@ IoLib BaseLib UefiLib + DebugLib [Guids] gEfiTscFrequencyGuid ## CONSUMES ## System Configuration Table