limine_protocol/responses/
memory_map.rs1use crate::structures::memory_map_entry::MemoryMapEntry;
2
3#[repr(C)]
4#[derive(Debug)]
5pub struct MemoryMapResponse {
7 pub revision: u64,
9 pub entry_count: u64,
11 pub entries: *const *const MemoryMapEntry,
13}
14
15impl MemoryMapResponse {
16 #[must_use]
21 pub unsafe fn get_memory_map(&self) -> Option<&[&MemoryMapEntry]> {
22 if self.entries.is_null() {
23 return None;
24 }
25 Some(core::slice::from_raw_parts(
26 self.entries.cast::<&MemoryMapEntry>(),
27 self.entry_count.try_into().ok()?,
28 ))
29 }
30}