mirror of https://github.com/acidanthera/audk.git
Add PeiDxePeCoffLoaderLib instance in MdeModulePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3043 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
96219b7d4b
commit
62aec47dce
|
@ -0,0 +1,129 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2007, 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:
|
||||
|
||||
EdkPeCoffLoader.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Wrap the Base PE/COFF loader with the PE COFF Protocol
|
||||
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <PiPei.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Guid/PeiPeCoffLoader.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/PeCoffLib.h>
|
||||
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderLibGetImageInfo (
|
||||
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;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderLibLoadImage (
|
||||
IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
return PeCoffLoaderLoadImage (ImageContext);
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderLibRelocateImage (
|
||||
IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
return PeCoffLoaderRelocateImage (ImageContext);
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeCoffLoaderLibUnloadimage (
|
||||
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 = {
|
||||
PeCoffLoaderLibGetImageInfo,
|
||||
PeCoffLoaderLibLoadImage,
|
||||
PeCoffLoaderLibRelocateImage,
|
||||
PeCoffLoaderLibUnloadimage
|
||||
};
|
||||
|
||||
EFI_PEI_PE_COFF_LOADER_PROTOCOL *
|
||||
EFIAPI
|
||||
GetPeCoffLoaderProtocol (
|
||||
)
|
||||
{
|
||||
return &mPeiEfiPeiPeCoffLoader;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
#/** @file
|
||||
# DxePeCoffLoaderLib library instance
|
||||
#
|
||||
# This library provides PeCoffLoader protocol based on PeCoffLib functions.
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PeiDxePeCoffLoaderLib
|
||||
FILE_GUID = 858bbbc9-474f-4556-a361-0ae52a44ffa5
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PeiDxeCorePeCoffLoaderLib|DXE_CORE PEIM
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
PeCoffLoader.c
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
PeCoffLib
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>PeiDxePeCoffLoaderLib</ModuleName>
|
||||
<ModuleType>PEIM</ModuleType>
|
||||
<GuidValue>858bbbc9-474f-4556-a361-0ae52a44ffa5</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>DxePeCoffLoaderLib library instance</Abstract>
|
||||
<Description>This library provides PeCoffLoader protocol based on PeCoffLib functions.</Description>
|
||||
<Copyright>Copyright (c) 2006, 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>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>PeiDxePeCoffLoaderLib</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE PEIM">
|
||||
<Keyword>PeiDxeCorePeCoffLoaderLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>PeCoffLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>PeCoffLoader.c</Filename>
|
||||
<Filename>PeCoffLoaderLibInternals.h</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||
</PackageDependencies>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
Loading…
Reference in New Issue