From d5f73601115eec7a80dfa431859a511c8043c3ae Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 10 Sep 2020 22:59:39 +0300 Subject: [PATCH] Move SYSTEM_TABLE out of Option<> (non-null throughout program lifetime) --- crates/efi/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/efi/src/lib.rs b/crates/efi/src/lib.rs index e730f9d..d68aa3a 100644 --- a/crates/efi/src/lib.rs +++ b/crates/efi/src/lib.rs @@ -1,6 +1,7 @@ #![no_std] use core::ffi::c_void; +use core::ptr::null_mut; pub mod proto; pub use proto::stop::*; @@ -40,15 +41,15 @@ impl SystemTable { } } -static mut SYSTEM_TABLE: Option<*mut SystemTable> = None; +static mut SYSTEM_TABLE: *mut SystemTable = null_mut(); pub fn init_tables(st: *mut SystemTable) { if st.is_null() { panic!(); } - unsafe { SYSTEM_TABLE = Some(st); } + unsafe { SYSTEM_TABLE = st; } } pub fn system_table() -> &'static mut SystemTable { - unsafe { &mut *SYSTEM_TABLE.unwrap() } + unsafe { &mut *SYSTEM_TABLE } }