#pragma once // ============================================================================ // boot_info.h - Boot handoff struct // Shared between the UEFI loader and the kernel. // The loader fills it, the kernel consumes it. Simple. // In future i will expand this struct // ============================================================================ #include // ── Boot Magic Number─────────────────────────────────────────────────────── inline constexpr uint64_t BOOT_INFO_MAGIC = 0xDEADDEADDEADDEADULL; // ── Framebuffer (GOP) ─────────────────────────────────────────────────────── // TODO: remove Framebuffer to driver enum class PixelFormat : uint32_t { RGB = 0, // PixelRedGreenBlueReserved8BitPerColor BGR = 1, // PixelBlueGreenRedReserved8BitPerColor Mask = 2, // PixelBitMask — need to check masks }; struct FramebufferInfo { uint64_t base; // Physical address of framebuffer uint32_t width; // Horizontal resolution in pixels uint32_t height; // Vertical resolution in pixels uint32_t pitch; // Bytes per scanline (>= width * 4) PixelFormat format; }; // ── Memory map ───────────────────────────────────────────────────────────── //TODO: remove FrameBuffer enum class MemoryRegionType : uint32_t { Usable = 0, // Free RAM - kernel can use Reserved = 1, // Firmware/hardware reserved AcpiReclaimable = 2, // ACPI tables - free after parsing AcpiNvs = 3, // ACPI non-volatile storage BootloaderReclaimable = 4, // Loader code/data - free after kernel init KernelAndModules = 5, // Kernel image + any loaded modules Framebuffer = 6, // Framebuffer memory - do not use as RAM }; struct MemoryRegion { uint64_t base; uint64_t length; MemoryRegionType type; uint32_t _reserved; // Padding to 24 bytes }; // ── Boot info structure ──────────────────────────────────────────────────── struct BootInfo { uint64_t magic; // Must be BOOT_INFO_MAGIC // Framebuffer // Todo: remove FramebufferInfo framebuffer; // Memory map (array of MemoryRegion) MemoryRegion* memory_map; uint64_t memory_map_count; // Platform-specific firmware tables (both always present to keep layout uniform) uint64_t rsdp_address; // ACPI RSDP (x86_64), 0 if absent uint64_t fdt_address; // Flattened Device Tree (aarch64), 0 if absent // Kernel load info uint64_t kernel_phys_base; // Where the kernel was loaded physically uint64_t kernel_virt_base; // Kernel's virtual base (from ELF) uint64_t kernel_size; // Total size of kernel in memory // Kernel entry point (virtual address from ELF e_entry) uint64_t kernel_entry_point; // Higher-half direct map base (if set up by loader) uint64_t hhdm_base; // e.g., 0xFFFF800000000000 // Kernel command line (null-terminated string, or nullptr if none) // The loader can read this from a config file on the ESP. const char* cmdline; // e.g., "verbose nosmp mem=256M" };