Refactor part 6
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 27s
Builds / ExectOS (i686) (push) Successful in 46s

This commit is contained in:
2023-12-04 16:32:07 +01:00
parent 9a3e0f69fa
commit 2b2efd0dd3
8 changed files with 162 additions and 88 deletions

View File

@@ -9,6 +9,41 @@
#include <xtldr.h>
/**
* Exits EFI boot services.
*
* @param MapKey
* Identifies the current memory map of the system.
*
* @return This routine returns status code.
*
* @since XT 1.0
*/
XTCDECL
EFI_STATUS
BlExitBootServices(IN UINT_PTR MapKey)
{
EFI_STATUS Status;
/* Attempt to exit boot services */
Status = EfiSystemTable->BootServices->ExitBootServices(BlpStatus.ImageHandle, MapKey);
if(Status != STATUS_EFI_SUCCESS)
{
/* Retry as UEFI spec says to do it twice */
Status = EfiSystemTable->BootServices->ExitBootServices(BlpStatus.ImageHandle, MapKey);
}
/* Make sure boot services were successfully exited */
if(Status == STATUS_EFI_SUCCESS)
{
/* Mark EFI Boot Services as no longer available */
BlpStatus.BootServices = FALSE;
}
/* Return EFI status code */
return Status;
}
/**
* Puts the system to sleep for the specified number of milliseconds.
*
@@ -25,3 +60,23 @@ BlSleepExecution(IN ULONG_PTR Milliseconds)
{
EfiSystemTable->BootServices->Stall(Milliseconds * 1000);
}
/**
* Initializes EFI Boot Loader (XTLDR).
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL
VOID
BlpInitializeEfiBootLoader()
{
/* Set current XTLDR status */
BlpStatus.BootServices = TRUE;
BlpStatus.ImageHandle = EfiImageHandle;
BlpStatus.SystemTable = EfiSystemTable;
/* Initialize console */
BlpConsoleInitialize();
}