#![allow(unused)]
#![no_std]

use bytemuck::{Pod, Zeroable};

pub mod v1;

pub use v1::LoadProtocol as LoadProtocolV1;

pub const KERNEL_MAGIC: u32 = 0x1A2B3C4D;
pub const LOADER_MAGIC: u32 = 0xD4C3B2A1;
pub const PROTOCOL_VERSION_1: u32 = 1;

#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
pub struct LoadProtocolHeader {
    pub kernel_magic: u32,
    pub version: u32,
}

pub trait AvailableRegion {
    fn start_address(&self) -> usize;
    fn page_count(&self) -> usize;
}

pub trait IterableMemoryMap<'a> {
    type Entry: AvailableRegion + 'a;
    type Iter: Iterator<Item = &'a Self::Entry> + Clone;

    fn iter(&self) -> Self::Iter {
        self.iter_with_offset(0)
    }

    fn iter_with_offset(&self, offset: usize) -> Self::Iter;

    fn data_physical_base(&self) -> usize;
    fn data_size(&self) -> usize;
}
