3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Wrap the Base PE/COFF loader with the PE COFF Protocol
27 TianoPeCoffLoaderLibGetImageInfo (
28 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL
*This
,
29 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
34 Status
= PeCoffLoaderGetImageInfo (ImageContext
);
35 if (EFI_ERROR (Status
)) {
39 switch (ImageContext
->ImageType
) {
41 case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION
:
42 ImageContext
->ImageCodeMemoryType
= EfiLoaderCode
;
43 ImageContext
->ImageDataMemoryType
= EfiLoaderData
;
46 case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
:
47 ImageContext
->ImageCodeMemoryType
= EfiBootServicesCode
;
48 ImageContext
->ImageDataMemoryType
= EfiBootServicesData
;
51 case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
:
52 case EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER
:
53 ImageContext
->ImageCodeMemoryType
= EfiRuntimeServicesCode
;
54 ImageContext
->ImageDataMemoryType
= EfiRuntimeServicesData
;
58 ImageContext
->ImageError
= IMAGE_ERROR_INVALID_SUBSYSTEM
;
59 return RETURN_UNSUPPORTED
;
67 TianoPeCoffLoaderLibLoadImage (
68 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL
*This
,
69 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
72 return PeCoffLoaderLoadImage (ImageContext
);
77 TianoPeCoffLoaderLibRelocateImage (
78 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL
*This
,
79 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
82 return PeCoffLoaderRelocateImage (ImageContext
);
88 TianoPeCoffLoaderLibUnloadimage (
89 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL
*This
,
90 IN PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
97 EFI_PEI_PE_COFF_LOADER_PROTOCOL mPeiEfiPeiPeCoffLoader
= {
98 TianoPeCoffLoaderLibGetImageInfo
,
99 TianoPeCoffLoaderLibLoadImage
,
100 TianoPeCoffLoaderLibRelocateImage
,
101 TianoPeCoffLoaderLibUnloadimage
104 EFI_PEI_PE_COFF_LOADER_PROTOCOL
*
106 GetPeCoffLoaderProtocol (
109 return &mPeiEfiPeiPeCoffLoader
;