Move all globals into separate file
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 30s
Builds / ExectOS (i686) (push) Successful in 30s

This commit is contained in:
Rafal Kupiec 2023-11-16 17:20:20 +01:00
parent 1a932468a2
commit a2af4841da
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
6 changed files with 44 additions and 27 deletions

View File

@ -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

31
xtldr/globals.c Normal file
View File

@ -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 <belliash@codingworkshop.eu.org>
*/
#include <xtbl.h>
/* 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;

View File

@ -14,6 +14,12 @@
#include <blmod.h>
/* List of available block devices */
EXTERN LIST_ENTRY EfiBlockDevices;
/* XT Boot Loader hex table */
EXTERN PUINT16 EfiHexTable;
/* EFI Image Handle */
EXTERN EFI_HANDLE EfiImageHandle;

View File

@ -9,8 +9,6 @@
#include <xtbl.h>
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 */

View File

@ -9,9 +9,6 @@
#include <xtbl.h>
/* 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);

View File

@ -9,22 +9,6 @@
#include <xtbl.h>
/* 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.
*