将中断中所有消息格式化换为新的message!宏
This commit is contained in:
parent
6a935dc2b7
commit
47f16d060e
|
@ -13,15 +13,11 @@ unsafe extern "C" fn interrupt_req_UNSUPPORTED(rip: u64, rsp: u64, errcode: u64)
|
||||||
interrupt_rust_enter();
|
interrupt_rust_enter();
|
||||||
let tty = Tty::from_id(0).unwrap();
|
let tty = Tty::from_id(0).unwrap();
|
||||||
tty.enable();
|
tty.enable();
|
||||||
let msg = message_raw!(
|
tty.print(message!(
|
||||||
Msg("Panic:"),
|
"{Panic}: Kernel hit an {Unsupported} interrupt. \n",
|
||||||
FgColor::<u8>(Color::RED),
|
FmtMeta::Color(Color::RED),
|
||||||
Msg(" Kernel hit an unsupported interrupt\n\twith %rip=0x"),
|
FmtMeta::Color(Color::YELLOW)
|
||||||
Msg(rip.to_hex_string()),
|
));
|
||||||
Msg(" and %rsp=0x"),
|
|
||||||
Msg(rsp.to_hex_string())
|
|
||||||
);
|
|
||||||
tty.print(msg);
|
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +27,12 @@ unsafe extern "C" fn interrupt_req_DE(rip: u64, rsp: u64, errcode: u64) {
|
||||||
let tty = Tty::from_id(0).unwrap();
|
let tty = Tty::from_id(0).unwrap();
|
||||||
tty.enable();
|
tty.enable();
|
||||||
tty.print(message!(
|
tty.print(message!(
|
||||||
"{Panic}: divided by zero. rip=0x{}.\n",
|
"{Panic}: Kernel hit {Divid Error} on rip=0x{} and rsp=0x{}.\n",
|
||||||
FmtMeta::Color(Color::RED),
|
FmtMeta::Color(Color::RED),
|
||||||
FmtMeta::Pointer(rip as usize)
|
FmtMeta::Color(Color::YELLOW),
|
||||||
|
FmtMeta::Pointer(rip as usize),
|
||||||
|
FmtMeta::Pointer(rsp as usize)
|
||||||
));
|
));
|
||||||
loop {}
|
|
||||||
interrupt_rust_leave();
|
interrupt_rust_leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,12 @@ macro_rules! message_raw {
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! message {
|
macro_rules! message {
|
||||||
|
( $fmtter : expr ) => {{
|
||||||
|
use crate::kernel::tty::tty::MessageBuilder;
|
||||||
|
MessageBuilder::new()
|
||||||
|
.message($fmtter)
|
||||||
|
.build()
|
||||||
|
}};
|
||||||
( $fmtter : expr, $( $e : expr ),* ) => {{
|
( $fmtter : expr, $( $e : expr ),* ) => {{
|
||||||
use crate::{
|
use crate::{
|
||||||
kernel::tty::tty::{
|
kernel::tty::tty::{
|
||||||
|
|
Loading…
Reference in New Issue