diff --git a/xtldr2/efiutils.c b/xtldr2/efiutils.c index 41e7f5a..34dac18 100644 --- a/xtldr2/efiutils.c +++ b/xtldr2/efiutils.c @@ -118,58 +118,3 @@ BlWaitForEfiEvent(IN UINT_PTR NumberOfEvents, { return EfiSystemTable->BootServices->WaitForEvent(NumberOfEvents, Event, Index); } - -/** - * Initializes EFI Boot Loader (XTLDR). - * - * @return This routine does not return any value. - * - * @since XT 1.0 - */ -XTCDECL -VOID -BlpInitializeEfiBootLoader() -{ - EFI_GUID LipGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID; - PEFI_LOADED_IMAGE_PROTOCOL LoadedImage; - EFI_STATUS Status; - - /* Set current XTLDR's EFI BootServices status */ - BlpStatus.BootServices = TRUE; - - /* Initialize console */ - BlpInitializeConsole(); - - /* Print XTLDR version */ - BlConsolePrint(L"XTLDR boot loader v%s\n", XTOS_VERSION); - - /* Initialize XTLDR configuration linked lists */ - RtlInitializeListHead(&BlpBootProtocols); - RtlInitializeListHead(&BlpConfig); - RtlInitializeListHead(&BlpLoadedModules); - - /* Store SecureBoot status */ - BlpStatus.SecureBoot = BlGetSecureBootStatus(); - - /* Check if debug is enabled */ - if(DEBUG) - { - /* Attempt to open EFI LoadedImage protocol */ - Status = BlOpenXtProtocol((PVOID *)&LoadedImage, &LipGuid); - if(Status == STATUS_EFI_SUCCESS) - { - /* Protocol opened successfully, print useful debug information */ - BlConsolePrint(L"\n---------- BOOTLOADER DEBUG ----------\n" - L"Pointer Size : %d\n" - L"Image Base Address: 0x%lx\n" - L"Image Base Size : 0x%lx\n" - L"Image Revision : 0x%lx\n" - L"--------------------------------------\n", - sizeof(PVOID), - LoadedImage->ImageBase, - LoadedImage->ImageSize, - LoadedImage->Revision); - BlSleepExecution(3000); - } - } -} diff --git a/xtldr2/includes/bootman.h b/xtldr2/includes/bootman.h index 246096b..3f8bfc0 100644 --- a/xtldr2/includes/bootman.h +++ b/xtldr2/includes/bootman.h @@ -104,6 +104,10 @@ BlGetVolumeDevicePath(IN PWCHAR SystemPath, OUT PWCHAR *ArcName, OUT PWCHAR *Path); +XTCDECL +VOID +BlInitializeBootLoader(); + XTCDECL VOID BlInitializeBootMenuList(OUT PXTBL_BOOTMENU_ITEM MenuEntries, @@ -309,10 +313,6 @@ XTCDECL EFI_STATUS BlpInitializeDebugConsole(); -XTCDECL -VOID -BlpInitializeEfiBootLoader(); - XTCDECL EFI_STATUS BlpInitializeSerialPort(IN ULONG PortNumber, diff --git a/xtldr2/xtldr.c b/xtldr2/xtldr.c index 4d8895a..7fd32ef 100644 --- a/xtldr2/xtldr.c +++ b/xtldr2/xtldr.c @@ -9,6 +9,61 @@ #include +/** + * Initializes EFI Boot Loader (XTLDR). + * + * @return This routine does not return any value. + * + * @since XT 1.0 + */ +XTCDECL +VOID +BlInitializeBootLoader() +{ + EFI_GUID LipGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID; + PEFI_LOADED_IMAGE_PROTOCOL LoadedImage; + EFI_STATUS Status; + + /* Set current XTLDR's EFI BootServices status */ + BlpStatus.BootServices = TRUE; + + /* Initialize console */ + BlpInitializeConsole(); + + /* Print XTLDR version */ + BlConsolePrint(L"XTLDR boot loader v%s\n", XTOS_VERSION); + + /* Initialize XTLDR configuration linked lists */ + RtlInitializeListHead(&BlpBootProtocols); + RtlInitializeListHead(&BlpConfig); + RtlInitializeListHead(&BlpLoadedModules); + + /* Store SecureBoot status */ + BlpStatus.SecureBoot = BlGetSecureBootStatus(); + + /* Check if debug is enabled */ + if(DEBUG) + { + /* Attempt to open EFI LoadedImage protocol */ + Status = BlOpenXtProtocol((PVOID *)&LoadedImage, &LipGuid); + if(Status == STATUS_EFI_SUCCESS) + { + /* Protocol opened successfully, print useful debug information */ + BlConsolePrint(L"\n---------- BOOTLOADER DEBUG ----------\n" + L"Pointer Size : %d\n" + L"Image Base Address: 0x%lx\n" + L"Image Base Size : 0x%lx\n" + L"Image Revision : 0x%lx\n" + L"--------------------------------------\n", + sizeof(PVOID), + LoadedImage->ImageBase, + LoadedImage->ImageSize, + LoadedImage->Revision); + BlSleepExecution(3000); + } + } +} + /** * Initializes a list of operating systems for XTLDR boot menu. * @@ -243,7 +298,7 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle, EfiSystemTable = SystemTable; /* Initialize XTLDR and */ - BlpInitializeEfiBootLoader(); + BlInitializeBootLoader(); /* Parse configuration options passed from UEFI shell */ Status = BlpParseCommandLine();