1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::structures::memory_map_entry::MemoryMapEntry;
#[repr(C)]
#[derive(Debug)]
pub struct MemoryMapResponse {
pub revision: u64,
pub entry_count: u64,
pub entries: *const *const MemoryMapEntry,
}
impl MemoryMapResponse {
pub unsafe fn get_memory_map(&self) -> Option<&[&MemoryMapEntry]> {
if self.entries.is_null() {
return None;
}
Some(core::slice::from_raw_parts(
self.entries as *const &MemoryMapEntry,
self.entry_count as usize,
))
}
}