I recently started working on a operating system using the limine bootloader.
i wanted to be able to get keyboard input through PIC8259 and i found a example in the phill opp blog,
i made the following code below but it doesnt seem to ever call the handlers for some reason,
i have been working on this problem for a while and i also implemented serial ports just so i can be sure that it never calls.
use core::fmt::Write;
static PICS: Mutex<ChainedPics> = Mutex::new(unsafe { ChainedPics::new(32, 40) });
lazy_static! {
static ref IDT: InterruptDescriptorTable = {
let mut idt = InterruptDescriptorTable::new();
idt.breakpoint.set_handler_fn(breakpoint);
idt.double_fault.set_handler_fn(double_fault);
idt[32].set_handler_fn(timer_interrupt);
idt[33].set_handler_fn(keyboard_interrupt);
return idt;
};
}
pub fn init() {
IDT.load();
unsafe {
PICS.lock().initialize();
}
x86_64::instructions::interrupts::enable();
}
extern "x86-interrupt" fn keyboard_interrupt(_stack_frame: InterruptStackFrame) {
DEBUG.lock().write("[debug] keyboard interrupt\n");
unsafe {
PICS.lock().notify_end_of_interrupt(33);
}
}
extern "x86-interrupt" fn timer_interrupt(_stack_frame: InterruptStackFrame) {
DEBUG.lock().write("[debug] timer interrupt\n");
if let Some(tty) = unsafe { KERNEL_TTY.lock().as_mut() } {
tty.write(".");
tty.render();
}
unsafe {
PICS.lock().notify_end_of_interrupt(32);
}
}
if anyone has a clue it would help allot if yall give me some help!