File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ pub static PAGE_FAULT: [fn(VirtAddr, PageFaultFlags) -> bool];
1919#[ def_trap_handler]
2020pub static BREAK_HANDLER : [ fn ( & mut TrapFrame ) -> bool ] ;
2121
22+ /// A slice of debug handler functions.
23+ #[ def_trap_handler]
24+ pub static DEBUG_HANDLER : [ fn ( & mut TrapFrame ) -> bool ] ;
25+
2226#[ allow( unused_macros) ]
2327macro_rules! handle_trap {
2428 ( $trap: ident, $( $args: tt) * ) => { {
Original file line number Diff line number Diff line change @@ -46,10 +46,18 @@ fn handle_breakpoint(tf: &mut TrapFrame) {
4646 }
4747}
4848
49+ fn handle_debug ( tf : & mut TrapFrame ) {
50+ debug ! ( "#DB @ {:#x} " , tf. rip) ;
51+ if core:: hint:: likely ( handle_trap ! ( DEBUG_HANDLER , tf) ) {
52+ return ;
53+ }
54+ }
55+
4956#[ unsafe( no_mangle) ]
5057fn x86_trap_handler ( tf : & mut TrapFrame ) {
5158 match tf. vector as u8 {
5259 PAGE_FAULT_VECTOR => handle_page_fault ( tf) ,
60+ DEBUG_VECTOR => handle_debug ( tf) ,
5361 BREAKPOINT_VECTOR => handle_breakpoint ( tf) ,
5462 GENERAL_PROTECTION_FAULT_VECTOR => {
5563 panic ! (
You can’t perform that action at this time.
0 commit comments