1 use crate::protocol::console::{SimpleTextInputProtocol, SimpleTextOutputProtocol}; 2 use crate::table::boot::BootServices; 3 use crate::table::configuration::ConfigurationTable; 4 use crate::table::runtime::RuntimeServices; 5 use crate::table::Header; 6 use crate::{Char16, Handle}; 7 use core::{mem, ptr}; 8 9 #[derive(Clone, Debug, Eq, PartialEq)] 10 #[repr(C)] 11 pub struct SystemTable { 12 pub header: Header, 13 14 pub firmware_vendor: *const Char16, 15 pub firmware_revision: u32, 16 17 pub stdin_handle: Handle, 18 pub stdin: *mut SimpleTextInputProtocol, 19 20 pub stdout_handle: Handle, 21 pub stdout: *mut SimpleTextOutputProtocol, 22 23 pub stderr_handle: Handle, 24 pub stderr: *mut SimpleTextOutputProtocol, 25 26 pub runtime_services: *mut RuntimeServices, 27 pub boot_services: *mut BootServices, 28 29 pub number_of_configuration_table_entries: usize, 30 pub configuration_table: *mut ConfigurationTable, 31 } 32 33 impl SystemTable { 34 pub const SIGNATURE: u64 = 0x5453_5953_2049_4249; 35 } 36 37 impl Default for SystemTable { 38 /// Create a `SystemTable` with most fields set to zero. 39 /// 40 /// The only fields not set to zero are: 41 /// * [`Header::signature`] is set to [`SystemTable::SIGNATURE`]. 42 /// * [`Header::size`] is set to the size in bytes of `SystemTable`. default() -> Self43 fn default() -> Self { 44 Self { 45 header: Header { 46 signature: Self::SIGNATURE, 47 size: u32::try_from(mem::size_of::<Self>()).unwrap(), 48 ..Header::default() 49 }, 50 51 firmware_vendor: ptr::null_mut(), 52 firmware_revision: 0, 53 54 stdin_handle: ptr::null_mut(), 55 stdin: ptr::null_mut(), 56 57 stdout_handle: ptr::null_mut(), 58 stdout: ptr::null_mut(), 59 60 stderr_handle: ptr::null_mut(), 61 stderr: ptr::null_mut(), 62 63 runtime_services: ptr::null_mut(), 64 boot_services: ptr::null_mut(), 65 66 number_of_configuration_table_entries: 0, 67 configuration_table: ptr::null_mut(), 68 } 69 } 70 } 71