Skip to content

Commit 5cfc5f0

Browse files
uefi: Add table::system_table_raw_panicking
This is `pub(crate)`, not part of the public API currently.
1 parent 380f98f commit 5cfc5f0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

uefi/src/table/mod.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,25 @@ 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+
#[track_caller]
28+
pub(crate) fn system_table_raw_panicking() -> NonNull<uefi_raw::table::system::SystemTable> {
29+
let ptr = SYSTEM_TABLE.load(Ordering::Acquire);
30+
NonNull::new(ptr).expect("global system table pointer is not set")
31+
}
32+
2133
/// Update the global system table pointer.
2234
///
2335
/// This is called automatically in the `main` entry point as part of

0 commit comments

Comments
 (0)