limine_protocol/requests/efi_sys_table.rs
1use core::ptr::NonNull;
2
3use crate::responses::EfiSystemTableResponse;
4
5limine_request! {
6 #[repr(C)]
7 #[derive(Debug)]
8 /// Request the address of the EFI System Table
9 pub struct EfiSystemTableRequest: [0x5ceb_a516_3eaa_f6d6, 0x0a69_8161_0cf6_5fcc] {
10 /// Response pointer
11 pub response: Option<NonNull<EfiSystemTableResponse>>,
12 }
13}
14
15impl EfiSystemTableRequest {
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<&EfiSystemTableResponse> {
24 Some(self.response?.as_ref())
25 }
26}