mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-17 06:47:49 +00:00
Catch divide error instead of page fault
The divide error pushes no error code. Thus we avoid stack misalignment (see #184).
This commit is contained in:
@@ -4,7 +4,7 @@ lazy_static! {
|
||||
static ref IDT: idt::Idt = {
|
||||
let mut idt = idt::Idt::new();
|
||||
|
||||
idt.set_handler(14, page_fault_handler);
|
||||
idt.set_handler(0, divide_by_zero_handler);
|
||||
|
||||
idt
|
||||
};
|
||||
@@ -16,7 +16,7 @@ pub fn init() {
|
||||
|
||||
use vga_buffer::print_error;
|
||||
|
||||
extern "C" fn page_fault_handler() -> ! {
|
||||
unsafe { print_error(format_args!("EXCEPTION: PAGE FAULT")) };
|
||||
extern "C" fn divide_by_zero_handler() -> ! {
|
||||
unsafe { print_error(format_args!("EXCEPTION: DIVIDE BY ZERO")) };
|
||||
loop {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user