Files
nt-lite/code/public/ntlite/boot_info.h
T

100 lines
2.6 KiB
C

// Public NTLite boot info ABI declarations shared between the bootloader and kernel.
#pragma once
#include <stdint.h>
#include <ntlite/memory_map.h>
// Encodes the ASCII tag 'BOOTINFO'.
#define BOOT_INFO_MAGIC 0x424F4F54494E464FULL
#define BOOT_INFO_VERSION 3u
#define BOOT_FILE_NAME_MAX 64u
#define BOOT_TIME_FLAG_VALID 0x0001u
#define BOOT_TIME_FLAG_TZ_KNOWN 0x0002u
#define BOOT_TIME_FLAG_UEFI 0x0004u
#define BOOT_TIME_FLAG_FALLBACK 0x0008u
#define BOOT_TIME_FLAG_RTC 0x0010u
#define BOOT_TIME_UNSPECIFIED_TZ 2047
typedef struct BOOT_TIME {
uint16_t Year;
uint8_t Month;
uint8_t Day;
uint8_t Hour;
uint8_t Minute;
uint8_t Second;
uint8_t Daylight;
uint32_t Nanosecond;
int16_t TimeZoneMinutes;
uint16_t Flags;
uint32_t Reserved;
} BOOT_TIME;
// Describes a page-backed raw file that remains owned by the boot handoff.
typedef struct BOOT_BLOB {
uintptr_t PhysicalBase;
uint32_t Length;
uint32_t PageCount;
} BOOT_BLOB;
// Describes a boot driver raw file passed to the kernel without mapping it as an image.
typedef struct BOOT_FILE {
char Name[BOOT_FILE_NAME_MAX];
uintptr_t PhysicalBase;
uint32_t Length;
uint32_t PageCount;
} BOOT_FILE;
// Describes the page-backed BOOT_FILE array produced from drivers.ini [boot].
typedef struct BOOT_FILE_LIST {
uintptr_t FilesPhysical;
uint32_t Count;
uint32_t PageCount;
} BOOT_FILE_LIST;
// Describes one fixed-base PE image materialized by the bootloader.
typedef struct BOOT_IMAGE {
uintptr_t VirtualBase;
uintptr_t PhysicalBase;
uint32_t ImageSize;
uint32_t PageCount;
uint32_t EntryRva;
uint32_t Reserved;
} BOOT_IMAGE;
typedef struct BOOT_INFO {
uint64_t Magic;
uint32_t Size;
uint32_t Version;
// Physical memory translated from the final firmware memory map.
MEMORY_MAP MemoryMap;
// GOP framebuffer.
uintptr_t FramebufferBase;
uint32_t FramebufferWidth;
uint32_t FramebufferHeight;
uint32_t FramebufferStride;
uint32_t Reserved0;
// Fixed core images and raw boot inputs.
BOOT_IMAGE KernelImage;
BOOT_IMAGE HalImage;
BOOT_BLOB BootIni;
BOOT_FILE_LIST BootDrivers;
// ACPI RSDP physical address.
uintptr_t RsdpPhysical;
// Direct physical window base - always 0xFFFF880000000000.
uintptr_t PhysicalMapBase;
// Reserved low-memory page for the AP startup trampoline, or zero.
uintptr_t ApTrampolinePhys;
// Firmware wall-clock snapshot taken before ExitBootServices.
BOOT_TIME BootTime;
} BOOT_INFO;