Skip to content

Commit 790ead3

Browse files
authored
Merge pull request #1358 from nicholasbishop/bishop-update-logger
uefi: Update logger to use the global system table
2 parents 7fb739e + 5415753 commit 790ead3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

uefi/src/helpers/logger.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//! The last part also means that some Unicode characters might not be
1313
//! supported by the UEFI console. Don't expect emoji output support.
1414
15-
use crate::prelude::{Boot, SystemTable};
1615
use crate::proto::console::text::Output;
16+
use crate::system;
1717
use core::fmt::{self, Write};
1818
use core::ptr;
1919
use core::sync::atomic::{AtomicPtr, Ordering};
@@ -25,9 +25,11 @@ static LOGGER: Logger = Logger::new();
2525
///
2626
/// This is unsafe because you must arrange for the logger to be reset with
2727
/// disable() on exit from UEFI boot services.
28-
pub unsafe fn init(st: &mut SystemTable<Boot>) {
28+
pub unsafe fn init() {
2929
// Connect the logger to stdout.
30-
LOGGER.set_output(st.stdout());
30+
system::with_stdout(|stdout| {
31+
LOGGER.set_output(stdout);
32+
});
3133

3234
// Set the logger.
3335
log::set_logger(&LOGGER).unwrap(); // Can only fail if already initialized.

uefi/src/helpers/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ pub fn init() -> Result<()> {
5858
// Set up logging.
5959
#[cfg(feature = "logger")]
6060
unsafe {
61-
let mut st = table::system_table_boot().expect("boot services are not active");
62-
logger::init(&mut st);
61+
logger::init();
6362
}
6463

6564
Ok(())

0 commit comments

Comments
 (0)