Add new includes for Syncboot rewrite.

This commit is contained in:
Curle 2019-07-20 20:15:45 +01:00
parent 83bc1aab50
commit 581dd05244
2 changed files with 3939 additions and 0 deletions

96
inc/BL.h Normal file
View File

@ -0,0 +1,96 @@
#pragma once
#include <efi.h>
#include <efilib.h>
#include <pe.h>
#include <ELF.h>
#define MAJOR_VER 1
#define MINOR_VER 0
#define DOS_EXECUTABLE 0x622
/* ==================== DEBUGGING CODE ==================== */
#ifdef DEBUG
#define METADATA_SHOW
#define WATCHDOG_TIMER_DISABLE
#define MAIN_DEBUG
#define GFX_DEBUG_MAIN
#define GFX_DEBUG_NAMING
#define LOADER_DEBUG_MAIN
#define LOADER_DEBUG_PE
#define LOADER_DEBUG_DOS
#define LOADER_DEBUG_ELF
#define LOADER_DEBUG_FINAL
#define MEMORY_SHOW
#define MEMORY_CHECK
#endif
/* ==================== Text File Magic Numbers ==================== */
/* Required to make sure that the configuration file is encoded properly.
* The magic number is set automatically by all text editors, including Notepad. */
#define UTF8_BOM_LE 0xBFBBEF // Little Endian
#define UTF8_BOM_BE 0xEFBBBF // Big Endian
#define UTF16_BOM_LE 0xFEFF
#define UTF16_BOM_BE 0xFFFE
/* ==================== Fileloader Structs ==================== */
/* These are the structs passed to the kernel file when it's called by the bootloader.
* More information about this can be found in main.c */
typedef struct {
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE* GPUs; // Information about each graphics output unit (one or more per GPU)
size_t FBCount; // The amount of framebuffers available.
} GFX_INFO;
typedef struct {
uint32_t UEFI_Version; // Version of the firmware running
uint32_t Bootloader_MajorVersion; // Major and
uint32_t Bootloader_MinorVersion; // minor version of the bootloader itself.
uint32_t Memory_Descriptor_Version;
size_t Memory_Descriptor_Size; // Size of each memory descriptor
EFI_MEMORY_DESCRIPTOR* Memory_Map; // System memory map, as an array of EFI_MEMORY_DESCRIPTORs
size_t Memory_Map_Size; // Total size of the memory map
EFI_PHYSICAL_ADDRESS Kernel_Base; // The physical (absolute) address of the start of the kernel
size_t Kernel_Pages; // How many pages (of 4KiB) the kernel takes up
CHAR16* ESP_Path; // The drive root of the EFI System Partition
size_t ESP_Path_Length; // Size in bytes of the ESP_Path string
CHAR16* Kernel_Path; // Kernel's file path relative to the ESP_Path
size_t Kernel_Path_Length; // Size in bytes of the Kernel_Path string
CHAR16* Kernel_Options; // Options given to the kernel, taken from the 2nd line of the
size_t Kernel_Options_Length; // Size in bytes of the Kernel_Options string
EFI_RUNTIME_SERVICES* RTServices; // The UEFI Runtime Services
GFX_INFO* GPU_INFO; // Information about all available graphics devices
EFI_FILE_INFO* FileMeta; // Kernel file metadata
EFI_CONFIGURATION_TABLE* ConfigTables; // UEFI system configuration tables
size_t ConfigTables_Length;
} FILELOADER_PARAMS;
/* ==================== FUNCTION PROTOTYPES ==================== */
EFI_STATUS AwaitKey(CHAR16* Str);
uint8_t Compare(const void* a, const void* b, size_t length);
EFI_STATUS InitGfx(EFI_HANDLE ImageHandle, GFX_INFO* Gfx);
EFI_STATUS LoadKernel(EFI_HANDLE ImageHandle, GFX_INFO* Gfx, EFI_CONFIGURATION_TABLE* ConfigTables, size_t NumConfigTables, uint32_t UEFIVer);
uint8_t VerifyZero(size_t Length, size_t Base);
EFI_PHYSICAL_ADDRESS FindFreeAddress(size_t pages, EFI_PHYSICAL_ADDRESS Base);
EFI_PHYSICAL_ADDRESS FreeAddressByPage(size_t pages, EFI_PHYSICAL_ADDRESS Base);
void PrintMemoryMap(void);
#ifdef GFX_DEBUG_NAMING
EFI_STATUS WhatProtocols(EFI_HANDLE* HandleArray, size_t NumHandles);
#endif

3843
inc/ELF.h Normal file

File diff suppressed because it is too large Load Diff