1
0
Fork 0
forked from koniifer/ableos

Register dump on panic

This commit is contained in:
able 2023-09-07 14:31:31 -05:00
parent 0e8fb17f3a
commit b04ee13185

View file

@ -1,17 +1,19 @@
use embedded_graphics::pixelcolor::Rgb888; use embedded_graphics::pixelcolor::Rgb888;
use crate::{arch::x86_64::graphics::DISPLAY, bootmodules::BootModule}; use {
crate::{arch::x86_64::graphics::DISPLAY, bootmodules::BootModule},
core::arch::asm,
};
pub mod memory; pub mod memory;
mod cpuid; mod cpuid;
mod device_info_collector;
mod gdt; mod gdt;
pub mod graphics; pub mod graphics;
pub(crate) mod interrupts; pub(crate) mod interrupts;
pub mod logging; pub mod logging;
pub mod pci; pub mod pci;
pub mod virtio; pub mod virtio;
mod device_info_collector;
pub use {logging::log, memory::PAGE_SIZE}; pub use {logging::log, memory::PAGE_SIZE};
@ -192,3 +194,71 @@ pub fn hardware_random_u64() -> u64 {
} }
pub fn get_edid() {} pub fn get_edid() {}
pub fn register_dump() {
let rax: u64;
let rbx: u64 = 0;
let rcx: u64;
let rdx: u64;
let si: u64;
let di: u64;
let r8: u64; // TODO: r8-r15
let r9: u64;
let r10: u64;
let r11: u64;
let r12: u64;
let r13: u64;
let r14: u64;
let r15: u64;
unsafe {
asm!("",
out("rax") rax,
out("rcx") rcx,
out("rdx") rdx,
out("si") si,
out("di") di,
out("r8") r8,
out("r9") r9,
out("r10") r10,
out("r11") r11,
out("r12") r12,
out("r13") r13,
out("r14") r14,
out("r15") r15,
)
};
log::error!(
"Kernel Panic!\r
Register Dump\r
rax: {:#x}\r
rbx: {:#x}\r
rcx: {:#x}\r
rdx: {:#x}\r
si : {:#x}\r
di : {:#x}\r
r8 : {:#x}\r
r9 : {:#x}\r
r11: {:#x}\r
r12: {:#x}\r
r13: {:#x}\r
r14: {:#x}\r
r15: {:#x}\r
",
rax,
rbx,
rcx,
rdx,
si,
di,
r8,
r9,
r11,
r12,
r13,
r14,
r15,
);
}