limine_protocol/requests/memory_map.rs
1use core::ptr::NonNull;
2
3use crate::responses::MemoryMapResponse;
4
5limine_request! {
6 #[repr(C)]
7 #[derive(Debug)]
8 /// Request for receiving the Memory Map from the bootloader
9 pub struct MemoryMapRequest: [0x67cf_3d9d_378a_806f, 0xe304_acdf_c50c_3c62] {
10 /// Response pointer
11 pub response: Option<NonNull<MemoryMapResponse>>,
12 }
13}
14
15impl MemoryMapRequest {
16 /// Get the response as a reference, if it's present.
17 ///
18 /// # Safety
19 /// The backing memory must not have been invalidated by the kernel,
20 /// either by writing to the physical memory, changing where it's mapped, or
21 /// unmapping it.
22 #[must_use]
23 pub unsafe fn get_response(&self) -> Option<&MemoryMapResponse> {
24 Some(self.response?.as_ref())
25 }
26}