Refactor part 1
Some checks failed
Builds / ExectOS (amd64) (push) Failing after 14s
Builds / ExectOS (i686) (push) Failing after 14s

This commit is contained in:
Rafal Kupiec 2023-12-03 16:04:12 +01:00
parent 55bd9e326f
commit fce8a50321
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
10 changed files with 121 additions and 104 deletions

View File

@ -36,5 +36,5 @@ set_install_target(xtldr efi/boot)
# Set loader entrypoint and subsystem # Set loader entrypoint and subsystem
set_imagebase(xtldr ${BASEADDRESS_XTLDR}) set_imagebase(xtldr ${BASEADDRESS_XTLDR})
set_entrypoint(xtldr "BmStartXtLoader") set_entrypoint(xtldr "BlStartXtLoader")
set_subsystem(xtldr efi_application) set_subsystem(xtldr efi_application)

View File

@ -2,16 +2,23 @@
* PROJECT: ExectOS * PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory * COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/config.c * FILE: xtldr/config.c
* DESCRIPTION: XT Boot Manager Configuration * DESCRIPTION: XT Boot Loader Configuration
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org> * DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/ */
#include <xtbm.h> #include <xtbm.h>
/**
* Parses command line arguments and updates global configuration.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
VOID VOID
BmpParseCommandLineOptions(VOID) BlpConfigParseCommandLine(VOID)
{ {
EFI_GUID LIPGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID; EFI_GUID LIPGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
PEFI_LOADED_IMAGE_PROTOCOL LoadedImage; PEFI_LOADED_IMAGE_PROTOCOL LoadedImage;
@ -25,14 +32,24 @@ BmpParseCommandLineOptions(VOID)
if(LoadedImage && LoadedImage->LoadOptions) if(LoadedImage && LoadedImage->LoadOptions)
{ {
/* Update global boot loader configuration */ /* Update global boot loader configuration */
BmpUpdateGlobalConfiguration(LoadedImage->LoadOptions); BlpConfigUpdateGlobalConfiguration(LoadedImage->LoadOptions);
} }
} }
} }
/**
* Updates XTLDR configuration based on provided options.
*
* @param Options
* Supplies a formatted list of options to be processed and stored in global configuration.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTCDECL XTCDECL
VOID VOID
BmpUpdateGlobalConfiguration(IN PWCHAR Options) BlpConfigUpdateGlobalConfiguration(IN PWCHAR Options)
{ {
PWCHAR Argument, LastArg; PWCHAR Argument, LastArg;
SIZE_T Length; SIZE_T Length;
@ -51,9 +68,9 @@ BmpUpdateGlobalConfiguration(IN PWCHAR Options)
Length = RtlWideStringLength(Argument, 0); Length = RtlWideStringLength(Argument, 0);
/* Save default OS parameter in global configuration */ /* Save default OS parameter in global configuration */
BmAllocateEfiPool(Length, (PVOID *)&BmpConfiguration.Default); BlMemoryAllocatePool(Length, (PVOID *)&BlpConfiguration.Default);
RtlCopyMemory(BmpConfiguration.Default, Argument, (Length * sizeof(WCHAR)) - 1); RtlCopyMemory(BlpConfiguration.Default, Argument, (Length * sizeof(WCHAR)) - 1);
BmpConfiguration.Default[Length] = '\0'; BlpConfiguration.Default[Length] = '\0';
} }
else if(RtlWideStringCompare(Argument, L"DEBUG=", 6) == 0) else if(RtlWideStringCompare(Argument, L"DEBUG=", 6) == 0)
{ {
@ -62,14 +79,14 @@ BmpUpdateGlobalConfiguration(IN PWCHAR Options)
Length = RtlWideStringLength(Argument, 0); Length = RtlWideStringLength(Argument, 0);
/* Save debug port in global configuration */ /* Save debug port in global configuration */
BmAllocateEfiPool(Length, (PVOID *)&BmpConfiguration.Debug); BlMemoryAllocatePool(Length, (PVOID *)&BlpConfiguration.Debug);
RtlCopyMemory(BmpConfiguration.Debug, Argument, (Length * sizeof(WCHAR)) - 1); RtlCopyMemory(BlpConfiguration.Debug, Argument, (Length * sizeof(WCHAR)) - 1);
BmpConfiguration.Debug[Length] = '\0'; BlpConfiguration.Debug[Length] = '\0';
} }
else if(RtlWideStringCompare(Argument, L"SHELL", 5) == 0) else if(RtlWideStringCompare(Argument, L"SHELL", 5) == 0)
{ {
/* Force shell mode */ /* Force shell mode */
BmpConfiguration.Shell = TRUE; BlpConfiguration.Shell = TRUE;
} }
else if(RtlWideStringCompare(Argument, L"THEME=", 6) == 0) else if(RtlWideStringCompare(Argument, L"THEME=", 6) == 0)
{ {
@ -78,9 +95,9 @@ BmpUpdateGlobalConfiguration(IN PWCHAR Options)
Length = RtlWideStringLength(Argument, 0); Length = RtlWideStringLength(Argument, 0);
/* Save theme in global configuration */ /* Save theme in global configuration */
BmAllocateEfiPool(Length, (PVOID *)&BmpConfiguration.Theme); BlMemoryAllocatePool(Length, (PVOID *)&BlpConfiguration.Theme);
RtlCopyMemory(BmpConfiguration.Theme, Argument, (Length * sizeof(WCHAR)) - 1); RtlCopyMemory(BlpConfiguration.Theme, Argument, (Length * sizeof(WCHAR)) - 1);
BmpConfiguration.Theme[Length] = '\0'; BlpConfiguration.Theme[Length] = '\0';
} }
else if(RtlWideStringCompare(Argument, L"TIMEOUT=", 8) == 0) else if(RtlWideStringCompare(Argument, L"TIMEOUT=", 8) == 0)
{ {
@ -88,13 +105,13 @@ BmpUpdateGlobalConfiguration(IN PWCHAR Options)
Argument += 8; Argument += 8;
/* Zero the timeout */ /* Zero the timeout */
BmpConfiguration.Timeout = 0; BlpConfiguration.Timeout = 0;
/* Read the timeout value and store it in global configuration */ /* Read the timeout value and store it in global configuration */
while(*Argument >= '0' && *Argument <= '9') while(*Argument >= '0' && *Argument <= '9')
{ {
BmpConfiguration.Timeout *= 10; BlpConfiguration.Timeout *= 10;
BmpConfiguration.Timeout += *Argument - '0'; BlpConfiguration.Timeout += *Argument - '0';
Argument++; Argument++;
} }
} }
@ -105,9 +122,9 @@ BmpUpdateGlobalConfiguration(IN PWCHAR Options)
Length = RtlWideStringLength(Argument, 0); Length = RtlWideStringLength(Argument, 0);
/* Save theme in global configuration */ /* Save theme in global configuration */
BmAllocateEfiPool(Length, (PVOID *)&BmpConfiguration.Tune); BlMemoryAllocatePool(Length, (PVOID *)&BlpConfiguration.Tune);
RtlCopyMemory(BmpConfiguration.Tune, Argument, (Length * sizeof(WCHAR)) - 1); RtlCopyMemory(BlpConfiguration.Tune, Argument, (Length * sizeof(WCHAR)) - 1);
BmpConfiguration.Tune[Length] = '\0'; BlpConfiguration.Tune[Length] = '\0';
} }
/* Take next argument */ /* Take next argument */

View File

@ -18,7 +18,7 @@
*/ */
XTCDECL XTCDECL
VOID VOID
BmClearScreen() BlConsoleClearScreen()
{ {
/* Clear screen */ /* Clear screen */
EfiSystemTable->ConOut->ClearScreen(EfiSystemTable->ConOut); EfiSystemTable->ConOut->ClearScreen(EfiSystemTable->ConOut);
@ -33,7 +33,7 @@ BmClearScreen()
*/ */
XTCDECL XTCDECL
VOID VOID
BmDisableCursor() BlConsoleDisableCursor()
{ {
EfiSystemTable->ConOut->EnableCursor(EfiSystemTable->ConOut, FALSE); EfiSystemTable->ConOut->EnableCursor(EfiSystemTable->ConOut, FALSE);
} }
@ -47,7 +47,7 @@ BmDisableCursor()
*/ */
XTCDECL XTCDECL
VOID VOID
BmEnableCursor() BlConsoleEnableCursor()
{ {
EfiSystemTable->ConOut->EnableCursor(EfiSystemTable->ConOut, TRUE); EfiSystemTable->ConOut->EnableCursor(EfiSystemTable->ConOut, TRUE);
} }
@ -61,7 +61,7 @@ BmEnableCursor()
*/ */
XTCDECL XTCDECL
VOID VOID
BmInitializeConsole() BlConsoleInitialize()
{ {
/* Clear console buffers */ /* Clear console buffers */
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, TRUE); EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, TRUE);
@ -69,8 +69,8 @@ BmInitializeConsole()
EfiSystemTable->StdErr->Reset(EfiSystemTable->StdErr, TRUE); EfiSystemTable->StdErr->Reset(EfiSystemTable->StdErr, TRUE);
/* Clear screen and enable cursor */ /* Clear screen and enable cursor */
BmClearScreen(); BlConsoleClearScreen();
BmEnableCursor(); BlConsoleEnableCursor();
} }
/** /**
@ -88,8 +88,8 @@ BmInitializeConsole()
*/ */
XTCDECL XTCDECL
VOID VOID
BmPrint(IN PUINT16 Format, BlConsolePrint(IN PUINT16 Format,
IN ...) IN ...)
{ {
VA_LIST Arguments; VA_LIST Arguments;
@ -97,7 +97,7 @@ BmPrint(IN PUINT16 Format,
VA_START(Arguments, Format); VA_START(Arguments, Format);
/* Format and print the string to the stdout */ /* Format and print the string to the stdout */
BmPrintString(BmPrintChar, Format, Arguments); BlpStringPrint(BlpConsolePrintChar, Format, Arguments);
/* Clean up the va_list */ /* Clean up the va_list */
VA_END(Arguments); VA_END(Arguments);
@ -115,7 +115,7 @@ BmPrint(IN PUINT16 Format,
*/ */
XTCDECL XTCDECL
VOID VOID
BmPrintChar(IN USHORT Character) BlpConsolePrintChar(IN USHORT Character)
{ {
USHORT Buffer[2]; USHORT Buffer[2];

View File

@ -2,7 +2,7 @@
* PROJECT: ExectOS * PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory * COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/globals.c * FILE: xtldr/globals.c
* DESCRIPTION: XT Boot Manager global variables * DESCRIPTION: XT Boot Loader global variables
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org> * DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/ */
@ -10,13 +10,13 @@
/* XT Boot Loader configuration data */ /* XT Boot Loader configuration data */
XTBM_CONFIGURATION BmpConfiguration = {0}; XTBM_CONFIGURATION BlpConfiguration = {0};
/* XT Boot Loader hex table */ /* XT Boot Loader hex table */
STATIC PUINT16 BmpHexTable = L"0123456789ABCDEF"; STATIC PUINT16 BlpHexTable = L"0123456789ABCDEF";
/* Serial port configuration */ /* Serial port configuration */
CPPORT BmpSerialPort; CPPORT BlpSerialPort;
/* EFI Image Handle */ /* EFI Image Handle */
EFI_HANDLE EfiImageHandle; EFI_HANDLE EfiImageHandle;

View File

@ -2,7 +2,7 @@
* PROJECT: ExectOS * PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory * COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/hardware.c * FILE: xtldr/hardware.c
* DESCRIPTION: XT Boot Manager EFI hardware support * DESCRIPTION: EFI hardware support for XT Boot Loader
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org> * DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/ */
@ -18,7 +18,7 @@
*/ */
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmActivateSerialIOController() BlpHwActivateSerialIOController()
{ {
EFI_GUID PciGuid = EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID; EFI_GUID PciGuid = EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL PciDev; PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL PciDev;
@ -31,7 +31,7 @@ BmActivateSerialIOController()
/* Allocate memory for single EFI_HANDLE, what should be enough in most cases */ /* Allocate memory for single EFI_HANDLE, what should be enough in most cases */
PciHandleSize = sizeof(EFI_HANDLE); PciHandleSize = sizeof(EFI_HANDLE);
Status = BmAllocateEfiPool(PciHandleSize, (PVOID*)&PciHandle); Status = BlMemoryAllocatePool(PciHandleSize, (PVOID*)&PciHandle);
if(Status != STATUS_EFI_SUCCESS) if(Status != STATUS_EFI_SUCCESS)
{ {
/* Memory allocation failure */ /* Memory allocation failure */
@ -43,8 +43,8 @@ BmActivateSerialIOController()
if(Status == STATUS_EFI_BUFFER_TOO_SMALL) if(Status == STATUS_EFI_BUFFER_TOO_SMALL)
{ {
/* Reallocate more memory as requested by UEFI */ /* Reallocate more memory as requested by UEFI */
BmFreeEfiPool(PciHandle); BlMemoryFreePool(PciHandle);
Status = BmAllocateEfiPool(PciHandleSize, (PVOID*)&PciHandle); Status = BlMemoryAllocatePool(PciHandleSize, (PVOID*)&PciHandle);
if(Status != STATUS_EFI_SUCCESS) if(Status != STATUS_EFI_SUCCESS)
{ {
/* Memory reallocation failure */ /* Memory reallocation failure */

View File

@ -2,7 +2,7 @@
* PROJECT: ExectOS * PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory * COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/includes/xtbm.h * FILE: xtldr/includes/xtbm.h
* DESCRIPTION: XTLDR Boot Manager related structures and routines forward references * DESCRIPTION: XTLDR Boot Loader related structures and routines forward references
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org> * DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/ */
@ -17,53 +17,53 @@ typedef VOID (BMPRINTCHAR)(IN USHORT Character);
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmAllocateEfiPages(IN UINT64 Pages, BlMemoryAllocatePages(IN UINT64 Pages,
OUT PEFI_PHYSICAL_ADDRESS Memory); OUT PEFI_PHYSICAL_ADDRESS Memory);
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmAllocateEfiPool(IN UINT_PTR Size, BlMemoryAllocatePool(IN UINT_PTR Size,
OUT PVOID *Memory); OUT PVOID *Memory);
/* XTLDR routines forward references */ /* XTLDR routines forward references */
XTCDECL XTCDECL
VOID VOID
BmClearScreen(); BlConsoleClearScreen();
XTCDECL XTCDECL
VOID VOID
BmDisableCursor(); BlConsoleDisableCursor();
XTCDECL XTCDECL
VOID VOID
BmEnableCursor(); BlConsoleEnableCursor();
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmFreeEfiPages(IN UINT64 Pages, BlMemoreFreePages(IN UINT64 Pages,
IN EFI_PHYSICAL_ADDRESS Memory); IN EFI_PHYSICAL_ADDRESS Memory);
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmFreeEfiPool(IN PVOID Memory); BlMemoryFreePool(IN PVOID Memory);
XTCDECL XTCDECL
VOID VOID
BmInitializeConsole(); BlConsoleInitialize();
XTCDECL XTCDECL
VOID VOID
BmPrint(IN PUINT16 Format, BlConsolePrint(IN PUINT16 Format,
IN ...); IN ...);
XTCDECL XTCDECL
VOID VOID
BmPrintChar(IN USHORT Character); BlpConsolePrintChar(IN USHORT Character);
XTCDECL XTCDECL
VOID VOID
BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine, BlpStringPrint(IN IN BMPRINTCHAR PrintCharRoutine,
IN PUINT16 Format, IN PUINT16 Format,
IN VA_LIST Arguments); IN VA_LIST Arguments);
@ -75,46 +75,46 @@ BmStartXtLoader(IN EFI_HANDLE ImageHandle,
XTCDECL XTCDECL
VOID VOID
BmpFormatString(IN BMPRINTCHAR PrintCharRoutine, BlpStringFormat(IN BMPRINTCHAR PrintCharRoutine,
IN PUINT16 Format, IN PUINT16 Format,
IN ...); IN ...);
XTCDECL XTCDECL
VOID VOID
BmpParseCommandLineOptions(VOID); BlpConfigParseCommandLine(VOID);
XTCDECL XTCDECL
VOID VOID
BmpPrintSigned32String(IN BMPRINTCHAR PrintCharRoutine, BlpStringPrintSigned32(IN BMPRINTCHAR PrintCharRoutine,
IN INT Number, IN INT Number,
IN UINT Base); IN UINT Base);
XTCDECL XTCDECL
VOID VOID
BmpPrintSigned64String(IN BMPRINTCHAR PrintCharRoutine, BlpStringPrintSigned64(IN BMPRINTCHAR PrintCharRoutine,
IN INT_PTR Number, IN INT_PTR Number,
IN UINT_PTR Base); IN UINT_PTR Base);
XTCDECL XTCDECL
VOID VOID
BmpPrintUnsigned32String(IN BMPRINTCHAR PrintCharRoutine, BlpStringPrintUnsigned32(IN BMPRINTCHAR PrintCharRoutine,
IN UINT Number, IN UINT Number,
IN UINT Base, IN UINT Base,
IN UINT Padding); IN UINT Padding);
XTCDECL XTCDECL
VOID VOID
BmpPrintUnsigned64String(IN BMPRINTCHAR PrintCharRoutine, BlpStringPrintUnsigned64(IN BMPRINTCHAR PrintCharRoutine,
IN UINT_PTR Number, IN UINT_PTR Number,
IN UINT_PTR Base, IN UINT_PTR Base,
IN UINT_PTR Padding); IN UINT_PTR Padding);
XTCDECL XTCDECL
UINT64 UINT64
BmpReadStringPadding(IN PUINT16 *Format); BlpStringReadPadding(IN PUINT16 *Format);
XTCDECL XTCDECL
VOID VOID
BmpUpdateGlobalConfiguration(IN PWCHAR Options); BlpConfigUpdateGlobalConfiguration(IN PWCHAR Options);
#endif /* __XTLDR_BOOTMAN_H */ #endif /* __XTLDR_BOOTMAN_H */

View File

@ -13,13 +13,13 @@
/* XT Boot Loader configuration data */ /* XT Boot Loader configuration data */
EXTERN XTBM_CONFIGURATION BmpConfiguration; EXTERN XTBM_CONFIGURATION BlpConfiguration;
/* XT Boot Loader hex table */ /* XT Boot Loader hex table */
EXTERN PUINT16 BmpHexTable; EXTERN PUINT16 BlpHexTable;
/* Serial port configuration */ /* Serial port configuration */
EXTERN CPPORT BmpSerialPort; EXTERN CPPORT BlpSerialPort;
/* EFI Image Handle */ /* EFI Image Handle */
EXTERN EFI_HANDLE EfiImageHandle; EXTERN EFI_HANDLE EfiImageHandle;

View File

@ -2,7 +2,7 @@
* PROJECT: ExectOS * PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory * COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/memory.c * FILE: xtldr/memory.c
* DESCRIPTION: XT Boot Manager EFI memory management * DESCRIPTION: XT Boot Loader memory management
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org> * DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/ */
@ -24,8 +24,8 @@
*/ */
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmAllocateEfiPages(IN UINT64 Pages, BlMemoryAllocatePages(IN UINT64 Pages,
OUT PEFI_PHYSICAL_ADDRESS Memory) OUT PEFI_PHYSICAL_ADDRESS Memory)
{ {
return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiLoaderData, Pages, Memory); return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiLoaderData, Pages, Memory);
} }
@ -45,8 +45,8 @@ BmAllocateEfiPages(IN UINT64 Pages,
*/ */
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmAllocateEfiPool(IN UINT_PTR Size, BlMemoryAllocatePool(IN UINT_PTR Size,
OUT PVOID *Memory) OUT PVOID *Memory)
{ {
/* Allocate pool */ /* Allocate pool */
return EfiSystemTable->BootServices->AllocatePool(EfiLoaderData, Size, Memory); return EfiSystemTable->BootServices->AllocatePool(EfiLoaderData, Size, Memory);
@ -67,8 +67,8 @@ BmAllocateEfiPool(IN UINT_PTR Size,
*/ */
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmFreeEfiPages(IN UINT64 Pages, BlMemoreFreePages(IN UINT64 Pages,
IN EFI_PHYSICAL_ADDRESS Memory) IN EFI_PHYSICAL_ADDRESS Memory)
{ {
return EfiSystemTable->BootServices->FreePages(Memory, Pages); return EfiSystemTable->BootServices->FreePages(Memory, Pages);
} }
@ -85,7 +85,7 @@ BmFreeEfiPages(IN UINT64 Pages,
*/ */
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmFreeEfiPool(IN PVOID Memory) BlMemoryFreePool(IN PVOID Memory)
{ {
/* Free pool */ /* Free pool */
return EfiSystemTable->BootServices->FreePool(Memory); return EfiSystemTable->BootServices->FreePool(Memory);

View File

@ -27,9 +27,9 @@
*/ */
XTCDECL XTCDECL
VOID VOID
BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine, BlpStringPrint(IN IN BMPRINTCHAR PrintCharRoutine,
IN PUINT16 Format, IN PUINT16 Format,
IN VA_LIST Arguments) IN VA_LIST Arguments)
{ {
PEFI_GUID Guid; PEFI_GUID Guid;
PUCHAR String; PUCHAR String;
@ -46,7 +46,7 @@ BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine,
{ {
case L'b': case L'b':
/* Boolean */ /* Boolean */
BmpFormatString(PrintCharRoutine, L"%s", VA_ARG(Arguments, INT32) ? "TRUE" : "FALSE"); BlpStringFormat(PrintCharRoutine, L"%s", VA_ARG(Arguments, INT32) ? "TRUE" : "FALSE");
break; break;
case L'c': case L'c':
/* Character */ /* Character */
@ -54,12 +54,12 @@ BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine,
break; break;
case L'd': case L'd':
/* Signed 32-bit integer */ /* Signed 32-bit integer */
BmpPrintSigned32String(PrintCharRoutine, VA_ARG(Arguments, INT32), 10); BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT32), 10);
break; break;
case L'g': case L'g':
/* EFI GUID */ /* EFI GUID */
Guid = VA_ARG(Arguments, PEFI_GUID); Guid = VA_ARG(Arguments, PEFI_GUID);
BmpFormatString(PrintCharRoutine, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", Guid->Data1, BlpStringFormat(PrintCharRoutine, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", Guid->Data1,
Guid->Data2, Guid->Data3, Guid->Data4[0], Guid->Data4[1], Guid->Data4[2], Guid->Data2, Guid->Data3, Guid->Data4[0], Guid->Data4[1], Guid->Data4[2],
Guid->Data4[3], Guid->Data4[4], Guid->Data4[5], Guid->Data4[6], Guid->Data4[7]); Guid->Data4[3], Guid->Data4[4], Guid->Data4[5], Guid->Data4[6], Guid->Data4[7]);
break; break;
@ -69,15 +69,15 @@ BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine,
{ {
case L'd': case L'd':
/* Signed 64-bit integer */ /* Signed 64-bit integer */
BmpPrintSigned64String(PrintCharRoutine, VA_ARG(Arguments, INT_PTR), 10); BlpStringPrintSigned64(PrintCharRoutine, VA_ARG(Arguments, INT_PTR), 10);
break; break;
case L'u': case L'u':
/* Unsigned 64-bit integer */ /* Unsigned 64-bit integer */
BmpPrintUnsigned64String(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 10, 0); BlpStringPrintUnsigned64(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 10, 0);
break; break;
case L'x': case L'x':
/* Unsigned 64-bit hexadecimal integer */ /* Unsigned 64-bit hexadecimal integer */
BmpPrintUnsigned64String(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 16, 0); BlpStringPrintUnsigned64(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 16, 0);
break; break;
default: default:
/* Unknown by default */ /* Unknown by default */
@ -87,7 +87,7 @@ BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine,
break; break;
case L'p': case L'p':
/* Pointer address */ /* Pointer address */
BmpPrintUnsigned64String(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 16, 0); BlpStringPrintUnsigned64(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 16, 0);
break; break;
case L's': case L's':
/* String of characters */ /* String of characters */
@ -106,21 +106,21 @@ BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine,
break; break;
case L'u': case L'u':
/* Unsigned 32-bit integer */ /* Unsigned 32-bit integer */
BmpPrintUnsigned32String(PrintCharRoutine, VA_ARG(Arguments, UINT32), 10, 0); BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 10, 0);
break; break;
case L'x': case L'x':
/* Unsigned 32-bit hexadecimal integer */ /* Unsigned 32-bit hexadecimal integer */
BmpPrintUnsigned32String(PrintCharRoutine, VA_ARG(Arguments, UINT32), 16, 0); BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 16, 0);
break; break;
case L'0': case L'0':
/* Zero padded numbers */ /* Zero padded numbers */
++Format; ++Format;
PaddingCount = BmpReadStringPadding(&Format); PaddingCount = BlpStringReadPadding(&Format);
switch(*Format) switch(*Format)
{ {
case L'd': case L'd':
/* Zero-padded, signed 32-bit integer */ /* Zero-padded, signed 32-bit integer */
BmpPrintSigned32String(PrintCharRoutine, VA_ARG(Arguments, INT32), 10); BlpStringPrintSigned32(PrintCharRoutine, VA_ARG(Arguments, INT32), 10);
break; break;
case L'l': case L'l':
/* 64-bit numbers */ /* 64-bit numbers */
@ -128,15 +128,15 @@ BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine,
{ {
case L'd': case L'd':
/* Zero-padded, signed 64-bit integer */ /* Zero-padded, signed 64-bit integer */
BmpPrintSigned64String(PrintCharRoutine, VA_ARG(Arguments, INT_PTR), 10); BlpStringPrintSigned64(PrintCharRoutine, VA_ARG(Arguments, INT_PTR), 10);
break; break;
case L'u': case L'u':
/* Zero-padded, unsigned 64-bit integer */ /* Zero-padded, unsigned 64-bit integer */
BmpPrintUnsigned64String(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 10, PaddingCount); BlpStringPrintUnsigned64(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 10, PaddingCount);
break; break;
case L'x': case L'x':
/* Zero-padded, unsigned 64-bit hexadecimal integer */ /* Zero-padded, unsigned 64-bit hexadecimal integer */
BmpPrintUnsigned64String(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 16, PaddingCount); BlpStringPrintUnsigned64(PrintCharRoutine, VA_ARG(Arguments, UINT_PTR), 16, PaddingCount);
break; break;
default: default:
/* Unknown by default */ /* Unknown by default */
@ -146,11 +146,11 @@ BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine,
break; break;
case L'u': case L'u':
/* Zero-padded, unsigned 32-bit integer */ /* Zero-padded, unsigned 32-bit integer */
BmpPrintUnsigned32String(PrintCharRoutine, VA_ARG(Arguments, UINT32), 10, PaddingCount); BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 10, PaddingCount);
break; break;
case L'x': case L'x':
/* Zero-padded, unsigned 32-bit hexadecimal integer */ /* Zero-padded, unsigned 32-bit hexadecimal integer */
BmpPrintUnsigned32String(PrintCharRoutine, VA_ARG(Arguments, UINT32), 16, PaddingCount); BlpStringPrintUnsigned32(PrintCharRoutine, VA_ARG(Arguments, UINT32), 16, PaddingCount);
break; break;
default: default:
/* Unknown by default */ /* Unknown by default */
@ -202,7 +202,7 @@ BmPrintString(IN IN BMPRINTCHAR PrintCharRoutine,
*/ */
XTCDECL XTCDECL
VOID VOID
BmpFormatString(IN BMPRINTCHAR PrintCharRoutine, BlpStringFormat(IN BMPRINTCHAR PrintCharRoutine,
IN PUINT16 Format, IN PUINT16 Format,
IN ...) IN ...)
{ {
@ -212,7 +212,7 @@ BmpFormatString(IN BMPRINTCHAR PrintCharRoutine,
VA_START(Arguments, Format); VA_START(Arguments, Format);
/* Format and print the string to the desired output */ /* Format and print the string to the desired output */
BmPrintString(PrintCharRoutine, Format, Arguments); BlpStringPrint(PrintCharRoutine, Format, Arguments);
/* Clean up the va_list */ /* Clean up the va_list */
VA_END(Arguments); VA_END(Arguments);
@ -236,7 +236,7 @@ BmpFormatString(IN BMPRINTCHAR PrintCharRoutine,
*/ */
XTCDECL XTCDECL
VOID VOID
BmpPrintSigned32String(IN BMPRINTCHAR PrintCharRoutine, BlpStringPrintSigned32(IN BMPRINTCHAR PrintCharRoutine,
IN INT Number, IN INT Number,
IN UINT Base) IN UINT Base)
{ {
@ -248,7 +248,7 @@ BmpPrintSigned32String(IN BMPRINTCHAR PrintCharRoutine,
} }
/* Print the integer value */ /* Print the integer value */
BmpPrintUnsigned32String(PrintCharRoutine, Number, Base, 0); BlpStringPrintUnsigned32(PrintCharRoutine, Number, Base, 0);
} }
/** /**
@ -269,7 +269,7 @@ BmpPrintSigned32String(IN BMPRINTCHAR PrintCharRoutine,
*/ */
XTCDECL XTCDECL
VOID VOID
BmpPrintSigned64String(IN BMPRINTCHAR PrintCharRoutine, BlpStringPrintSigned64(IN BMPRINTCHAR PrintCharRoutine,
IN INT_PTR Number, IN INT_PTR Number,
IN UINT_PTR Base) IN UINT_PTR Base)
{ {
@ -281,7 +281,7 @@ BmpPrintSigned64String(IN BMPRINTCHAR PrintCharRoutine,
} }
/* Print the integer value */ /* Print the integer value */
BmpPrintUnsigned64String(PrintCharRoutine, Number, Base, 0); BlpStringPrintUnsigned64(PrintCharRoutine, Number, Base, 0);
} }
/** /**
@ -305,7 +305,7 @@ BmpPrintSigned64String(IN BMPRINTCHAR PrintCharRoutine,
*/ */
XTCDECL XTCDECL
VOID VOID
BmpPrintUnsigned32String(IN BMPRINTCHAR PrintCharRoutine, BlpStringPrintUnsigned32(IN BMPRINTCHAR PrintCharRoutine,
IN UINT Number, IN UINT Number,
IN UINT Base, IN UINT Base,
IN UINT Padding) IN UINT Padding)
@ -321,7 +321,7 @@ BmpPrintUnsigned32String(IN BMPRINTCHAR PrintCharRoutine,
*--Pointer = 0; *--Pointer = 0;
do do
{ {
*--Pointer = BmpHexTable[Number % Base]; *--Pointer = BlpHexTable[Number % Base];
} while(Pointer >= Buffer && (Number /= Base)); } while(Pointer >= Buffer && (Number /= Base));
/* Calculate number length */ /* Calculate number length */
@ -366,7 +366,7 @@ BmpPrintUnsigned32String(IN BMPRINTCHAR PrintCharRoutine,
*/ */
XTCDECL XTCDECL
VOID VOID
BmpPrintUnsigned64String(IN BMPRINTCHAR PrintCharRoutine, BlpStringPrintUnsigned64(IN BMPRINTCHAR PrintCharRoutine,
IN UINT_PTR Number, IN UINT_PTR Number,
IN UINT_PTR Base, IN UINT_PTR Base,
IN UINT_PTR Padding) IN UINT_PTR Padding)
@ -382,7 +382,7 @@ BmpPrintUnsigned64String(IN BMPRINTCHAR PrintCharRoutine,
*--Pointer = 0; *--Pointer = 0;
do do
{ {
*--Pointer = BmpHexTable[Number % Base]; *--Pointer = BlpHexTable[Number % Base];
} while(Pointer >= Buffer && (Number /= Base)); } while(Pointer >= Buffer && (Number /= Base));
/* Calculate number length */ /* Calculate number length */
@ -418,7 +418,7 @@ BmpPrintUnsigned64String(IN BMPRINTCHAR PrintCharRoutine,
*/ */
XTCDECL XTCDECL
UINT64 UINT64
BmpReadStringPadding(IN PUINT16 *Format) BlpStringReadPadding(IN PUINT16 *Format)
{ {
ULONG Count = 0; ULONG Count = 0;
PUINT16 Fmt = *Format; PUINT16 Fmt = *Format;

View File

@ -2,7 +2,7 @@
* PROJECT: ExectOS * PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory * COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtldr/xtldr.c * FILE: xtldr/xtldr.c
* DESCRIPTION: XTOS UEFI Boot Manager * DESCRIPTION: XTOS UEFI Boot Loader
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org> * DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/ */
@ -10,7 +10,7 @@
/** /**
* This routine is the entry point of the XT EFI boot manager. * This routine is the entry point of the XT EFI boot loader.
* *
* @param ImageHandle * @param ImageHandle
* Firmware-allocated handle that identifies the image. * Firmware-allocated handle that identifies the image.
@ -24,7 +24,7 @@
*/ */
XTCDECL XTCDECL
EFI_STATUS EFI_STATUS
BmStartXtLoader(IN EFI_HANDLE ImageHandle, BlStartXtLoader(IN EFI_HANDLE ImageHandle,
IN PEFI_SYSTEM_TABLE SystemTable) IN PEFI_SYSTEM_TABLE SystemTable)
{ {
EFI_STATUS Status; EFI_STATUS Status;