Remove print_error and use normal println in exception handlers

This commit is contained in:
Philipp Oppermann
2016-10-26 09:08:27 +02:00
parent 212dcfa592
commit 9b83b2853e
2 changed files with 15 additions and 32 deletions

View File

@@ -113,29 +113,24 @@ struct ExceptionStackFrame {
stack_segment: u64,
}
use vga_buffer::print_error;
extern "C" fn divide_by_zero_handler(stack_frame: *const ExceptionStackFrame) {
unsafe {
print_error(format_args!("EXCEPTION: DIVIDE BY ZERO\n{:#?}", *stack_frame));
}
let stack_frame = unsafe { &*stack_frame };
println!("EXCEPTION: DIVIDE BY ZERO\n{:#?}", stack_frame);
loop {}
}
extern "C" fn breakpoint_handler(stack_frame: *const ExceptionStackFrame) {
unsafe {
print_error(format_args!("EXCEPTION: BREAKPOINT at {:#x}\n{:#?}",
(*stack_frame).instruction_pointer,
*stack_frame));
}
let stack_frame = unsafe { &*stack_frame };
println!("EXCEPTION: BREAKPOINT at {:#x}\n{:#?}",
stack_frame.instruction_pointer,
stack_frame);
}
extern "C" fn invalid_opcode_handler(stack_frame: *const ExceptionStackFrame) {
unsafe {
print_error(format_args!("EXCEPTION: INVALID OPCODE at {:#x}\n{:#?}",
(*stack_frame).instruction_pointer,
*stack_frame));
}
let stack_frame = unsafe { &*stack_frame };
println!("EXCEPTION: INVALID OPCODE at {:#x}\n{:#?}",
stack_frame.instruction_pointer,
*stack_frame);
loop {}
}
@@ -150,13 +145,12 @@ bitflags! {
}
extern "C" fn page_fault_handler(stack_frame: *const ExceptionStackFrame, error_code: u64) {
let stack_frame = unsafe { &*stack_frame };
use x86::controlregs;
unsafe {
print_error(format_args!("EXCEPTION: PAGE FAULT while accessing {:#x}\nerror code: \
println!("EXCEPTION: PAGE FAULT while accessing {:#x}\nerror code: \
{:?}\n{:#?}",
controlregs::cr2(),
PageFaultErrorCode::from_bits(error_code).unwrap(),
*stack_frame));
}
unsafe { controlregs::cr2() },
PageFaultErrorCode::from_bits(error_code).unwrap(),
stack_frame);
loop {}
}