init version

This commit is contained in:
2026-02-20 22:17:31 +01:00
commit c4c1a4350c
28 changed files with 755 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
pub const HEADER_MAGIC: u32 = 0xe85250d6;
#[repr(C, packed)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct Header {
magic: u32,
arch: HeaderArchitecture,
length: u32,
checksum: i32,
// optional flags
typ: u16,
flags: u16,
size: u32,
}
impl Header {
pub const fn new() -> Self {
let length = size_of::<Self>() as _;
let arch = HeaderArchitecture::ProtectedI386;
Header {
magic: HEADER_MAGIC,
arch,
length,
checksum: -(HEADER_MAGIC as i32 + length as i32 + arch as u32 as i32),
typ: 0,
flags: 0,
size: 0,
}
}
}
impl Default for Header {
fn default() -> Self {
Self::new()
}
}
#[repr(u32)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum HeaderArchitecture {
ProtectedI386 = 0,
}