summaryrefslogtreecommitdiff
path: root/kernel/src/interrupts
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2019-11-08 23:39:21 +0100
committerDennis Kobert <dennis@kobert.dev>2019-11-08 23:39:21 +0100
commit8602b41f192fec43fde735c9c1f99cd59040f1bb (patch)
treeccb5990f2a74964194fe1132b553895331b8894a /kernel/src/interrupts
parent933abe8bc6f9480bcdea39c6bdd1a4e937402a06 (diff)
Reformat exceptions
Diffstat (limited to 'kernel/src/interrupts')
-rw-r--r--kernel/src/interrupts/exceptions.rs39
-rw-r--r--kernel/src/interrupts/table.rs1
2 files changed, 23 insertions, 17 deletions
diff --git a/kernel/src/interrupts/exceptions.rs b/kernel/src/interrupts/exceptions.rs
index 782dd16..b6fb5a6 100644
--- a/kernel/src/interrupts/exceptions.rs
+++ b/kernel/src/interrupts/exceptions.rs
@@ -1,10 +1,12 @@
-use crate::io::vga_text::OStream;
use x86_64::structures::idt::{InterruptStackFrame, PageFaultErrorCode};
pub extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut InterruptStackFrame) {
- let mut stdout = OStream::new();
- stdout.print(b"EXCEPTION: BREAKPOINT\n");
- loop {}
+ panic!(
+ "BREAKPOINT at {:x} Flags: {:b} Stack: {:x}",
+ stack_frame.instruction_pointer.as_u64(),
+ stack_frame.cpu_flags,
+ stack_frame.stack_pointer.as_u64()
+ );
}
pub extern "x86-interrupt" fn page_fault_handler(
@@ -13,29 +15,34 @@ pub extern "x86-interrupt" fn page_fault_handler(
) {
use x86_64::registers::control::Cr2;
- let mut stdout = OStream::new();
panic!(
- "PAGE FAULT while accessing address: {:?}{:?}",
- Cr2::read(),
- error_code
+ "PAGE FAULT while accessing address: {:x}{:?}Flags: {:b} Stack: {:x}",
+ Cr2::read().as_u64(),
+ error_code,
+ stack_frame.cpu_flags,
+ stack_frame.stack_pointer.as_u64()
);
- //println!("{:#?}", stack_frame);
}
pub extern "x86-interrupt" fn segment_not_present_handler(
stack_frame: &mut InterruptStackFrame,
error_code: u64,
) {
- let mut stdout = OStream::new();
- stdout.print(b"EXCEPTION: SEGMENT NOT PRESENT\n");
- loop {}
+ panic!(
+ "SEGMENT NOT PRESENT: {:?}Flags: {:b} Stack: {:x}",
+ error_code,
+ stack_frame.cpu_flags,
+ stack_frame.stack_pointer.as_u64()
+ );
}
pub extern "x86-interrupt" fn double_fault_handler(
stack_frame: &mut InterruptStackFrame,
- _error_code: u64,
+ _error_code: u64, // code is always zero
) {
- let mut stdout = OStream::new();
- stdout.print(b"EXCEPTION: DOUBLE FAULT");
- loop {}
+ panic!(
+ "DOUBLE FAULT Flags: {:b} Stack: {:x}",
+ stack_frame.cpu_flags,
+ stack_frame.stack_pointer.as_u64()
+ );
}
diff --git a/kernel/src/interrupts/table.rs b/kernel/src/interrupts/table.rs
index d417824..9541f22 100644
--- a/kernel/src/interrupts/table.rs
+++ b/kernel/src/interrupts/table.rs
@@ -1,4 +1,3 @@
-use crate::io::vga_text::OStream;
use lazy_static::lazy_static;
use x86_64::structures::idt::InterruptDescriptorTable;