Implement BlLoadEfiImage() and BlStartEfiImage() routines

This commit is contained in:
2024-01-22 23:04:24 +01:00
parent 6733e092ba
commit 435ee66ce1
4 changed files with 66 additions and 3 deletions

View File

@@ -99,6 +99,36 @@ BlGetSecureBootStatus()
return SecureBootStatus;
}
/**
* Loads an EFI image into memory.
*
* @param DevicePath
* Specifies a device path from which the image is loaded.
*
* @param ImageData
* Supplies a pointer to the memory are containing a copy of the EFI image.
*
* @param ImageSize
* Supplies the size (in bytes) of the EFI image.
*
* @param ImageHandle
* Supplies a pointer to the memory area, where an EFI_image handle will be stored.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTCDECL
EFI_STATUS
BlLoadEfiImage(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
IN PVOID ImageData,
IN SIZE_T ImageSize,
OUT PEFI_HANDLE ImageHandle)
{
/* Load EFI image */
return EfiSystemTable->BootServices->LoadImage(FALSE, EfiImageHandle, DevicePath, ImageData, ImageSize, ImageHandle);
}
/**
* Reboots the machine.
*
@@ -146,6 +176,23 @@ BlSleepExecution(IN ULONG_PTR Milliseconds)
EfiSystemTable->BootServices->Stall(Milliseconds * 1000);
}
/**
* Executes a loaded EFI image entry point.
*
* @param ImageHandle
* Provides a handle of loaded image, that will be started.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTCDECL
EFI_STATUS
BlStartEfiImage(IN EFI_HANDLE ImageHandle)
{
return EfiSystemTable->BootServices->StartImage(ImageHandle, NULL, NULL);
}
/**
* Waits for one or more EFI events.
*