Skip to content

Commit 0dc16ef

Browse files
Fix error codes (double fault handler added)
1 parent b287d3f commit 0dc16ef

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/protected/stage_3/src/interrupts.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ lazy_static! {
88

99
idt.divide_error.set_handler_fn(divide_handler);
1010
idt.breakpoint.set_handler_fn(breakpoint_handler);
11-
//idt.double_fault.set_handler_fn(double_fault_handler);
11+
12+
idt.double_fault.set_handler_fn(double_fault_handler);
1213

1314
idt
1415
};
@@ -33,9 +34,8 @@ extern "x86-interrupt" fn breakpoint_handler(
3334
println!("[Bootloader] [IDT] Breakpoint Hit");
3435
}
3536

36-
/*extern "x86-interrupt" fn double_fault_handler(
37-
stack_frame: &mut InterruptStackFrame, _error_code: u64) -> !
37+
extern "x86-interrupt" fn double_fault_handler(
38+
stack_frame: &mut InterruptStackFrame, _error_code: u32) -> !
3839
{
39-
panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
40-
loop {};
41-
}*/
40+
panic!("[Bootloader] [IDT] Double Fault!");
41+
}

src/protected/stage_3/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,5 @@ pub extern "C" fn third_stage() -> ! {
2929

3030
println!("[Bootloader] [32] Loaded IDT");
3131

32-
unsafe { asm!("int 3") };
33-
34-
println!("[Bootloader] [32] It didn't crash!");
35-
3632
loop {};
3733
}

src/shared/src/structures/idt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ impl EntryOptions {
207207
pub type HandlerFunc = extern "x86-interrupt" fn(&mut InterruptStackFrame);
208208
/// A handler function for an exception that pushes an error code.
209209
pub type HandlerFuncWithErrCode =
210-
extern "x86-interrupt" fn(&mut InterruptStackFrame, error_code: u64);
210+
extern "x86-interrupt" fn(&mut InterruptStackFrame, error_code: u32);
211211
/// A handler function that must not return, e.g. for a machine check exception.
212212
pub type DivergingHandlerFunc = extern "x86-interrupt" fn(&mut InterruptStackFrame) -> !;
213213
/// A handler function with an error code that must not return, e.g. for a double fault exception.
214214
pub type DivergingHandlerFuncWithErrCode =
215-
extern "x86-interrupt" fn(&mut InterruptStackFrame, error_code: u64) -> !;
215+
extern "x86-interrupt" fn(&mut InterruptStackFrame, error_code: u32) -> !;
216216

217217
/// Represents the interrupt stack frame pushed by the CPU on interrupt or exception entry.
218218
#[derive(Clone, Debug)]

0 commit comments

Comments
 (0)