]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
MdeModulePkg DxeCore: Fix issue to print GUID value %g without pointer
[mirror_edk2.git] / MdeModulePkg / Core / PiSmmCore / PiSmmCore.c
index b877a3325f69bd4ab0d1f028109ce895cc68634d..9e4390e15a1cbe69d44d57b0221ed8faaa297ac4 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM Core Main Entry Point\r
 \r
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available \r
   under the terms and conditions of the BSD License which accompanies this \r
   distribution.  The full text of the license may be found at        \r
@@ -432,6 +432,8 @@ SmmEntryPoint (
   EFI_SMM_COMMUNICATE_HEADER  *CommunicateHeader;\r
   BOOLEAN                     InLegacyBoot;\r
   BOOLEAN                     IsOverlapped;\r
+  VOID                        *CommunicationBuffer;\r
+  UINTN                       BufferSize;\r
 \r
   PERF_START (NULL, "SMM", NULL, 0) ;\r
 \r
@@ -463,17 +465,19 @@ SmmEntryPoint (
     // Check to see if this is a Synchronous SMI sent through the SMM Communication \r
     // Protocol or an Asynchronous SMI\r
     //\r
-    if (gSmmCorePrivate->CommunicationBuffer != NULL) {\r
+    CommunicationBuffer = gSmmCorePrivate->CommunicationBuffer;\r
+    BufferSize          = gSmmCorePrivate->BufferSize;\r
+    if (CommunicationBuffer != NULL) {\r
       //\r
       // Synchronous SMI for SMM Core or request from Communicate protocol\r
       //\r
       IsOverlapped = InternalIsBufferOverlapped (\r
-                       (UINT8 *) gSmmCorePrivate->CommunicationBuffer,\r
-                       gSmmCorePrivate->BufferSize,\r
+                       (UINT8 *) CommunicationBuffer,\r
+                       BufferSize,\r
                        (UINT8 *) gSmmCorePrivate,\r
                        sizeof (*gSmmCorePrivate)\r
                        );\r
-      if (!SmmIsBufferOutsideSmmValid ((UINTN)gSmmCorePrivate->CommunicationBuffer, gSmmCorePrivate->BufferSize) || IsOverlapped) {\r
+      if (!SmmIsBufferOutsideSmmValid ((UINTN)CommunicationBuffer, BufferSize) || IsOverlapped) {\r
         //\r
         // If CommunicationBuffer is not in valid address scope,\r
         // or there is overlap between gSmmCorePrivate and CommunicationBuffer,\r
@@ -482,19 +486,19 @@ SmmEntryPoint (
         gSmmCorePrivate->CommunicationBuffer = NULL;\r
         gSmmCorePrivate->ReturnStatus = EFI_INVALID_PARAMETER;\r
       } else {\r
-        CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)gSmmCorePrivate->CommunicationBuffer;\r
-        gSmmCorePrivate->BufferSize -= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
+        CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)CommunicationBuffer;\r
+        BufferSize -= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
         Status = SmiManage (\r
                    &CommunicateHeader->HeaderGuid, \r
                    NULL, \r
                    CommunicateHeader->Data, \r
-                   &gSmmCorePrivate->BufferSize\r
+                   &BufferSize\r
                    );\r
         //\r
         // Update CommunicationBuffer, BufferSize and ReturnStatus\r
         // Communicate service finished, reset the pointer to CommBuffer to NULL\r
         //\r
-        gSmmCorePrivate->BufferSize += OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
+        gSmmCorePrivate->BufferSize = BufferSize + OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);\r
         gSmmCorePrivate->CommunicationBuffer = NULL;\r
         gSmmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;\r
       }\r
@@ -676,5 +680,7 @@ SmmMain (
 \r
   SmmCoreInitializeMemoryAttributesTable ();\r
 \r
+  SmmCoreInitializeSmiHandlerProfile ();\r
+\r
   return EFI_SUCCESS;\r
 }\r