Move all globals into separate file
This commit is contained in:
parent
1a932468a2
commit
a2af4841da
@ -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
31
xtldr/globals.c
Normal 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;
|
@ -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;
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user