Update boot prints to be a little less noisy.

TODO:

* Debugging, tracing support.
* Logging infra so we can may pass a loglevel like on Linux.
This commit is contained in:
2025-03-06 20:32:46 +00:00
parent 1d192adde0
commit 4b8388c66d
+11 -12
View File
@@ -1,6 +1,5 @@
#![no_std] #![no_std]
#![feature(abi_x86_interrupt)] #![feature(abi_x86_interrupt)]
#![feature(impl_trait_in_bindings)]
#![warn( #![warn(
clippy::correctness, clippy::correctness,
clippy::nursery, clippy::nursery,
@@ -20,6 +19,7 @@ use crate::{
drivers::{ drivers::{
ascii::screensize_chars, framebuffer::display::screensize_px, ascii::screensize_chars, framebuffer::display::screensize_px,
}, },
gdt, interrupts,
memory::{ memory::{
FRAME_ALLOCATOR, FRAME_ALLOCATOR,
allocation::{ allocation::{
@@ -35,7 +35,7 @@ use crate::{
use alloc::{boxed::Box, format}; use alloc::{boxed::Box, format};
use core::arch::asm; use core::arch::asm;
use limine::BaseRevision; use limine::BaseRevision;
use std::unwind::UNWINDER; use std::{debug, unwind::UNWINDER};
use x86_64::VirtAddr; use x86_64::VirtAddr;
pub mod arch; pub mod arch;
@@ -88,8 +88,6 @@ pub fn boot() -> Result<(), Box<dyn core::error::Error>> {
return Err("Base revision not supported.".into()); return Err("Base revision not supported.".into());
} }
use arch::x86_64::{gdt, interrupts};
let memory_map = mapping::get_memory_map(); let memory_map = mapping::get_memory_map();
print_log!(" Initialising Serial... "); print_log!(" Initialising Serial... ");
@@ -101,12 +99,11 @@ pub fn boot() -> Result<(), Box<dyn core::error::Error>> {
debugln!("[Success]"); debugln!("[Success]");
} }
debugln!(" Display..."); debugln!(
let dimensions = screensize_chars(); "Display is {:?} chars, {:?} px.",
let dimensions2 = screensize_px(); screensize_chars(),
debugln!(" => (px) : {}x{} ", dimensions2.0, dimensions2.1); screensize_px()
debugln!(" => (chars) : {}x{} ", dimensions.0, dimensions.1); );
debugln!(" [Success]");
debug!(" Setting Up Global Descriptor Table... "); debug!(" Setting Up Global Descriptor Table... ");
gdt::init(); gdt::init();
@@ -152,9 +149,11 @@ pub fn boot() -> Result<(), Box<dyn core::error::Error>> {
x86_64::instructions::interrupts::enable(); x86_64::instructions::interrupts::enable();
debugln!("[Success]"); debugln!("[Success]");
// Initialises the Unwinder once and only once because this makes a heap // Initialises the stack unwinder once and only once because this makes a
// allocation. // heap allocation.
debug!(" Initializing Stack Unwinder... ");
UNWINDER.lock(); UNWINDER.lock();
debugln!("[Success]");
Ok(()) Ok(())
} }