XTLDR Rewrite #7

Merged
belliash merged 184 commits from xtldr_rewrite into master 2024-01-09 18:51:04 +01:00
3 changed files with 35 additions and 34 deletions
Showing only changes of commit 2d544e5993 - Show all commits

View File

@ -138,6 +138,36 @@ BlConsoleWrite(IN PUSHORT String)
EfiSystemTable->ConOut->OutputString(EfiSystemTable->ConOut, String);
}
/**
* This routine initializes the EFI console.
*
* @return This routine returns status code.
*
* @since XT 1.0
*/
XTCDECL
VOID
BlInitializeConsole()
{
/* Clear console buffers */
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, TRUE);
EfiSystemTable->ConOut->Reset(EfiSystemTable->ConOut, TRUE);
EfiSystemTable->StdErr->Reset(EfiSystemTable->StdErr, TRUE);
/* Make sure that current console mode is 80x25 characters, as some broken EFI implementations might
* set different mode that do not fit on the screen, causing a text to be displayed offscreen */
if(EfiSystemTable->ConOut->Mode->Mode != 0)
{
/* Set console mode to 0, which is standard, 80x25 text mode */
BlSetConsoleMode(0);
}
/* Clear screen and enable cursor */
BlSetConsoleAttributes(EFI_TEXT_BGCOLOR_BLACK | EFI_TEXT_FGCOLOR_LIGHTGRAY);
BlClearConsoleScreen();
BlEnableConsoleCursor();
}
/**
* Queries information concerning the output devices supported text mode.
*
@ -266,32 +296,3 @@ BlpConsolePrintChar(IN USHORT Character)
Buffer[1] = 0;
EfiSystemTable->ConOut->OutputString(EfiSystemTable->ConOut, Buffer);
}
/**
* This routine initializes the EFI console.
*
* @return This routine returns status code.
*
* @since XT 1.0
*/
XTCDECL
VOID
BlpInitializeConsole()
{
/* Clear console buffers */
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, TRUE);
EfiSystemTable->ConOut->Reset(EfiSystemTable->ConOut, TRUE);
EfiSystemTable->StdErr->Reset(EfiSystemTable->StdErr, TRUE);
/* Make sure that current console mode is 80x25 characters, as some broken EFI implementations might
* set different mode that do not fit on the screen, causing a text to be displayed offscreen */
if(EfiSystemTable->ConOut->Mode->Mode != 0)
{
/* Set console mode to 0, which is standard, 80x25 text mode */
BlSetConsoleMode(0);
}
/* Clear screen and enable cursor */
BlClearConsoleScreen();
BlEnableConsoleCursor();
}

View File

@ -131,6 +131,10 @@ BlInitializeBootMenuList(OUT PXTBL_BOOTMENU_ITEM MenuEntries,
OUT PULONG EntriesCount,
OUT PULONG DefaultId);
XTCDECL
VOID
BlInitializeConsole();
XTCDECL
EFI_STATUS
BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList);
@ -254,10 +258,6 @@ XTCDECL
EFI_STATUS
BlpActivateSerialIOController();
XTCDECL
VOID
BlpInitializeConsole();
XTCDECL
VOID
BlpConsolePrintChar(IN USHORT Character);

View File

@ -28,7 +28,7 @@ BlInitializeBootLoader()
BlpStatus.BootServices = TRUE;
/* Initialize console */
BlpInitializeConsole();
BlInitializeConsole();
/* Print XTLDR version */
BlConsolePrint(L"XTLDR boot loader v%s\n", XTOS_VERSION);