]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
PeCoffGetEntryPointLib: Fix spelling issue
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / DebugAgentCommon / DebugAgent.c
index 3eca30497f8bf2896d2b2a8216b9004f77b0bb76..f156fe24db2d3578e2766d96cc147b84a01ef80e 100644 (file)
@@ -4,7 +4,7 @@
   read/write debug packet to communication with HOST based on transfer\r
   protocol.\r
 \r
-  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -19,7 +19,7 @@
 #include "Ia32/DebugException.h"\r
 \r
 GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgVersionAlert[]       = "\rThe SourceLevelDebugPkg you are using requires a newer version of the Intel(R) UDK Debugger Tool.\r\n";\r
-GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgSendInitPacket[]     = "\rSend INIT break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.4) ...\r\n";\r
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgSendInitPacket[]     = "\rSend INIT break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.5) ...\r\n";\r
 GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgConnectOK[]          = "HOST connection is successful!\r\n";\r
 GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgConnectFail[]        = "HOST connection is failed!\r\n";\r
 GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mWarningMsgIngoreBreakpoint[] = "Ignore break point in SMM for SMI issued during DXE debugging!\r\n";\r
@@ -201,55 +201,17 @@ FindAndReportModuleImageInfo (
   )\r
 {\r
   UINTN                                Pe32Data;\r
-  EFI_IMAGE_DOS_HEADER                 *DosHdr;\r
-  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;\r
   PE_COFF_LOADER_IMAGE_CONTEXT         ImageContext;\r
 \r
   //\r
   // Find Image Base\r
   //\r
-  Pe32Data = ((UINTN)mErrorMsgVersionAlert) & ~(AlignSize - 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 < (UINTN)mErrorMsgVersionAlert)) {\r
-        if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {\r
-          //\r
-          // It's PE image.\r
-          //\r
-          break;\r
-        }\r
-      }\r
-    } else {\r
-      //\r
-      // DOS image header is not present, TE header is at the image base.\r
-      //\r
-      Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;\r
-      if ((Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) &&\r
-          ((Hdr.Te->Machine == IMAGE_FILE_MACHINE_I386) || Hdr.Te->Machine == IMAGE_FILE_MACHINE_X64)) {\r
-        //\r
-        // It's TE image, it TE header and Machine type match\r
-        //\r
-        break;\r
-      }\r
-    }\r
-\r
-    //\r
-    // Not found the image base, check the previous aligned address\r
-    //\r
-    Pe32Data -= AlignSize;\r
+  Pe32Data = PeCoffSearchImageBase ((UINTN) mErrorMsgVersionAlert);\r
+  if (Pe32Data != 0) {\r
+    ImageContext.ImageAddress = Pe32Data;\r
+    ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress);\r
+    PeCoffLoaderRelocateImageExtraAction (&ImageContext);\r
   }\r
-\r
-  ImageContext.ImageAddress = Pe32Data;\r
-  ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress);\r
-  PeCoffLoaderRelocateImageExtraAction (&ImageContext);\r
 }\r
 \r
 /**\r
@@ -1859,7 +1821,6 @@ CommandCommunication (
   DEBUG_DATA_SET_VIEWPOINT          *SetViewPoint;\r
   BOOLEAN                           HaltDeferred;\r
   UINT32                            ProcessorIndex;\r
-  DEBUG_PORT_HANDLE                 Handle;\r
   DEBUG_AGENT_EXCEPTION_BUFFER      AgentExceptionBuffer;\r
   UINT32                            IssuedViewPoint;\r
   DEBUG_AGENT_MAILBOX               *Mailbox;\r
@@ -1887,8 +1848,6 @@ CommandCommunication (
     SetDebugFlag (DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS, 1);\r
   }\r
 \r
-  Handle = GetDebugPortHandle();\r
-\r
   while (TRUE) {\r
 \r
     if (MultiProcessorDebugSupport()) {\r
@@ -2535,6 +2494,7 @@ InterruptProcess (
         CurrentDebugTimerInitCount = GetApicTimerInitCount ();\r
         if (mDebugMpContext.DebugTimerInitCount != CurrentDebugTimerInitCount) {\r
           InitializeDebugTimer (NULL, FALSE);\r
+          SaveAndSetDebugTimerInterrupt (TRUE);\r
         }\r
       }\r
 \r