summaryrefslogtreecommitdiff
path: root/kernel/src/interrupts/mod.rs
diff options
context:
space:
mode:
authornatrixaeria <upezu@student.kit.edu>2019-11-15 20:03:47 +0100
committernatrixaeria <upezu@student.kit.edu>2019-11-15 20:03:47 +0100
commitc6e0e13db0ba0442018645a1184be50e1ec968e0 (patch)
tree5e505f7ed135de40cab2488339fb62c6a279f5d5 /kernel/src/interrupts/mod.rs
parentfe488737784da2196b84dbc22b658bf12a5f58f9 (diff)
parent4953b122d995696bc0b656b1c70c57ba5e96bcfd (diff)
Merge branch 'master' of dennis:/var/repos/uff-os
Diffstat (limited to 'kernel/src/interrupts/mod.rs')
-rw-r--r--kernel/src/interrupts/mod.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/kernel/src/interrupts/mod.rs b/kernel/src/interrupts/mod.rs
index 609fb6d..bc313b8 100644
--- a/kernel/src/interrupts/mod.rs
+++ b/kernel/src/interrupts/mod.rs
@@ -2,8 +2,11 @@ pub mod apic;
pub mod exceptions;
pub mod gdt;
pub mod idt;
+pub mod interrupts;
-#[repr(usize)]
+const INT_OFFSET: u8 = 32;
+
+#[repr(u8)]
#[derive(PartialEq, Clone, Copy)]
pub enum Interrupts {
None,
@@ -12,4 +15,17 @@ pub enum Interrupts {
NotPresent,
Breakpoint,
GeneralProtectionFault,
+
+ Timer = INT_OFFSET,
+ Keyboard = INT_OFFSET + 1,
+}
+
+impl Interrupts {
+ fn as_u8(self) -> u8 {
+ self as u8
+ }
+
+ fn as_usize(self) -> usize {
+ usize::from(self.as_u8())
+ }
}