|
TianoCore EDK2 master
|
#include "PeiMain.h"Go to the source code of this file.
Variables | |
| EFI_PEI_LOAD_FILE_PPI | mPeiLoadImagePpi |
| EFI_PEI_PPI_DESCRIPTOR | gPpiLoadFilePpiList |
Pei Core Load Image Support
Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Image.c.
| EFI_STATUS CheckAndMarkFixLoadingMemoryUsageBitMap | ( | IN PEI_CORE_INSTANCE * | Private, |
| IN EFI_PHYSICAL_ADDRESS | ImageBase, | ||
| IN UINT32 | ImageSize | ||
| ) |
To check memory usage bit map array to figure out if the memory range the image will be loaded in is available or not. If memory range is available, the function will mark the corresponding bits to 1 which indicates the memory range is used. The function is only invoked when load modules at fixed address feature is enabled.
| Private | Pointer to the private data passed in from caller |
| ImageBase | The base address the image will be loaded at. |
| ImageSize | The size of the image |
| EFI_SUCCESS | The memory range the image will be loaded in is available |
| EFI_NOT_FOUND | The memory range the image will be loaded in is not available |
| EFI_STATUS GetPeCoffImageFixLoadingAssignedAddress | ( | IN OUT PE_COFF_LOADER_IMAGE_CONTEXT * | ImageContext, |
| IN PEI_CORE_INSTANCE * | Private | ||
| ) |
Get the fixed loading address from image header assigned by build tool. This function only be called when Loading module at Fixed address feature enabled.
| ImageContext | Pointer to the image context structure that describes the PE/COFF image that needs to be examined by this function. |
| Private | Pointer to the private data passed in from caller |
| EFI_SUCCESS | An fixed loading address is assigned to this image by build tools . |
| EFI_NOT_FOUND | The image has no assigned fixed loading address. |
| VOID InitializeImageServices | ( | IN PEI_CORE_INSTANCE * | PrivateData, |
| IN PEI_CORE_INSTANCE * | OldCoreData | ||
| ) |
| EFI_STATUS LoadAndRelocatePeCoffImage | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, |
| IN VOID * | Pe32Data, | ||
| OUT EFI_PHYSICAL_ADDRESS * | ImageAddress, | ||
| OUT UINT64 * | ImageSize, | ||
| OUT EFI_PHYSICAL_ADDRESS * | EntryPoint | ||
| ) |
Loads and relocates a PE/COFF image into memory. If the image is not relocatable, it will not be loaded into memory and be loaded as XIP image.
| FileHandle | - Pointer to the FFS file header of the image. |
| Pe32Data | - The base address of the PE/COFF file that is to be loaded and relocated |
| ImageAddress | - The base address of the relocated PE/COFF image |
| ImageSize | - The size of the relocated PE/COFF image |
| EntryPoint | - The entry point of the relocated PE/COFF image |
| EFI_SUCCESS | The file was loaded and relocated |
| EFI_OUT_OF_RESOURCES | There was not enough memory to load and relocate the PE/COFF file |
| EFI_WARN_BUFFER_TOO_SMALL | There is not enough heap to allocate the requested size. This will not prevent the XIP image from being invoked. |
| EFI_STATUS LoadAndRelocatePeCoffImageInPlace | ( | IN VOID * | Pe32Data, |
| IN VOID * | ImageAddress | ||
| ) |
Loads and relocates a PE/COFF image in place.
| Pe32Data | The base address of the PE/COFF file that is to be loaded and relocated |
| ImageAddress | The base address of the relocated PE/COFF image |
| EFI_SUCCESS | The file was loaded and relocated. |
| Others | The file not be loaded and error occurred. |
| EFI_STATUS PeiGetPe32Data | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, |
| OUT VOID ** | Pe32Data | ||
| ) |
| EFI_STATUS EFIAPI PeiImageRead | ( | IN VOID * | FileHandle, |
| IN UINTN | FileOffset, | ||
| IN UINTN * | ReadSize, | ||
| OUT VOID * | Buffer | ||
| ) |
Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file. The function is used for XIP code to have optimized memory copy.
| FileHandle | - The handle to the PE/COFF file |
| FileOffset | - The offset, in bytes, into the file to read |
| ReadSize | - The number of bytes to read from the file starting at FileOffset |
| Buffer | - A pointer to the buffer to read the data into. |
| EFI_STATUS PeiLoadImage | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
| IN EFI_PEI_FILE_HANDLE | FileHandle, | ||
| IN UINT8 | PeimState, | ||
| OUT EFI_PHYSICAL_ADDRESS * | EntryPoint, | ||
| OUT UINT32 * | AuthenticationState | ||
| ) |
Routine to load image file for subsequent execution by LoadFile Ppi. If any LoadFile Ppi is not found, the build-in support function for the PE32+/TE XIP image format is used.
| PeiServices | - An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation |
| FileHandle | - Pointer to the FFS file header of the image. |
| PeimState | - The dispatch state of the input PEIM handle. |
| EntryPoint | - Pointer to entry point of specified image file for output. |
| AuthenticationState | - Pointer to attestation authentication state of image. |
| EFI_SUCCESS | - Image is successfully loaded. |
| EFI_NOT_FOUND | - Fail to locate necessary PPI |
| Others | - Fail to load file. |
| EFI_STATUS PeiLoadImageLoadImage | ( | IN CONST EFI_PEI_SERVICES ** | PeiServices, |
| IN EFI_PEI_FILE_HANDLE | FileHandle, | ||
| OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg | OPTIONAL, | ||
| OUT UINT64 *ImageSizeArg | OPTIONAL, | ||
| OUT EFI_PHYSICAL_ADDRESS * | EntryPoint, | ||
| OUT UINT32 * | AuthenticationState | ||
| ) |
Loads a PEIM into memory for subsequent execution. If there are compressed images or images that need to be relocated into memory for performance reasons, this service performs that transformation.
| PeiServices | An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation |
| FileHandle | Pointer to the FFS file header of the image. |
| ImageAddressArg | Pointer to PE/TE image. |
| ImageSizeArg | Size of PE/TE image. |
| EntryPoint | Pointer to entry point of specified image file for output. |
| AuthenticationState | - Pointer to attestation authentication state of image. |
| EFI_SUCCESS | Image is successfully loaded. |
| EFI_NOT_FOUND | Fail to locate necessary PPI. |
| EFI_UNSUPPORTED | Image Machine Type is not supported. |
| EFI_WARN_BUFFER_TOO_SMALL | There is not enough heap to allocate the requested size. This will not prevent the XIP image from being invoked. |
| EFI_STATUS EFIAPI PeiLoadImageLoadImageWrapper | ( | IN CONST EFI_PEI_LOAD_FILE_PPI * | This, |
| IN EFI_PEI_FILE_HANDLE | FileHandle, | ||
| OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg | OPTIONAL, | ||
| OUT UINT64 *ImageSizeArg | OPTIONAL, | ||
| OUT EFI_PHYSICAL_ADDRESS * | EntryPoint, | ||
| OUT UINT32 * | AuthenticationState | ||
| ) |
The wrapper function of PeiLoadImageLoadImage().
| This | - Pointer to EFI_PEI_LOAD_FILE_PPI. |
| FileHandle | - Pointer to the FFS file header of the image. |
| ImageAddressArg | - Pointer to PE/TE image. |
| ImageSizeArg | - Size of PE/TE image. |
| EntryPoint | - Pointer to entry point of specified image file for output. |
| AuthenticationState | - Pointer to attestation authentication state of image. |
| EFI_PEI_PPI_DESCRIPTOR gPpiLoadFilePpiList |
| EFI_PEI_LOAD_FILE_PPI mPeiLoadImagePpi |