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