aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / uefi-raw / src / table / system.rs
| 1 | // SPDX-License-Identifier: MIT OR Apache-2.0 |
| 2 | |
| 3 | //! # UEFI System Table |
| 4 | |
| 5 | use crate::protocol::console::{SimpleTextInputProtocol, SimpleTextOutputProtocol}; |
| 6 | use crate::table::Header; |
| 7 | use crate::table::boot::BootServices; |
| 8 | use crate::table::configuration::ConfigurationTable; |
| 9 | use crate::table::runtime::RuntimeServices; |
| 10 | use crate::{Char16, Handle}; |
| 11 | use core::ptr; |
| 12 | |
| 13 | #[derive(Clone, Debug, Eq, PartialEq)] |
| 14 | #[repr(C)] |
| 15 | #[expect(missing_docs)] |
| 16 | pub struct SystemTable { |
| 17 | pub header: Header, |
| 18 | |
| 19 | pub firmware_vendor: *const Char16, |
| 20 | pub firmware_revision: u32, |
| 21 | |
| 22 | pub stdin_handle: Handle, |
| 23 | pub stdin: *mut SimpleTextInputProtocol, |
| 24 | |
| 25 | pub stdout_handle: Handle, |
| 26 | pub stdout: *mut SimpleTextOutputProtocol, |
| 27 | |
| 28 | pub stderr_handle: Handle, |
| 29 | pub stderr: *mut SimpleTextOutputProtocol, |
| 30 | |
| 31 | pub runtime_services: *mut RuntimeServices, |
| 32 | pub boot_services: *mut BootServices, |
| 33 | |
| 34 | pub number_of_configuration_table_entries: usize, |
| 35 | pub configuration_table: *mut ConfigurationTable, |
| 36 | } |
| 37 | |
| 38 | impl SystemTable { |
| 39 | /// Signature of the system table's [`Header`]. |
| 40 | pub const SIGNATURE: u64 = 0x5453_5953_2049_4249; |
| 41 | } |
| 42 | |
| 43 | impl Default for SystemTable { |
| 44 | /// Creates a `SystemTable` with most fields set to zero. |
| 45 | /// |
| 46 | /// The only fields not set to zero are: |
| 47 | /// * [`Header::signature`] is set to [`SystemTable::SIGNATURE`]. |
| 48 | /// * [`Header::size`] is set to the size in bytes of `SystemTable`. |
| 49 | fn default() -> Self { |
| 50 | Self { |
| 51 | header: Header { |
| 52 | signature: Self::SIGNATURE, |
| 53 | size: u32::try_from(size_of::<Self>()).unwrap(), |
| 54 | ..Header::default() |
| 55 | }, |
| 56 | |
| 57 | firmware_vendor: ptr::null_mut(), |
| 58 | firmware_revision: 0, |
| 59 | |
| 60 | stdin_handle: ptr::null_mut(), |
| 61 | stdin: ptr::null_mut(), |
| 62 | |
| 63 | stdout_handle: ptr::null_mut(), |
| 64 | stdout: ptr::null_mut(), |
| 65 | |
| 66 | stderr_handle: ptr::null_mut(), |
| 67 | stderr: ptr::null_mut(), |
| 68 | |
| 69 | runtime_services: ptr::null_mut(), |
| 70 | boot_services: ptr::null_mut(), |
| 71 | |
| 72 | number_of_configuration_table_entries: 0, |
| 73 | configuration_table: ptr::null_mut(), |
| 74 | } |
| 75 | } |
| 76 | } |