]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Remove the EDK prefix from library instance folder's name
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 9 Jul 2007 01:34:14 +0000 (01:34 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 9 Jul 2007 01:34:14 +0000 (01:34 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3137 6f19259b-4bc3-4df7-8a09-765794883524

Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/CommonHeader.h [deleted file]
Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf [deleted file]
Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa [deleted file]
Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c [deleted file]
Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/CommonHeader.h [new file with mode: 0644]
Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf [new file with mode: 0644]
Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa [new file with mode: 0644]
Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c [new file with mode: 0644]
Nt32Pkg/Nt32Pkg.dsc

diff --git a/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/CommonHeader.h b/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/CommonHeader.h
deleted file mode 100644 (file)
index 16f6375..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**@file\r
-  Common header file shared by all source files.\r
-\r
-  This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
-\r
-  Copyright (c) 2006 - 2007, Intel Corporation\r
-  All rights reserved. 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
-   http://opensource.org/licenses/bsd-license.php\r
-   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-**/\r
-\r
-#ifndef __COMMON_HEADER_H_\r
-#define __COMMON_HEADER_H_\r
-\r
-\r
-//\r
-// The package level header files this module uses\r
-//\r
-#include <PiPei.h>\r
-#include <IndustryStandard/PeImage.h>\r
-#include <WinNtPeim.h>\r
-//\r
-// The protocols, PPI and GUID defintions for this module\r
-//\r
-#include <Ppi/NtPeiLoadFile.h>\r
-//\r
-// The Library classes this module consumes\r
-//\r
-#include <Library/PeCoffGetEntryPointLib.h>\r
-#include <Library/PeiServicesLib.h>\r
-\r
-#endif\r
diff --git a/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf b/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf
deleted file mode 100644 (file)
index d7fd32c..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#/** @file\r
-# Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.\r
-#\r
-# PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.\r
-# Copyright (c) 2006 - 2007, Intel Corporation\r
-#\r
-#  All rights reserved. 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
-#  http://opensource.org/licenses/bsd-license.php\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#\r
-#**/\r
-\r
-################################################################################\r
-#\r
-# Defines Section - statements that will be processed to create a Makefile.\r
-#\r
-################################################################################\r
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = EdkNt32PeiPeCoffGetEntryPointLib\r
-  FILE_GUID                      = 434b164e-5fa6-4a3d-bc04-02da2a4eeb26\r
-  MODULE_TYPE                    = PEIM\r
-  VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = PeCoffGetEntryPointLib|PEI_CORE PEIM \r
-  EDK_RELEASE_VERSION            = 0x00020000\r
-  EFI_SPECIFICATION_VERSION      = 0x00020000\r
-\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-#  VALID_ARCHITECTURES           = IA32\r
-#\r
-\r
-################################################################################\r
-#\r
-# Sources Section - list of files that are required for the build to succeed.\r
-#\r
-################################################################################\r
-\r
-[Sources.common]\r
-  PeCoffGetEntryPoint.c\r
-  CommonHeader.h\r
-\r
-\r
-################################################################################\r
-#\r
-# Package Dependency Section - list of Package files that are required for\r
-#                              this module.\r
-#\r
-################################################################################\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  Nt32Pkg/Nt32Pkg.dec\r
-\r
-\r
-################################################################################\r
-#\r
-# Library Class Section - list of Library Classes that are required for\r
-#                         this module.\r
-#\r
-################################################################################\r
-\r
-[LibraryClasses]\r
-  PeiServicesLib\r
-\r
-\r
-################################################################################\r
-#\r
-# PPI C Name Section - list of PPI and PPI Notify C Names that this module\r
-#                      uses or produces.\r
-#\r
-################################################################################\r
-\r
-[Ppis]\r
-  gNtPeiLoadFilePpiGuid                         # PPI ALWAYS_CONSUMED\r
-\r
diff --git a/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa b/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa
deleted file mode 100644 (file)
index 79fc9ec..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
-  <MsaHeader>\r
-    <ModuleName>EdkNt32PeiPeCoffGetEntryPointLib</ModuleName>\r
-    <ModuleType>PEIM</ModuleType>\r
-    <GuidValue>434b164e-5fa6-4a3d-bc04-02da2a4eeb26</GuidValue>\r
-    <Version>1.0</Version>\r
-    <Abstract>Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.</Abstract>\r
-    <Description>PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.</Description>\r
-    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>\r
-    <License>All rights reserved. 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
-      http://opensource.org/licenses/bsd-license.php\r
-      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
-    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
-  </MsaHeader>\r
-  <ModuleDefinitions>\r
-    <SupportedArchitectures>IA32</SupportedArchitectures>\r
-    <BinaryModule>false</BinaryModule>\r
-    <OutputFileBasename>EdkNt32PeiPeCoffGetEntryPointLib</OutputFileBasename>\r
-  </ModuleDefinitions>\r
-  <LibraryClassDefinitions>\r
-    <LibraryClass Usage="ALWAYS_PRODUCED"  SupModuleList="PEI_CORE PEIM">\r
-      <Keyword>PeCoffGetEntryPointLib</Keyword>\r
-    </LibraryClass>\r
-    <LibraryClass Usage="ALWAYS_CONSUMED">\r
-      <Keyword>PeiServicesLib</Keyword>\r
-    </LibraryClass>\r
-  </LibraryClassDefinitions>\r
-  <SourceFiles>\r
-    <Filename>PeCoffGetEntryPoint.c</Filename>\r
-  </SourceFiles>\r
-  <PackageDependencies>\r
-    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
-  </PackageDependencies>\r
-  <PPIs>\r
-    <Ppi Usage="ALWAYS_CONSUMED">\r
-      <PpiCName>gNtPeiLoadFilePpiGuid</PpiCName>\r
-    </Ppi>\r
-  </PPIs>\r
-  <Externs>\r
-    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
-    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
-  </Externs>\r
-</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
deleted file mode 100644 (file)
index fd8f739..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-Module Name:\r
-\r
-  PeCoffGetEntryPoint.c\r
-\r
-Abstract:\r
-\r
-  Tiano PE/COFF loader\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-\r
-//\r
-// Include common header file for this module.\r
-//\r
-#include "CommonHeader.h"\r
-\r
-RETURN_STATUS\r
-EFIAPI\r
-PeCoffLoaderGetEntryPoint (\r
-  IN     VOID  *Pe32Data,\r
-  IN OUT VOID  **EntryPoint\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Loads a PE/COFF image into memory, this is not follow the original purpose of \r
-  PeCoffGetEntryPoint library class.  But it's ok that Unix package not run on a real \r
-  platform and this is for source level debug.\r
-\r
-Arguments:\r
-\r
-  Pe32Data   - Pointer to a PE/COFF Image\r
-\r
-  EntryPoint - Pointer to the entry point of the PE/COFF image\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS            if the EntryPoint was returned\r
-  EFI_INVALID_PARAMETER  if the EntryPoint could not be found from Pe32Data\r
-\r
---*/\r
-{\r
-  EFI_STATUS              Status;\r
-  EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;\r
-  NT_PEI_LOAD_FILE_PPI    *PeiNtService;\r
-  EFI_PHYSICAL_ADDRESS    ImageAddress;\r
-  UINT64                  ImageSize;\r
-  EFI_PHYSICAL_ADDRESS    ImageEntryPoint;\r
-\r
-  Status = PeiServicesLocatePpi (\r
-             &gNtPeiLoadFilePpiGuid,\r
-             0,\r
-             &PpiDescriptor,\r
-             &PeiNtService\r
-             );\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  Status = PeiNtService->PeiLoadFileService (\r
-                           Pe32Data,\r
-                           &ImageAddress,\r
-                           &ImageSize,\r
-                           &ImageEntryPoint\r
-                           );\r
-  *EntryPoint = (VOID*)(UINTN)ImageEntryPoint;\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Returns the machine type of PE/COFF image. \r
-  This is copied from MDE BasePeCoffGetEntryPointLib, the code should be sync with it.\r
-  The reason is NT32 package needs to load the image to memory to support source\r
-  level debug.\r
-   \r
-\r
-  @param  Image   Pointer to a PE/COFF header\r
-\r
-  @return         Machine type or zero if not a valid iamge\r
-\r
-**/\r
-UINT16\r
-EFIAPI\r
-PeCoffLoaderGetMachineType (\r
-  IN  VOID  *Pe32Data\r
-  )\r
-{  \r
-  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;\r
-  EFI_IMAGE_DOS_HEADER                 *DosHdr;\r
-\r
-  DosHdr = (EFI_IMAGE_DOS_HEADER  *)Pe32Data;\r
-  if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
-    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + DosHdr->e_lfanew);\r
-  } else {\r
-    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data);\r
-  }\r
-\r
-  if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)  {\r
-    return Hdr.Pe32->FileHeader.Machine;\r
-  }\r
-\r
-  return 0x0000;\r
-}\r
-\r
diff --git a/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/CommonHeader.h b/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/CommonHeader.h
new file mode 100644 (file)
index 0000000..16f6375
--- /dev/null
@@ -0,0 +1,35 @@
+/**@file\r
+  Common header file shared by all source files.\r
+\r
+  This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
+\r
+  Copyright (c) 2006 - 2007, Intel Corporation\r
+  All rights reserved. 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
+   http://opensource.org/licenses/bsd-license.php\r
+   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiPei.h>\r
+#include <IndustryStandard/PeImage.h>\r
+#include <WinNtPeim.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Ppi/NtPeiLoadFile.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+\r
+#endif\r
diff --git a/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf b/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf
new file mode 100644 (file)
index 0000000..d7fd32c
--- /dev/null
@@ -0,0 +1,82 @@
+#/** @file\r
+# Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.\r
+#\r
+# PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.\r
+# Copyright (c) 2006 - 2007, Intel Corporation\r
+#\r
+#  All rights reserved. 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
+#  http://opensource.org/licenses/bsd-license.php\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = EdkNt32PeiPeCoffGetEntryPointLib\r
+  FILE_GUID                      = 434b164e-5fa6-4a3d-bc04-02da2a4eeb26\r
+  MODULE_TYPE                    = PEIM\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = PeCoffGetEntryPointLib|PEI_CORE PEIM \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+  PeCoffGetEntryPoint.c\r
+  CommonHeader.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+#                              this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  Nt32Pkg/Nt32Pkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+#                         this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+  PeiServicesLib\r
+\r
+\r
+################################################################################\r
+#\r
+# PPI C Name Section - list of PPI and PPI Notify C Names that this module\r
+#                      uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Ppis]\r
+  gNtPeiLoadFilePpiGuid                         # PPI ALWAYS_CONSUMED\r
+\r
diff --git a/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa b/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa
new file mode 100644 (file)
index 0000000..79fc9ec
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+  <MsaHeader>\r
+    <ModuleName>EdkNt32PeiPeCoffGetEntryPointLib</ModuleName>\r
+    <ModuleType>PEIM</ModuleType>\r
+    <GuidValue>434b164e-5fa6-4a3d-bc04-02da2a4eeb26</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.</Abstract>\r
+    <Description>PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.</Description>\r
+    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>\r
+    <License>All rights reserved. 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
+      http://opensource.org/licenses/bsd-license.php\r
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>EdkNt32PeiPeCoffGetEntryPointLib</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED"  SupModuleList="PEI_CORE PEIM">\r
+      <Keyword>PeCoffGetEntryPointLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeiServicesLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>PeCoffGetEntryPoint.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
+  </PackageDependencies>\r
+  <PPIs>\r
+    <Ppi Usage="ALWAYS_CONSUMED">\r
+      <PpiCName>gNtPeiLoadFilePpiGuid</PpiCName>\r
+    </Ppi>\r
+  </PPIs>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
new file mode 100644 (file)
index 0000000..fd8f739
--- /dev/null
@@ -0,0 +1,118 @@
+/*++\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. 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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+Module Name:\r
+\r
+  PeCoffGetEntryPoint.c\r
+\r
+Abstract:\r
+\r
+  Tiano PE/COFF loader\r
+\r
+Revision History\r
+\r
+--*/\r
+\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+PeCoffLoaderGetEntryPoint (\r
+  IN     VOID  *Pe32Data,\r
+  IN OUT VOID  **EntryPoint\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Loads a PE/COFF image into memory, this is not follow the original purpose of \r
+  PeCoffGetEntryPoint library class.  But it's ok that Unix package not run on a real \r
+  platform and this is for source level debug.\r
+\r
+Arguments:\r
+\r
+  Pe32Data   - Pointer to a PE/COFF Image\r
+\r
+  EntryPoint - Pointer to the entry point of the PE/COFF image\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS            if the EntryPoint was returned\r
+  EFI_INVALID_PARAMETER  if the EntryPoint could not be found from Pe32Data\r
+\r
+--*/\r
+{\r
+  EFI_STATUS              Status;\r
+  EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;\r
+  NT_PEI_LOAD_FILE_PPI    *PeiNtService;\r
+  EFI_PHYSICAL_ADDRESS    ImageAddress;\r
+  UINT64                  ImageSize;\r
+  EFI_PHYSICAL_ADDRESS    ImageEntryPoint;\r
+\r
+  Status = PeiServicesLocatePpi (\r
+             &gNtPeiLoadFilePpiGuid,\r
+             0,\r
+             &PpiDescriptor,\r
+             &PeiNtService\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  Status = PeiNtService->PeiLoadFileService (\r
+                           Pe32Data,\r
+                           &ImageAddress,\r
+                           &ImageSize,\r
+                           &ImageEntryPoint\r
+                           );\r
+  *EntryPoint = (VOID*)(UINTN)ImageEntryPoint;\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Returns the machine type of PE/COFF image. \r
+  This is copied from MDE BasePeCoffGetEntryPointLib, the code should be sync with it.\r
+  The reason is NT32 package needs to load the image to memory to support source\r
+  level debug.\r
+   \r
+\r
+  @param  Image   Pointer to a PE/COFF header\r
+\r
+  @return         Machine type or zero if not a valid iamge\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+PeCoffLoaderGetMachineType (\r
+  IN  VOID  *Pe32Data\r
+  )\r
+{  \r
+  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;\r
+  EFI_IMAGE_DOS_HEADER                 *DosHdr;\r
+\r
+  DosHdr = (EFI_IMAGE_DOS_HEADER  *)Pe32Data;\r
+  if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
+    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + DosHdr->e_lfanew);\r
+  } else {\r
+    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data);\r
+  }\r
+\r
+  if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)  {\r
+    return Hdr.Pe32->FileHeader.Machine;\r
+  }\r
+\r
+  return 0x0000;\r
+}\r
+\r
index e753b79bc2de5c84af40b8634c86b8b39f8cfe24..703e3612d9f7010db45d7de772f3309fa7c51e61 100644 (file)
   PeCoffLoaderLib|$(WORKSPACE)/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf\r
   PeiServicesTablePointerLib|$(WORKSPACE)/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf\r
   PeCoffLoaderLib|$(WORKSPACE)/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf\r
   PeiServicesTablePointerLib|$(WORKSPACE)/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf\r
-  PeCoffGetEntryPointLib|$(WORKSPACE)/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf\r
+  PeCoffGetEntryPointLib|$(WORKSPACE)/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf\r
   DebugLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
 \r
 [LibraryClasses.common.PEI_CORE]\r
   DebugLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
 \r
 [LibraryClasses.common.PEI_CORE]\r
   PeiCoreEntryPoint|$(WORKSPACE)/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf\r
   OldPeiCoreEntryPoint|$(WORKSPACE)/MdePkg/Library/OldPeiCoreEntryPoint/OldPeiCoreEntryPoint.inf\r
   ReportStatusCodeLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf\r
   PeiCoreEntryPoint|$(WORKSPACE)/MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf\r
   OldPeiCoreEntryPoint|$(WORKSPACE)/MdePkg/Library/OldPeiCoreEntryPoint/OldPeiCoreEntryPoint.inf\r
   ReportStatusCodeLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf\r
-  PeCoffGetEntryPointLib|$(WORKSPACE)/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf\r
+  PeCoffGetEntryPointLib|$(WORKSPACE)/Nt32Pkg/Library/Nt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf\r
   # After tools enable the dynamic PCD, please uncomment follows library instances mapping.\r
   #PcdLib|$(WORKSPACE)/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf\r
   DebugLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   # After tools enable the dynamic PCD, please uncomment follows library instances mapping.\r
   #PcdLib|$(WORKSPACE)/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf\r
   DebugLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r