]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
UefiCpuPkg/PiSmmCpuDxeSmm: Combine INIT-SIPI-SIPI.
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / PiSmmCpuDxeSmm.c
index 47cba100e7653e23311993a62d837f65068c4320..282d2e69817c2a4f9f0caecf38bfd9ebf514f9fc 100755 (executable)
@@ -114,6 +114,8 @@ SPIN_LOCK                *mConfigSmmCodeAccessCheckLock = NULL;
 EFI_SMRAM_DESCRIPTOR     *mSmmCpuSmramRanges;\r
 UINTN                    mSmmCpuSmramRangeCount;\r
 \r
+UINT8                    mPhysicalAddressBits;\r
+\r
 /**\r
   Initialize IDT to setup exception handlers for SMM.\r
 \r
@@ -173,48 +175,17 @@ DumpModuleInfoByIp (
   )\r
 {\r
   UINTN                                Pe32Data;\r
-  EFI_IMAGE_DOS_HEADER                 *DosHdr;\r
-  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;\r
   VOID                                 *PdbPointer;\r
-  UINT64                               DumpIpAddress;\r
 \r
   //\r
   // Find Image Base\r
   //\r
-  Pe32Data = CallerIpAddress & ~(SIZE_4KB - 1);\r
-  while (Pe32Data != 0) {\r
-    DosHdr = (EFI_IMAGE_DOS_HEADER *) Pe32Data;\r
-    if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
-      //\r
-      // DOS image header is present, so read the PE header after the DOS image header.\r
-      //\r
-      Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(Pe32Data + (UINTN) ((DosHdr->e_lfanew) & 0x0ffff));\r
-      //\r
-      // Make sure PE header address does not overflow and is less than the initial address.\r
-      //\r
-      if (((UINTN)Hdr.Pe32 > Pe32Data) && ((UINTN)Hdr.Pe32 < CallerIpAddress)) {\r
-        if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {\r
-          //\r
-          // It's PE image.\r
-          //\r
-          break;\r
-        }\r
-      }\r
-    }\r
-\r
-    //\r
-    // Not found the image base, check the previous aligned address\r
-    //\r
-    Pe32Data -= SIZE_4KB;\r
-  }\r
-\r
-  DumpIpAddress = CallerIpAddress;\r
-  DEBUG ((EFI_D_ERROR, "It is invoked from the instruction before IP(0x%lx)", DumpIpAddress));\r
-\r
+  Pe32Data = PeCoffSearchImageBase (CallerIpAddress);\r
   if (Pe32Data != 0) {\r
+    DEBUG ((DEBUG_ERROR, "It is invoked from the instruction before IP(0x%p)", (VOID *) CallerIpAddress));\r
     PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *) Pe32Data);\r
     if (PdbPointer != NULL) {\r
-      DEBUG ((EFI_D_ERROR, " in module (%a)", PdbPointer));\r
+      DEBUG ((DEBUG_ERROR, " in module (%a)\n", PdbPointer));\r
     }\r
   }\r
 }\r
@@ -1148,7 +1119,12 @@ ConfigSmmCodeAccessCheck (
   //\r
   for (Index = 0; Index < gSmst->NumberOfCpus; Index++) {\r
     if (Index != gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu) {\r
-\r
+      if (gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId == INVALID_APIC_ID) {\r
+        //\r
+        // If this processor does not exist\r
+        //\r
+        continue;\r
+      }\r
       //\r
       // Acquire Config SMM Code Access Check spin lock.  The AP will release the\r
       // spin lock when it is done executing ConfigSmmCodeAccessCheckOnCurrentProcessor().\r