summaryrefslogtreecommitdiff
path: root/kernel/src/interrupts/exception_handlers.rs
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2019-11-15 21:20:38 +0100
committerDennis Kobert <dennis@kobert.dev>2019-11-15 21:20:38 +0100
commit564dc1d1407055777b400e42f9a86a58b9921473 (patch)
tree3e3fded5470c6a318f011e280672ed8f038cada5 /kernel/src/interrupts/exception_handlers.rs
parent6590a5acfee33bae3ca0431c8af09768248fe405 (diff)
Rename Interrupts enum to InterruptType
Diffstat (limited to 'kernel/src/interrupts/exception_handlers.rs')
-rw-r--r--kernel/src/interrupts/exception_handlers.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/src/interrupts/exception_handlers.rs b/kernel/src/interrupts/exception_handlers.rs
index a3ecf9d..cd223bb 100644
--- a/kernel/src/interrupts/exception_handlers.rs
+++ b/kernel/src/interrupts/exception_handlers.rs
@@ -1,4 +1,4 @@
-use super::Interrupts;
+use super::InterruptType;
use crate::io::qemu;
use x86_64::structures::idt::{InterruptStackFrame, PageFaultErrorCode};
@@ -13,21 +13,21 @@ macro_rules! exception_default {
};
}
-static mut expected_fault: Interrupts = Interrupts::None;
+static mut expected_fault: InterruptType = InterruptType::None;
-pub unsafe fn expect_fault(int: Interrupts) {
- if expected_fault == Interrupts::None {
+pub unsafe fn expect_fault(int: InterruptType) {
+ if expected_fault == InterruptType::None {
expected_fault = int;
}
}
-fn get_expected_fault() -> Interrupts {
+fn get_expected_fault() -> InterruptType {
unsafe { expected_fault }
}
pub extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut InterruptStackFrame) {
match get_expected_fault() {
- Interrupts::Breakpoint => qemu::exit_qemu(qemu::QemuExitCode::Success),
+ InterruptType::Breakpoint => qemu::exit_qemu(qemu::QemuExitCode::Success),
_ => panic!(
"BREAKPOINT exception thrown\n\n{}",
exception_default!(stack_frame)
@@ -40,7 +40,7 @@ pub extern "x86-interrupt" fn general_protection_fault_handler(
error_code: u64,
) {
match get_expected_fault() {
- Interrupts::GeneralProtectionFault => qemu::exit_qemu(qemu::QemuExitCode::Success),
+ InterruptType::GeneralProtectionFault => qemu::exit_qemu(qemu::QemuExitCode::Success),
_ => panic!(
"GENERAL PROTECTION exception thrown\nerror code: {:x}\n{}",
error_code,
@@ -56,7 +56,7 @@ pub extern "x86-interrupt" fn page_fault_handler(
use x86_64::registers::control::Cr2;
match get_expected_fault() {
- Interrupts::PageFault => qemu::exit_qemu(qemu::QemuExitCode::Success),
+ InterruptType::PageFault => qemu::exit_qemu(qemu::QemuExitCode::Success),
_ => panic!(
"PAGE FAULT while accessing address: 0x{:08x}\nerror code: {:?}(0x{:x})\n{}",
Cr2::read().as_u64(),
@@ -72,7 +72,7 @@ pub extern "x86-interrupt" fn segment_not_present_handler(
error_code: u64,
) {
match get_expected_fault() {
- Interrupts::NotPresent => qemu::exit_qemu(qemu::QemuExitCode::Success),
+ InterruptType::NotPresent => qemu::exit_qemu(qemu::QemuExitCode::Success),
_ => panic!(
"SEGMENT NOT PRESENT exception\nerror code: 0x{:x}\n{}",
error_code,
@@ -86,7 +86,7 @@ pub extern "x86-interrupt" fn double_fault_handler(
_error_code: u64, // code is always zero
) {
match get_expected_fault() {
- Interrupts::DoubleFault => qemu::exit_qemu(qemu::QemuExitCode::Success),
+ InterruptType::DoubleFault => qemu::exit_qemu(qemu::QemuExitCode::Success),
_ => panic!(
"DOUBLE FAULT\nthis is a fatal exception\n{}",
exception_default!(stack_frame)