Use new string formatting mechanism in the boot loader
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 28s
Builds / ExectOS (i686) (push) Successful in 30s

This commit is contained in:
2024-02-15 23:32:23 +01:00
parent 8dd0e70dd9
commit 5de4d7a7f5
5 changed files with 33 additions and 497 deletions

View File

@@ -98,13 +98,18 @@ VOID
BlConsolePrint(IN PUSHORT Format,
IN ...)
{
RTL_PRINT_CONTEXT ConsolePrintContext, SerialPrintContext;
VA_LIST Arguments;
/* Initialise the print contexts */
ConsolePrintContext.WriteWideCharacter = BlpConsolePrintChar;
SerialPrintContext.WriteWideCharacter = BlpDebugPutChar;
/* Initialise the va_list */
VA_START(Arguments, Format);
/* Format and print the string to the stdout */
BlpStringPrint(BlpConsolePrintChar, Format, Arguments);
RtlFormatWideString(&ConsolePrintContext, (PWCHAR)Format, Arguments);
/* Print to serial console only if not running under OVMF */
if(RtlCompareWideString(EfiSystemTable->FirmwareVendor, L"EDK II", 6) != 0)
@@ -113,7 +118,7 @@ BlConsolePrint(IN PUSHORT Format,
if(DEBUG && (BlpStatus.SerialPort.Flags & COMPORT_FLAG_INIT))
{
/* Format and print the string to the serial console */
BlpStringPrint(BlpDebugPutChar, Format, Arguments);
RtlFormatWideString(&SerialPrintContext, (PWCHAR)Format, Arguments);
}
}
@@ -281,18 +286,28 @@ BlSetCursorPosition(IN ULONGLONG PosX,
* @param Character
* The integer promotion of the character to be written.
*
* @return This routine does not return any value.
* @return This routine returns a status code.
*
* @since XT 1.0
*/
XTCDECL
VOID
XTSTATUS
BlpConsolePrintChar(IN USHORT Character)
{
USHORT Buffer[2];
/* Check if character is a newline ('\n') */
if(Character == L'\n')
{
/* Print carriage return ('\r') as well */
BlpConsolePrintChar(L'\r');
}
/* Write character to the screen console */
Buffer[0] = Character;
Buffer[1] = 0;
EfiSystemTable->ConOut->OutputString(EfiSystemTable->ConOut, Buffer);
/* Return success */
return STATUS_SUCCESS;
}