1
0
Fork 0
forked from AbleOS/ableos
ableos-idl/kernel/src/arch/x86_64/logging.rs
2024-09-13 22:41:31 +01:00

18 lines
558 B
Rust

//! Logging (as in terms of console / serial output)
#![allow(deprecated)]
use {core::fmt::Write, spin::Mutex, uart_16550::SerialPort};
pub static SERIAL_CONSOLE: Mutex<SerialPort> = Mutex::new(unsafe { SerialPort::new(0x3F8) });
pub fn init() {
SERIAL_CONSOLE.lock().init();
// Lazy::force(&TERMINAL_LOGGER);
}
pub fn log(args: core::fmt::Arguments<'_>) -> core::fmt::Result {
x86_64::instructions::interrupts::without_interrupts(|| {
// TERMINAL_LOGGER.lock().write_fmt(args)?;
SERIAL_CONSOLE.lock().write_fmt(args)
})
}