summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Library/EdkPeCoffLoaderLib
diff options
context:
space:
mode:
Diffstat (limited to 'EdkModulePkg/Library/EdkPeCoffLoaderLib')
-rw-r--r--EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c112
-rw-r--r--EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.mbd30
-rw-r--r--EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa45
-rw-r--r--EdkModulePkg/Library/EdkPeCoffLoaderLib/build.xml47
4 files changed, 234 insertions, 0 deletions
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c
new file mode 100644
index 0000000000..86421dbff0
--- /dev/null
+++ b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c
@@ -0,0 +1,112 @@
+/*++
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+ TianoPeCoffLoader.c
+
+Abstract:
+
+ Wrap the Base PE/COFF loader with the PE COFF Protocol
+
+
+--*/
+
+
+
+EFI_STATUS
+EFIAPI
+TianoPeCoffLoaderLibGetImageInfo (
+ IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+{
+ EFI_STATUS Status;
+
+ Status = PeCoffLoaderGetImageInfo (ImageContext);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ switch (ImageContext->ImageType) {
+
+ case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION:
+ ImageContext->ImageCodeMemoryType = EfiLoaderCode;
+ ImageContext->ImageDataMemoryType = EfiLoaderData;
+ break;
+
+ case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:
+ ImageContext->ImageCodeMemoryType = EfiBootServicesCode;
+ ImageContext->ImageDataMemoryType = EfiBootServicesData;
+ break;
+
+ case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
+ case EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER:
+ ImageContext->ImageCodeMemoryType = EfiRuntimeServicesCode;
+ ImageContext->ImageDataMemoryType = EfiRuntimeServicesData;
+ break;
+
+ default:
+ ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;
+ return RETURN_UNSUPPORTED;
+ }
+
+ return Status;
+}
+
+EFI_STATUS
+EFIAPI
+TianoPeCoffLoaderLibLoadImage (
+ IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+{
+ return PeCoffLoaderLoadImage (ImageContext);
+}
+
+EFI_STATUS
+EFIAPI
+TianoPeCoffLoaderLibRelocateImage (
+ IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+{
+ return PeCoffLoaderRelocateImage (ImageContext);
+}
+
+
+EFI_STATUS
+EFIAPI
+TianoPeCoffLoaderLibUnloadimage (
+ IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
+ IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
+ )
+{
+ return EFI_SUCCESS;
+}
+
+
+EFI_PEI_PE_COFF_LOADER_PROTOCOL mPeiEfiPeiPeCoffLoader = {
+ TianoPeCoffLoaderLibGetImageInfo,
+ TianoPeCoffLoaderLibLoadImage,
+ TianoPeCoffLoaderLibRelocateImage,
+ TianoPeCoffLoaderLibUnloadimage
+};
+
+EFI_PEI_PE_COFF_LOADER_PROTOCOL *
+EFIAPI
+GetPeCoffLoaderProtocol (
+ )
+{
+ return &mPeiEfiPeiPeCoffLoader;
+}
+
+
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.mbd b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.mbd
new file mode 100644
index 0000000000..4ffdf99f8f
--- /dev/null
+++ b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.mbd
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<LibraryModuleBuildDescription xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+ <MbdLibHeader>
+ <BaseName>EdkPeCoffLoaderLib</BaseName>
+ <Guid>858bbbc9-474f-4556-a361-0ae52a44ffa5</Guid>
+ <Version>0</Version>
+ <Description>FIX ME!</Description>
+ <Copyright>Copyright (c) 2004 - 2005, Intel Corporation</Copyright>
+ <License>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ </License>
+ <Created>2006-03-12 17:09</Created>
+ <Modified>2006-03-19 15:19</Modified>
+ </MbdLibHeader>
+</LibraryModuleBuildDescription>
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa
new file mode 100644
index 0000000000..0f855307d5
--- /dev/null
+++ b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+-->
+<LibraryModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd">
+ <MsaLibHeader>
+ <BaseName>EdkPeCoffLoaderLib</BaseName>
+ <ModuleType>PEIM</ModuleType>
+ <ComponentType>LIBRARY</ComponentType>
+ <Guid>858bbbc9-474f-4556-a361-0ae52a44ffa5</Guid>
+ <Version>0</Version>
+ <Abstract>Component description file for the PEI library.</Abstract>
+ <Description>FIX ME!</Description>
+ <Copyright>Copyright (c) 2004 - 2005, Intel Corporation</Copyright>
+ <License>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ </License>
+ <Specification>0</Specification>
+ <Created>2006-03-12 17:09</Created>
+ <Updated>2006-03-19 15:19</Updated>
+ </MsaLibHeader>
+ <LibraryClassDefinitions>
+ <LibraryClass Usage="ALWAYS_PRODUCED">EdkPeCoffLoaderLib</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">PeCoffLib</LibraryClass>
+ </LibraryClassDefinitions>
+ <SourceFiles>
+ <Filename>EdkPeCoffLoader.c</Filename>
+ </SourceFiles>
+ <Includes>
+ <PackageName>MdePkg</PackageName>
+ <PackageName>EdkModulePkg</PackageName>
+ </Includes>
+</LibraryModuleSurfaceArea>
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/build.xml b/EdkModulePkg/Library/EdkPeCoffLoaderLib/build.xml
new file mode 100644
index 0000000000..6e7a34f37b
--- /dev/null
+++ b/EdkModulePkg/Library/EdkPeCoffLoaderLib/build.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?><!-- Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
+<project basedir="." default="EdkPeCoffLoaderLib"><!--Apply external ANT tasks-->
+ <taskdef resource="GenBuild.tasks"/>
+ <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+ <property environment="env"/>
+ <property name="WORKSPACE_DIR" value="${env.WORKSPACE}"/>
+ <import file="${WORKSPACE_DIR}\Tools\Conf\BuildMacro.xml"/><!--MODULE_RELATIVE PATH is relative to PACKAGE_DIR-->
+ <property name="MODULE_RELATIVE_PATH" value="Library\EdkPeCoffLoaderLib"/>
+ <property name="MODULE_DIR" value="${PACKAGE_DIR}\${MODULE_RELATIVE_PATH}"/>
+ <property name="COMMON_FILE" value="${WORKSPACE_DIR}\Tools\Conf\Common.xml"/>
+ <target name="EdkPeCoffLoaderLib">
+ <GenBuild baseName="EdkPeCoffLoaderLib" mbdFilename="${MODULE_DIR}\EdkPeCoffLoaderLib.mbd" msaFilename="${MODULE_DIR}\EdkPeCoffLoaderLib.msa"/>
+ </target>
+ <target depends="EdkPeCoffLoaderLib_clean" name="clean"/>
+ <target depends="EdkPeCoffLoaderLib_cleanall" name="cleanall"/>
+ <target name="EdkPeCoffLoaderLib_clean">
+ <OutputDirSetup baseName="EdkPeCoffLoaderLib" mbdFilename="${MODULE_DIR}\EdkPeCoffLoaderLib.mbd" msaFilename="${MODULE_DIR}\EdkPeCoffLoaderLib.msa"/>
+ <if>
+ <available file="${DEST_DIR_OUTPUT}\EdkPeCoffLoaderLib_build.xml"/>
+ <then>
+ <ant antfile="${DEST_DIR_OUTPUT}\EdkPeCoffLoaderLib_build.xml" target="clean"/>
+ </then>
+ </if>
+ <delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>
+ </target>
+ <target name="EdkPeCoffLoaderLib_cleanall">
+ <OutputDirSetup baseName="EdkPeCoffLoaderLib" mbdFilename="${MODULE_DIR}\EdkPeCoffLoaderLib.mbd" msaFilename="${MODULE_DIR}\EdkPeCoffLoaderLib.msa"/>
+ <if>
+ <available file="${DEST_DIR_OUTPUT}\EdkPeCoffLoaderLib_build.xml"/>
+ <then>
+ <ant antfile="${DEST_DIR_OUTPUT}\EdkPeCoffLoaderLib_build.xml" target="cleanall"/>
+ </then>
+ </if>
+ <delete dir="${DEST_DIR_OUTPUT}"/>
+ <delete dir="${DEST_DIR_DEBUG}"/>
+ <delete>
+ <fileset dir="${BIN_DIR}" includes="**EdkPeCoffLoaderLib*"/>
+ </delete>
+ </target>
+</project> \ No newline at end of file