Skip to content

Commit f3a603e

Browse files
uefi: Add table::system_table_raw
This is `pub(crate)`, not part of the public API currently.
1 parent 6afbf78 commit f3a603e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

uefi/src/table/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,24 @@ pub use header::Header;
1111
pub use system::{Boot, Runtime, SystemTable};
1212
pub use uefi_raw::table::Revision;
1313

14-
use core::ptr;
14+
use core::ptr::{self, NonNull};
1515
use core::sync::atomic::{AtomicPtr, Ordering};
1616

1717
/// Global system table pointer. This is only modified by [`set_system_table`].
1818
static SYSTEM_TABLE: AtomicPtr<uefi_raw::table::system::SystemTable> =
1919
AtomicPtr::new(ptr::null_mut());
2020

21+
/// Get the raw system table pointer. This may only be called after
22+
/// `set_system_table` has been used to set the global pointer.
23+
///
24+
/// # Panics
25+
///
26+
/// Panics if the global system table pointer is null.
27+
pub(crate) fn system_table_raw() -> NonNull<uefi_raw::table::system::SystemTable> {
28+
let ptr = SYSTEM_TABLE.load(Ordering::Acquire);
29+
NonNull::new(ptr).expect("global system table pointer is not set")
30+
}
31+
2132
/// Update the global system table pointer.
2233
///
2334
/// This is called automatically in the `main` entry point as part of

0 commit comments

Comments
 (0)