116 lines
3.6 KiB
C
116 lines
3.6 KiB
C
// Public NTLite boot info ABI declarations shared between the bootloader and kernel.
|
|
|
|
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <ntlite/memory_map.h>
|
|
|
|
// Encodes the ASCII tag 'BOOTINFO'.
|
|
#define BOOT_INFO_MAGIC 0x424F4F54494E464FULL
|
|
#define BOOT_INFO_VERSION 4u
|
|
|
|
#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 DriverId[BOOT_FILE_NAME_MAX];
|
|
char Image[BOOT_FILE_NAME_MAX];
|
|
uintptr_t PhysicalBase;
|
|
uint32_t Length;
|
|
uint32_t PageCount;
|
|
} BOOT_FILE;
|
|
|
|
// Describes the page-backed, identified boot-driver array.
|
|
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_BLOB DriversIni;
|
|
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;
|
|
|
|
// BOOT_INFO is an x64 firmware-to-kernel binary handoff, not a private C structure.
|
|
_Static_assert(sizeof(uintptr_t) == 8u, "BOOT_INFO requires x64 pointers");
|
|
_Static_assert(sizeof(BOOT_TIME) == 20u, "BOOT_TIME ABI size changed");
|
|
_Static_assert(sizeof(BOOT_BLOB) == 16u, "BOOT_BLOB ABI size changed");
|
|
_Static_assert(sizeof(BOOT_FILE) == 144u, "BOOT_FILE ABI size changed");
|
|
_Static_assert(sizeof(BOOT_FILE_LIST) == 16u, "BOOT_FILE_LIST ABI size changed");
|
|
_Static_assert(sizeof(BOOT_IMAGE) == 32u, "BOOT_IMAGE ABI size changed");
|
|
_Static_assert(offsetof(BOOT_INFO, MemoryMap) == 16u, "BOOT_INFO MemoryMap offset changed");
|
|
_Static_assert(offsetof(BOOT_INFO, KernelImage) == 6200u, "BOOT_INFO KernelImage offset changed");
|
|
_Static_assert(offsetof(BOOT_INFO, BootDrivers) == 6296u, "BOOT_INFO BootDrivers offset changed");
|
|
_Static_assert(offsetof(BOOT_INFO, BootTime) == 6336u, "BOOT_INFO BootTime offset changed");
|
|
_Static_assert(sizeof(BOOT_INFO) == 6360u, "BOOT_INFO ABI size changed");
|