limine_protocol/structures/memory_map_entry.rs
1#[repr(u64)]
2#[derive(Debug, PartialEq, Eq)]
3/// Possible types of Memory Map Entries
4pub enum EntryType {
5 /// Usable
6 Usable = 0,
7 /// Reserved
8 Reserved = 1,
9 /// Reclaimable after parsing ACPI Tables
10 AcpiReclaimable = 2,
11 /// Non-volatile storage for ACPI
12 AcpiNonVolatile = 3,
13 /// Bad memory
14 BadMemory = 4,
15 /// Reclaimable after the bootloader structures are no longer required
16 BootloaderReclaimable = 5,
17 /// Used by the Kernel and Modules
18 KernelAndModules = 6,
19 /// Allocated for a Framebuffer
20 Framebuffer = 7,
21}
22
23#[repr(C)]
24#[derive(Debug, PartialEq, Eq)]
25/// Entry in the Memory Map
26pub struct MemoryMapEntry {
27 /// The base address of the entry
28 pub base: u64,
29 /// The length of the entry
30 pub length: u64,
31 /// The type of the entry
32 pub kind: EntryType,
33}
34
35impl MemoryMapEntry {
36 /// The ending address of the memory map entry
37 #[must_use]
38 pub const fn end(&self) -> u64 {
39 self.base + self.length
40 }
41}