Better virtual file system, keyboard through MMIO&VirtIO

This commit is contained in:
2026-03-05 14:41:28 +01:00
parent 041e544330
commit 9b6aec28f5
37 changed files with 1191 additions and 355 deletions

View File

@@ -7,29 +7,38 @@ use core::arch::riscv64::wfi;
use alloc::{format, string::ToString};
use log::error;
use crate::vga::{Color, Vga, FONT_HEIGHT};
use crate::{
HEAP, HEAP_INITIALIZED,
draw::{Color, Draw, FONT_HEIGHT},
uart::write_uart,
vga::Vga,
};
#[panic_handler]
/// Kernel panic handler that displays the panic message on the framebuffer and halts.
fn panic(panic_info: &core::panic::PanicInfo) -> ! {
error!("PANIC !");
let mut panic_message = panic_info.message().to_string();
if let Some(location) = panic_info.location() {
panic_message = format!("{panic_message} at {}:{}", location.file(), location.line());
}
error!("{panic_message}");
if !HEAP_INITIALIZED.load(core::sync::atomic::Ordering::Relaxed) {
write_uart("EARLY PANIC !");
} else {
error!("PANIC !");
let mut panic_message = panic_info.message().to_string();
if let Some(location) = panic_info.location() {
panic_message = format!("{panic_message} at {}:{}", location.file(), location.line());
}
error!("{panic_message}");
Vga::clear_screen(Color::WHITE);
unsafe { Vga::draw_string(0, 0, "PANIC !", Color::BLACK, Color::WHITE) };
unsafe {
Vga::draw_string(
0,
FONT_HEIGHT as u16,
panic_message,
Color::BLACK,
Color::WHITE,
)
};
Vga.clear_screen(Color::WHITE);
unsafe { Vga.draw_string(0, 0, "PANIC !", Color::BLACK, Color::WHITE) };
unsafe {
Vga.draw_string(
0,
FONT_HEIGHT as u16,
panic_message,
Color::BLACK,
Color::WHITE,
)
};
}
loop {
unsafe { wfi() }