Ported to use BaseMemoryLib functions
authorajfish <ajfish@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 8 Jul 2006 14:53:17 +0000 (14:53 +0000)
committerajfish <ajfish@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 8 Jul 2006 14:53:17 +0000 (14:53 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@839 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c

index e4e7b3b..d241723 100644 (file)
@@ -118,7 +118,8 @@ GetGauge (
 STATIC GAUGE_DATA_HEADER    *mGaugeData;\r
 STATIC UINT32               mMaxGaugeRecords;\r
 \r
-PERFORMANCE_PROTOCOL PerformanceInterface = {\r
+EFI_HANDLE           mHandle = NULL;\r
+PERFORMANCE_PROTOCOL mPerformanceInterface = {\r
   StartGauge,\r
   EndGauge,\r
   GetGauge\r
@@ -223,21 +224,18 @@ StartGauge (
     //\r
     OldGaugeData      = mGaugeData;\r
     OldGaugeDataSize  = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords;\r
+\r
     mMaxGaugeRecords *= 2;\r
     GaugeDataSize     = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords;\r
-    Status            = gBS->AllocatePool (\r
-                               EfiBootServicesData,\r
-                               GaugeDataSize,\r
-                               (VOID **) &mGaugeData\r
-                               );\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
+    \r
+    mGaugeData = AllocateZeroPool (GaugeDataSize);\r
+    if (mGaugeData == NULL) {\r
+      return EFI_OUT_OF_MEMORY;\r
     }\r
     //\r
     // Initialize new data arry and migrate old data one. \r
     //\r
-    mGaugeData        = ZeroMem (mGaugeData, GaugeDataSize);\r
-    mGaugeData        = CopyMem (mGaugeData, OldGaugeData, OldGaugeDataSize);\r
+    mGaugeData = CopyMem (mGaugeData, OldGaugeData, OldGaugeDataSize);\r
     \r
     gBS->FreePool (OldGaugeData); \r
   }\r
@@ -423,31 +421,23 @@ DxeCorePerformanceLibConstructor (
   )\r
 {\r
   EFI_STATUS                Status;\r
-  EFI_HANDLE                Handle;\r
-  UINTN                     GaugeDataSize;\r
 \r
   //\r
   // Install the protocol interfaces.\r
   //\r
   Handle = NULL;\r
   Status = gBS->InstallProtocolInterface (\r
-                  &Handle,\r
+                  &mHandle,\r
                   &gPerformanceProtocolGuid,\r
                   EFI_NATIVE_INTERFACE,\r
-                  &PerformanceInterface\r
+                  &mPerformanceInterface\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + MAX_PEI_PERFORMANCE_LOG_ENTRIES;\r
-  GaugeDataSize   = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords;\r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  GaugeDataSize,\r
-                  (VOID **) &mGaugeData\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
 \r
-  ZeroMem (mGaugeData, GaugeDataSize);\r
+  mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords));\r
+  ASSERT (mGaugeData != NULL);\r
 \r
   InternalGetPeiPerformance ();\r
 \r