1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 16:16:16 +04:00

Tiny changes

This commit is contained in:
WangRunji 2018-06-01 11:46:32 +08:00
parent 71e49e3959
commit 25dde04795
3 changed files with 8 additions and 3 deletions

View File

@ -56,6 +56,9 @@ impl TrapFrame {
tf.rflags = 0x282;
tf
}
pub fn is_user(&self) -> bool {
self.cs & 0x3 == 0x3
}
}
#[derive(Debug, Default)]

View File

@ -68,7 +68,10 @@ impl Log for SimpleLogger {
// metadata.level() <= Level::Info
}
fn log(&self, record: &Record) {
if self.enabled(record.metadata()) {
static DISABLED_TARGET: &[&str] = &[
"rust_ucore::process::scheduler::rr",
];
if self.enabled(record.metadata()) && !DISABLED_TARGET.contains(&record.target()) {
print_in_color(format_args!("[{}] {}\n", record.target(), record.args()), Color::from(record.level()));
}
}

View File

@ -10,8 +10,7 @@ extern fn eh_personality() {
#[lang = "panic_fmt"]
#[no_mangle]
pub extern fn panic_fmt(fmt: core::fmt::Arguments, file: &'static str, line: u32) -> ! {
error!("\n\nPANIC in {} at line {}:", file, line);
error!(" {}", fmt);
error!("\n\nPANIC in {} at line {}\n {}", file, line, fmt);
if cfg!(feature = "qemu_auto_exit") {
unsafe{ cpu::exit_in_qemu(3) }
} else {