diff --git a/xtldr/CMakeLists.txt b/xtldr/CMakeLists.txt index fa8a726..4abdd36 100644 --- a/xtldr/CMakeLists.txt +++ b/xtldr/CMakeLists.txt @@ -15,6 +15,7 @@ list(APPEND XTLDR_SOURCE ${XTLDR_SOURCE_DIR}/blproto.c ${XTLDR_SOURCE_DIR}/console.c ${XTLDR_SOURCE_DIR}/efiutil.c + ${XTLDR_SOURCE_DIR}/globals.c ${XTLDR_SOURCE_DIR}/memory.c ${XTLDR_SOURCE_DIR}/string.c ${XTLDR_SOURCE_DIR}/system.c diff --git a/xtldr/globals.c b/xtldr/globals.c new file mode 100644 index 0000000..04d0740 --- /dev/null +++ b/xtldr/globals.c @@ -0,0 +1,31 @@ +/** + * PROJECT: ExectOS + * COPYRIGHT: See COPYING.md in the top level directory + * FILE: xtldr/globals.c + * DESCRIPTION: XT Boot Loader global variables + * DEVELOPERS: Rafal Kupiec + */ + +#include + + +/* List of available block devices */ +LIST_ENTRY EfiBlockDevices; + +/* XT Boot Loader hex table */ +STATIC PUINT16 EfiHexTable = L"0123456789ABCDEF"; + +/* EFI Image Handle */ +EFI_HANDLE EfiImageHandle; + +/* XT Boot Loader protocol */ +XT_BOOT_LOADER_PROTOCOL EfiLdrProtocol; + +/* EFI System Table */ +PEFI_SYSTEM_TABLE EfiSystemTable; + +/* EFI Secure Boot status */ +INT_PTR EfiSecureBoot; + +/* Serial port configuration */ +CPPORT EfiSerialPort; diff --git a/xtldr/includes/xtbl.h b/xtldr/includes/xtbl.h index 8ede8a4..40ccc62 100644 --- a/xtldr/includes/xtbl.h +++ b/xtldr/includes/xtbl.h @@ -14,6 +14,12 @@ #include +/* List of available block devices */ +EXTERN LIST_ENTRY EfiBlockDevices; + +/* XT Boot Loader hex table */ +EXTERN PUINT16 EfiHexTable; + /* EFI Image Handle */ EXTERN EFI_HANDLE EfiImageHandle; diff --git a/xtldr/string.c b/xtldr/string.c index d815a3b..c555999 100644 --- a/xtldr/string.c +++ b/xtldr/string.c @@ -9,8 +9,6 @@ #include -STATIC PUINT16 HexTable = L"0123456789ABCDEF"; - /** * Compares two strings without sensitivity to case. * @@ -375,7 +373,7 @@ BlpStringPrintUnsigned32(IN VOID PutChar(IN USHORT Character), *--Pointer = 0; do { - *--Pointer = HexTable[Number % Base]; + *--Pointer = EfiHexTable[Number % Base]; } while(Pointer >= Buffer && (Number /= Base)); /* Calculate number length */ @@ -432,7 +430,7 @@ BlpStringPrintUnsigned64(IN VOID PutChar(IN USHORT Character), *--Pointer = 0; do { - *--Pointer = HexTable[Number % Base]; + *--Pointer = EfiHexTable[Number % Base]; } while(Pointer >= Buffer && (Number /= Base)); /* Calculate number length */ diff --git a/xtldr/volume.c b/xtldr/volume.c index f84a240..c6609cf 100644 --- a/xtldr/volume.c +++ b/xtldr/volume.c @@ -9,9 +9,6 @@ #include -/* List of available block devices */ -LIST_ENTRY BlBlockDevices; - /** * This routine closes an EFI volume handle. * @@ -67,7 +64,7 @@ BlEnumerateEfiBlockDevices() /* Initialize list entries */ RtlInitializeListHead(&BlockDevices); - RtlInitializeListHead(&BlBlockDevices); + RtlInitializeListHead(&EfiBlockDevices); /* Discover EFI block devices and store them in linked list */ Status = BlpDiscoverEfiBlockDevices(&BlockDevices); @@ -184,7 +181,7 @@ BlEnumerateEfiBlockDevices() BlockDevice->PartitionGuid = PartitionGuid; /* Add block device to global list */ - RtlInsertTailList(&BlBlockDevices, &BlockDevice->ListEntry); + RtlInsertTailList(&EfiBlockDevices, &BlockDevice->ListEntry); } /* Get next entry from linked list */ @@ -366,8 +363,8 @@ BlGetVolumeDevicePath(IN PUCHAR SystemPath, } /* Look for block device corresponding to dissected ARC path */ - ListEntry = BlBlockDevices.Flink; - while(ListEntry != &BlBlockDevices) + ListEntry = EfiBlockDevices.Flink; + while(ListEntry != &EfiBlockDevices) { /* Check if this is the volume we are looking for */ Device = CONTAIN_RECORD(ListEntry, EFI_BLOCK_DEVICE, ListEntry); diff --git a/xtldr/xtldr.c b/xtldr/xtldr.c index 2ef07d6..09bf22f 100644 --- a/xtldr/xtldr.c +++ b/xtldr/xtldr.c @@ -9,22 +9,6 @@ #include -/* EFI Image Handle */ -EFI_HANDLE EfiImageHandle; - -/* XT Boot Loader protocol */ -XT_BOOT_LOADER_PROTOCOL EfiLdrProtocol; - -/* EFI System Table */ -PEFI_SYSTEM_TABLE EfiSystemTable; - -/* EFI Secure Boot status */ -INT_PTR EfiSecureBoot; - -/* Serial port configuration */ -CPPORT EfiSerialPort; - - /** * This routine loads XTLDR EFI modules. *