Skip to content

Commit ff820f1

Browse files
ryanbreenclaude
andcommitted
fix(interrupts): add explicit diverging loop to double_fault_handler
The x86_64 crate requires double fault handlers to have a diverging return type (-> !). Added an explicit infinite loop after panic to satisfy the type checker, even though the panic already ensures the function never returns. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9ca78a3 commit ff820f1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

kernel/src/interrupts.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
148148
extern "x86-interrupt" fn double_fault_handler(
149149
stack_frame: InterruptStackFrame,
150150
_error_code: u64,
151-
) {
151+
) -> ! {
152152
// Log additional debug info before panicking
153153
log::error!("DOUBLE FAULT - Error Code: {:#x}", _error_code);
154154
log::error!("Instruction Pointer: {:#x}", stack_frame.instruction_pointer.as_u64());
@@ -162,6 +162,11 @@ extern "x86-interrupt" fn double_fault_handler(
162162
log::error!("Current page table frame: {:?}", frame);
163163

164164
panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
165+
// This is unreachable but needed to satisfy the type checker
166+
#[allow(unreachable_code)]
167+
loop {
168+
x86_64::instructions::hlt();
169+
}
165170
}
166171

167172

0 commit comments

Comments
 (0)