|
1 | 1 | use crate::memory_map::MemoryRegion;
|
2 | 2 | use core::slice;
|
3 | 3 |
|
| 4 | +/// This structure represents the information that the bootloader passes to the kernel. |
| 5 | +/// |
| 6 | +/// The information is passed as an argument to the entry point. The entry point function must |
| 7 | +/// have the following signature: |
| 8 | +/// |
| 9 | +/// ```ignore |
| 10 | +/// pub extern "C" fn(boot_info: &'static BootInfo) -> !; |
| 11 | +/// ``` |
| 12 | +/// |
| 13 | +/// Note that no type checking occurs for the entry point function, so be careful to |
| 14 | +/// use the correct argument types. To ensure that the entry point function has the correct |
| 15 | +/// signature, use the [`entry_point`] macro. |
4 | 16 | #[derive(Debug)]
|
5 | 17 | pub struct BootInfo {
|
| 18 | + /// A map of the physical memory regions of the underlying machine. |
| 19 | + /// |
| 20 | + /// The bootloader queries this information from the BIOS/UEFI firmware and translates this |
| 21 | + /// information to Rust types. It also marks any memory regions that the bootloader uses in |
| 22 | + /// the memory map before passing it to the kernel. Regions marked as usable can be freely |
| 23 | + /// used by the kernel. |
6 | 24 | pub memory_regions: &'static mut [MemoryRegion],
|
| 25 | + /// Information about the framebuffer for screen output if available. |
7 | 26 | pub framebuffer: Option<FrameBuffer>,
|
| 27 | + /// The virtual address at which the mapping of the physical memory starts. |
| 28 | + /// |
| 29 | + /// Physical addresses can be converted to virtual addresses by adding this offset to them. |
| 30 | + /// |
| 31 | + /// The mapping of the physical memory allows to access arbitrary physical frames. Accessing |
| 32 | + /// frames that are also mapped at other virtual addresses can easily break memory safety and |
| 33 | + /// cause undefined behavior. Only frames reported as `USABLE` by the memory map in the `BootInfo` |
| 34 | + /// can be safely accessed. |
| 35 | + /// |
| 36 | + /// Only available if the `map-physical-memory` config option is enabled. |
8 | 37 | pub physical_memory_offset: Option<u64>,
|
| 38 | + /// The virtual address of the recursively mapped level 4 page table. |
| 39 | + /// |
| 40 | + /// Only available if the `map-page-table-recursively` config option is enabled. |
9 | 41 | pub recursive_index: Option<u16>,
|
| 42 | + /// The address of the `RSDP` data structure, which can be use to find the ACPI tables. |
| 43 | + /// |
| 44 | + /// This field is `None` if no `RSDP` was found (for BIOS) or reported (for UEFI). |
10 | 45 | pub rsdp_addr: Option<u64>,
|
| 46 | + /// The thread local storage (TLS) template of the kernel executable, if present. |
11 | 47 | pub tls_template: Option<TlsTemplate>,
|
12 | 48 | pub(crate) _non_exhaustive: (),
|
13 | 49 | }
|
|
0 commit comments