-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from acheronfail/refactor-interrupts
Refactor exception code into new `interrupts` module
- Loading branch information
Showing
7 changed files
with
123 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use x86_64::structures::idt::{ExceptionStackFrame, InterruptDescriptorTable}; | ||
use gdt; | ||
|
||
lazy_static! { | ||
static ref IDT: InterruptDescriptorTable = { | ||
let mut idt = InterruptDescriptorTable::new(); | ||
idt.breakpoint.set_handler_fn(breakpoint_handler); | ||
unsafe { | ||
idt.double_fault | ||
.set_handler_fn(double_fault_handler) | ||
.set_stack_index(gdt::DOUBLE_FAULT_IST_INDEX); | ||
} | ||
|
||
idt | ||
}; | ||
} | ||
|
||
pub fn init_idt() { | ||
IDT.load(); | ||
} | ||
|
||
extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut ExceptionStackFrame) { | ||
println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame); | ||
} | ||
|
||
extern "x86-interrupt" fn double_fault_handler( | ||
stack_frame: &mut ExceptionStackFrame, | ||
_error_code: u64, | ||
) { | ||
println!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame); | ||
loop {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters