Implement BlSetConsoleMode() and forcibly set mode to 80x25 to avoid offscreen
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 33s
Builds / ExectOS (i686) (push) Successful in 28s

This commit is contained in:
Rafal Kupiec 2023-12-21 22:57:11 +01:00
parent 782e6e3987
commit 5ee6377080
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 38 additions and 9 deletions

View File

@ -179,6 +179,23 @@ BlSetConsoleAttributes(IN ULONGLONG Attributes)
EfiSystemTable->ConOut->SetAttribute(EfiSystemTable->ConOut, Attributes); EfiSystemTable->ConOut->SetAttribute(EfiSystemTable->ConOut, Attributes);
} }
/**
* Sets the output console device to the requested mode.
*
* @param Mode
* Supplies a text mode number to set.
*
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTCDECL
EFI_STATUS
BlSetConsoleMode(IN ULONGLONG Mode)
{
return EfiSystemTable->ConOut->SetMode(EfiSystemTable->ConOut, Mode);
}
/** /**
* Sets new coordinates of the console cursor position. * Sets new coordinates of the console cursor position.
* *
@ -238,6 +255,14 @@ BlpInitializeConsole()
EfiSystemTable->ConOut->Reset(EfiSystemTable->ConOut, TRUE); EfiSystemTable->ConOut->Reset(EfiSystemTable->ConOut, TRUE);
EfiSystemTable->StdErr->Reset(EfiSystemTable->StdErr, 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 */ /* Clear screen and enable cursor */
BlClearConsoleScreen(); BlClearConsoleScreen();
BlEnableConsoleCursor(); BlEnableConsoleCursor();

View File

@ -107,6 +107,15 @@ EFI_STATUS
BlMemoryAllocatePool(IN UINT_PTR Size, BlMemoryAllocatePool(IN UINT_PTR Size,
OUT PVOID *Memory); OUT PVOID *Memory);
XTCDECL
EFI_STATUS
BlMemoryFreePages(IN UINT64 Pages,
IN EFI_PHYSICAL_ADDRESS Memory);
XTCDECL
EFI_STATUS
BlMemoryFreePool(IN PVOID Memory);
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath, BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
@ -133,15 +142,6 @@ XTCDECL
VOID VOID
BlResetConsoleInputBuffer(); BlResetConsoleInputBuffer();
XTCDECL
EFI_STATUS
BlMemoryFreePages(IN UINT64 Pages,
IN EFI_PHYSICAL_ADDRESS Memory);
XTCDECL
EFI_STATUS
BlMemoryFreePool(IN PVOID Memory);
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BlOpenXtProtocol(OUT PVOID *ProtocolHandler, BlOpenXtProtocol(OUT PVOID *ProtocolHandler,
@ -156,6 +156,10 @@ XTCDECL
VOID VOID
BlSetConsoleAttributes(IN ULONGLONG Attributes); BlSetConsoleAttributes(IN ULONGLONG Attributes);
XTCDECL
EFI_STATUS
BlSetConsoleMode(IN ULONGLONG Mode);
XTCDECL XTCDECL
VOID VOID
BlSetCursorPosition(IN ULONGLONG PosX, BlSetCursorPosition(IN ULONGLONG PosX,