-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c70798d
commit dc4e6ff
Showing
3 changed files
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; | ||
use crate::println; | ||
use lazy_static::lazy_static; | ||
|
||
lazy_static! { | ||
static ref IDT: InterruptDescriptorTable = { | ||
let mut idt = InterruptDescriptorTable::new(); | ||
idt.breakpoint.set_handler_fn(breakpoint_handler); | ||
idt | ||
}; | ||
} | ||
|
||
pub fn init_idt() { | ||
IDT.load(); | ||
} | ||
|
||
extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) { | ||
println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame); | ||
} | ||
|
||
#[test_case] | ||
fn test_breakpoint_exceptions() { | ||
x86_64::instructions::interrupts::int3(); | ||
} |
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