Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/uefi/src/table/mod.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / uefi / src / table / mod.rs` 65 lines ยท 2069 bytes Raw Blame History 1 // SPDX-License-Identifier: MIT OR Apache-2.0 2 3 //! Standard UEFI tables. 4 5 pub mod cfg; 6 7 mod header; 8 9 pub use header::Header; 10 pub use uefi_raw::table::Revision; 11 12 use core::ptr::{self, NonNull}; 13 use core::sync::atomic::{AtomicPtr, Ordering}; 14 use uefi_raw::table::system::SystemTable; 15 16 /// Global system table pointer. This is only modified by [`set_system_table`]. 17 static SYSTEM_TABLE: AtomicPtr = AtomicPtr::new(ptr::null_mut()); 18 19 /// Get the raw system table pointer. 20 /// 21 /// If called before `set_system_table` has been called, this will return `None`. 22 pub fn system_table_raw() -> Option> { 23 let ptr = SYSTEM_TABLE.load(Ordering::Acquire); 24 NonNull::new(ptr) 25 } 26 27 /// Get the raw system table pointer. This may only be called after 28 /// `set_system_table` has been used to set the global pointer. 29 /// 30 /// # Panics 31 /// 32 /// Panics if the global system table pointer is null. 33 #[track_caller] 34 pub(crate) fn system_table_raw_panicking() -> NonNull { 35 system_table_raw().expect("global system table pointer is not set") 36 } 37 38 /// Update the global system table pointer. 39 /// 40 /// This is called automatically in the `main` entry point as part of 41 /// [`uefi::entry`]. 42 /// 43 /// It is also called by [`set_virtual_address_map`] to transition from a 44 /// physical address to a virtual address. 45 /// 46 /// This function should not be called at any other point in time, unless the 47 /// executable does not use [`uefi::entry`], in which case it should be called 48 /// once before calling any other API in this crate. 49 /// 50 /// # Safety 51 /// 52 /// This function should only be called as described above, and the 53 /// `ptr` must be a valid [`SystemTable`]. 54 /// 55 /// [`set_virtual_address_map`]: uefi::runtime::set_virtual_address_map 56 pub unsafe fn set_system_table(ptr: *const SystemTable) { 57 SYSTEM_TABLE.store(ptr.cast_mut(), Ordering::Release); 58 } 59 60 /// Common trait implemented by all standard UEFI tables. 61 pub trait Table { 62 /// A unique number assigned by the UEFI specification 63 /// to the standard tables. 64 const SIGNATURE: u64; 65 }