TianoCore EDK2 master
Loading...
Searching...
No Matches
UnitTestUefiBootServicesTableLibImage.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI UnitTestLoadImage (IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle)
 
EFI_STATUS EFIAPI UnitTestStartImage (IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL)
 
EFI_STATUS EFIAPI UnitTestExit (IN EFI_HANDLE ImageHandle, IN EFI_STATUS Status, IN UINTN ExitDataSize, IN CHAR16 *ExitData OPTIONAL)
 
EFI_STATUS EFIAPI UnitTestUnloadImage (IN EFI_HANDLE ImageHandle)
 
EFI_STATUS EFIAPI UnitTestExitBootServices (IN EFI_HANDLE ImageHandle, IN UINTN MapKey)
 

Detailed Description

Implementation of image related services in the UEFI Boot Services table for use in unit tests.

Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UnitTestUefiBootServicesTableLibImage.c.

Function Documentation

◆ UnitTestExit()

EFI_STATUS EFIAPI UnitTestExit ( IN EFI_HANDLE  ImageHandle,
IN EFI_STATUS  Status,
IN UINTN  ExitDataSize,
IN CHAR16 *ExitData  OPTIONAL 
)

Terminates the currently loaded EFI image and returns control to boot services.

Parameters
ImageHandleHandle that identifies the image. This parameter is passed to the image on entry.
StatusThe image's exit code.
ExitDataSizeThe size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS.
ExitDataPointer to a data buffer that includes a Null-terminated Unicode string, optionally followed by additional binary data. The string is a description that the caller may use to further indicate the reason for the image's exit.
Return values
EFI_INVALID_PARAMETERImage handle is NULL or it is not current image.
EFI_SUCCESSSuccessfully terminates the currently loaded EFI image.
EFI_ACCESS_DENIEDShould never reach there.
EFI_OUT_OF_RESOURCESCould not allocate pool

Definition at line 114 of file UnitTestUefiBootServicesTableLibImage.c.

◆ UnitTestExitBootServices()

EFI_STATUS EFIAPI UnitTestExitBootServices ( IN EFI_HANDLE  ImageHandle,
IN UINTN  MapKey 
)

Terminates all boot services.

Parameters
ImageHandleHandle that identifies the exiting image.
MapKeyKey to the latest memory map.
Return values
EFI_SUCCESSBoot Services terminated
EFI_INVALID_PARAMETERMapKey is incorrect.

Definition at line 157 of file UnitTestUefiBootServicesTableLibImage.c.

◆ UnitTestLoadImage()

EFI_STATUS EFIAPI UnitTestLoadImage ( IN BOOLEAN  BootPolicy,
IN EFI_HANDLE  ParentImageHandle,
IN EFI_DEVICE_PATH_PROTOCOL FilePath,
IN VOID *SourceBuffer  OPTIONAL,
IN UINTN  SourceSize,
OUT EFI_HANDLE ImageHandle 
)

Loads an EFI image into memory and returns a handle to the image.

Parameters
BootPolicyIf TRUE, indicates that the request originates from the boot manager, and that the boot manager is attempting to load FilePath as a boot selection.
ParentImageHandleThe caller's image handle.
FilePathThe specific file path from which the image is loaded.
SourceBufferIf not NULL, a pointer to the memory location containing a copy of the image to be loaded.
SourceSizeThe size in bytes of SourceBuffer.
ImageHandlePointer to the returned image handle that is created when the image is successfully loaded.
Return values
EFI_SUCCESSThe image was loaded into memory.
EFI_NOT_FOUNDThe FilePath was not found.
EFI_INVALID_PARAMETEROne of the parameters has an invalid value.
EFI_UNSUPPORTEDThe image type is not supported, or the device path cannot be parsed to locate the proper protocol for loading the file.
EFI_OUT_OF_RESOURCESImage was not loaded due to insufficient resources.
EFI_LOAD_ERRORImage was not loaded because the image format was corrupt or not understood.
EFI_DEVICE_ERRORImage was not loaded because the device returned a read error.
EFI_ACCESS_DENIEDImage was not loaded because the platform policy prohibits the image from being loaded. NULL is returned in *ImageHandle.
EFI_SECURITY_VIOLATIONImage was loaded and an ImageHandle was created with a valid EFI_LOADED_IMAGE_PROTOCOL. However, the current platform policy specifies that the image should not be started.

Definition at line 47 of file UnitTestUefiBootServicesTableLibImage.c.

◆ UnitTestStartImage()

EFI_STATUS EFIAPI UnitTestStartImage ( IN EFI_HANDLE  ImageHandle,
OUT UINTN ExitDataSize,
OUT CHAR16 **ExitData  OPTIONAL 
)

Transfer control to a loaded image's entry point.

Parameters
ImageHandleHandle of image to be started.
ExitDataSizePointer of the size to ExitData
ExitDataPointer to a pointer to a data buffer that includes a Null-terminated string, optionally followed by additional binary data. The string is a description that the caller may use to further indicate the reason for the image's exit.
Return values
EFI_INVALID_PARAMETERInvalid parameter
EFI_OUT_OF_RESOURCESNo enough buffer to allocate
EFI_SECURITY_VIOLATIONThe current platform policy specifies that the image should not be started.
EFI_SUCCESSSuccessfully transfer control to the image's entry point.

Definition at line 80 of file UnitTestUefiBootServicesTableLibImage.c.

◆ UnitTestUnloadImage()

EFI_STATUS EFIAPI UnitTestUnloadImage ( IN EFI_HANDLE  ImageHandle)

Unloads an image.

Parameters
ImageHandleHandle that identifies the image to be unloaded.
Return values
EFI_SUCCESSThe image has been unloaded.
EFI_UNSUPPORTEDThe image has been started, and does not support unload.
EFI_INVALID_PARAMPETERImageHandle is not a valid image handle.

Definition at line 138 of file UnitTestUefiBootServicesTableLibImage.c.