From e3aa1fc629ba0d5ba3c7607d11abf2b7504ef969 Mon Sep 17 00:00:00 2001 From: Natasha Moongrave Date: Tue, 10 Mar 2026 12:41:30 +0100 Subject: Added an InterruptIndex enum to handle hardware exceptions sent by the PICs to the CPU in src/interrupts.rs --- StrixKernel/src/interrupts.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/StrixKernel/src/interrupts.rs b/StrixKernel/src/interrupts.rs index ea26f1f..4180c17 100644 --- a/StrixKernel/src/interrupts.rs +++ b/StrixKernel/src/interrupts.rs @@ -49,6 +49,22 @@ pub const PIC_2_OFFSET: u8 = PIC_1_OFFSET + 8; pub static PICS: spin::Mutex = spin::Mutex::new(unsafe { ChainedPics::new(PIC_1_OFFSET, PIC_2_OFFSET) }); +#[derive(Debug, Clone, Copy)] +#[repr(u8)] +pub enum InterruptIndex { + Timer = PIC_1_OFFSET, +} + +impl InterruptIndex { + fn as_u8(self) -> u8 { + self as u8 + } + + fn as_usize(self) -> usize { + usize::from(self.as_u8()) + } +} + // TESTS // -- cgit v1.2.3