]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Remove PeRemove PeiPeCoffLoader.h and gPeiPeCoffLoaderGuid, and Add PeCoffExtraAction...
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Mar 2009 09:18:28 +0000 (09:18 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Mar 2009 09:18:28 +0000 (09:18 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7811 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/PeCoffExtraActionLib.h [new file with mode: 0644]
MdePkg/Library/BasePeCoffLib/BasePeCoff.c
MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
MdePkg/Library/BasePeCoffLib/BasePeCoffLibInternals.h
MdePkg/Library/PeCoffExtraActionLibNull/PeCoffExtraActionLib.c [new file with mode: 0644]
MdePkg/Library/PeCoffExtraActionLibNull/PeCoffExtraActionLibNull.inf [new file with mode: 0644]
MdePkg/MdePkg.dec
MdePkg/MdePkg.dsc

diff --git a/MdePkg/Include/Library/PeCoffExtraActionLib.h b/MdePkg/Include/Library/PeCoffExtraActionLib.h
new file mode 100644 (file)
index 0000000..b1396de
--- /dev/null
@@ -0,0 +1,56 @@
+/** @file\r
+  Provides services to perform additional actions to relocate and unload\r
+  PE/Coff image for some environment specific purpose say for souce level debug.\r
+\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\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
+**/\r
+\r
+#ifndef __PE_COFF_EXTRA_ACTION_LIB_H__\r
+#define __PE_COFF_EXTRA_ACTION_LIB_H__\r
+#include <Library/PeCoffLib.h>\r
+/**\r
+  Applies additional actions to relocate fixups to a PE/COFF image.\r
+\r
+  Generally this function is called after sucessfully Applying relocation fixups \r
+  to a PE/COFF image for some specicial purpose. \r
+  As a example, For NT32 emulator, the function should be implemented and called\r
+  to support source level debug.  \r
+  \r
+  @param  ImageContext        Pointer to the image context structure that describes the PE/COFF\r
+                              image that is being relocated.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeCoffLoaderRelocateImageExtraAction (\r
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
+  );\r
+\r
+/**\r
+  Unloads a loaded PE/COFF image from memory and releases its taken resource.\r
+  \r
+  Releases any environment specific resources that were allocated when the image \r
+  specified by ImageContext was loaded using PeCoffLoaderLoadImage(). \r
+  For NT32 emulator, the PE/COFF image loaded by system needs to release.\r
+  For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded, \r
+  \r
+  If ImageContext is NULL, then ASSERT().\r
+  \r
+  @param  ImageContext              Pointer to the image context structure that describes the PE/COFF\r
+                                    image to be unloaded.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeCoffLoaderUnloadImageExtraAction (\r
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
+  );\r
+#endif\r
index 91df24e09c540d2d999b892aab0dc6e2719b7d29..9274f31aa22d15b0b1351bc9356be0e8c940b830 100644 (file)
@@ -540,6 +540,9 @@ PeCoffLoaderRelocateImage (
   // If there are no relocation entries, then we are done\r
   //\r
   if (ImageContext->RelocationsStripped) {\r
+       // Applies additional environment specific actions to relocate fixups \r
+       // to a PE/COFF image if needed\r
+       PeCoffLoaderRelocateImageExtraAction (ImageContext);    \r
     return RETURN_SUCCESS;\r
   }\r
 \r
@@ -736,6 +739,11 @@ PeCoffLoaderRelocateImage (
      ImageContext->EntryPoint -= (UINT64) ImageContext->ImageAddress;\r
      ImageContext->EntryPoint += (UINT64) ImageContext->DestinationAddress;\r
   }\r
+  \r
+  // Applies additional environment specific actions to relocate fixups \r
+  // to a PE/COFF image if needed\r
+  PeCoffLoaderRelocateImageExtraAction (ImageContext);\r
+  \r
   return RETURN_SUCCESS;\r
 }\r
 \r
@@ -1411,5 +1419,8 @@ PeCoffLoaderUnloadImage (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
   )\r
 {\r
+  // Applies additional environment specific actions to unload a \r
+  // PE/COFF image if needed\r
+  PeCoffLoaderUnloadImageExtraAction (ImageContext);\r
   return RETURN_SUCCESS;\r
 }\r
index 28e942cb7fc9da114ef500e3b6a43c6002e0bae9..534b78ec2520e073103ba8456c16f86dfb1168f3 100644 (file)
@@ -41,5 +41,6 @@
 \r
 [LibraryClasses]\r
   DebugLib\r
+  PeCoffExtraActionLib\r
   BaseMemoryLib\r
 \r
index c8f95a11fff4667eb4719b7395fd34caea3b3945..864337b0c8b8feb392b65b43fffdbba6c8aa2ff5 100644 (file)
@@ -19,6 +19,7 @@
 #include <Library/PeCoffLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/DebugLib.h>\r
+#include <Library/PeCoffExtraActionLib.h>\r
 #include <IndustryStandard/PeImage.h>\r
 \r
 \r
diff --git a/MdePkg/Library/PeCoffExtraActionLibNull/PeCoffExtraActionLib.c b/MdePkg/Library/PeCoffExtraActionLibNull/PeCoffExtraActionLib.c
new file mode 100644 (file)
index 0000000..00ec9d2
--- /dev/null
@@ -0,0 +1,57 @@
+/** @file\r
+  Null PE/Coff Extra Action library instances with empty functions.\r
+\r
+  Copyright (c) 2006 - 2008, Intel Corporation<BR>\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
+**/\r
+\r
+#include <Base.h>\r
+#include <Library/PeCoffExtraActionLib.h>\r
+/**\r
+  Applies additional actions to relocate fixups to a PE/COFF image.\r
+\r
+  Generally this function is called after sucessfully Applying relocation fixups \r
+  to a PE/COFF image for some specicial purpose. \r
+  As a example, For NT32 emulator, the function should be implemented and called\r
+  to support source level debug.  \r
+  \r
+  @param  ImageContext        Pointer to the image context structure that describes the PE/COFF\r
+                              image that is being relocated.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeCoffLoaderRelocateImageExtraAction (\r
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
+  )\r
+{\r
+}  \r
+\r
+/**\r
+  Unloads a loaded PE/COFF image from memory and releases its taken resource.\r
+  \r
+  Releases any environment specific resources that were allocated when the image \r
+  specified by ImageContext was loaded using PeCoffLoaderLoadImage(). \r
+  For NT32 emulator, the PE/COFF image loaded by system needs to release.\r
+  For real platform, the PE/COFF image loaded by Core doesn't needs to be unloaded, \r
+  \r
+  If ImageContext is NULL, then ASSERT().\r
+  \r
+  @param  ImageContext              Pointer to the image context structure that describes the PE/COFF\r
+                                    image to be unloaded.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeCoffLoaderUnloadImageExtraAction (\r
+  IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
+  )\r
+{\r
+}
\ No newline at end of file
diff --git a/MdePkg/Library/PeCoffExtraActionLibNull/PeCoffExtraActionLibNull.inf b/MdePkg/Library/PeCoffExtraActionLibNull/PeCoffExtraActionLibNull.inf
new file mode 100644 (file)
index 0000000..995a92f
--- /dev/null
@@ -0,0 +1,35 @@
+#/** @file\r
+#  Debug Library with empty functions.\r
+#\r
+#  Copyright (c) 2007 - 2008, 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
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = PeCoffExtraActionLibNull\r
+  FILE_GUID                      = 0EB84DA1-267A-40b4-8347-1F48694C8B47\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = PeCoffExtraActionLib \r
+\r
+\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+  PeCoffExtraActionLib.c\r
+\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
index 569ad2bf2a43971db884f06e7a5efbf557f6162f..56ff115ec589e3f8c155ce422f9d2a4519c230d3 100644 (file)
 \r
   ##  @libraryclass  Provides services to load and relocate a PE/COFF image.\r
   PeCoffLib|Include/Library/PeCoffLib.h\r
+  ##  @libraryclass  Provides extra action services for unloading and relocating a PE/COFF image on some specific platform such\r
+  ## as NT32 emulator.\r
+  PeCoffExtraActionLib|Include/Library/PeCoffExtraActionLib.h\r
 \r
   ##  @libraryclass  Provides a service to retrieve the PE/COFF entry point from a PE/COFF image.\r
   PeCoffGetEntryPointLib|Include/Library/PeCoffGetEntryPointLib.h\r
index 92cd4d353874bece775a8d0eeaf9cac782fad10f..24786b52e166d9c96d801bbc72110d0ac94a835e 100644 (file)
@@ -83,6 +83,7 @@
   MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf\r
   MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf\r
   MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf\r
+  MdePkg/Library/PeCoffExtraActionLibNull/PeCoffExtraActionLibNull.inf\r
   MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf\r
   MdePkg/Library/BasePostCodeLibDebug/BasePostCodeLibDebug.inf\r
   MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf\r