/*
    * Boot.hpp
    * Kernel-side accessor for the Montauk Boot Contract
    * Copyright (c) 2026 Daniel Hammer
*/

#pragma once
#include "BootInfo.hpp"

namespace montauk::boot {

    // Acquire the boot contract from the active bootloader adapter and
    // validate that the always-required fields are present.
    //
    // Returns false ONLY for failures the kernel cannot even report (the
    // adapter rejected the environment, or no usable framebuffer for the
    // console exists) -- the caller should Halt() in that case.  Missing
    // *required* data that is severe but post-console (e.g. no memory map)
    // raises a Panic with a descriptive message instead.
    //
    // Must be called exactly once, very early in kmain(), after global
    // constructors but before any consumer of boot data.
    bool Initialize();

    // The validated boot contract.  Only valid after Initialize() returns
    // true.  Returned by const reference: the BootInfo value is immutable,
    // but the bootloader-owned arrays it points at (e.g. smp.cpus) remain
    // mutable through their pointers, which is what AP startup needs.
    const BootInfo& Info();

}
