]> git.corax.cc Git - corax/commitdiff
Clean up kernel/include/arch.h a little and add IRQ() macro
authorMatthias Kruk <m@m10k.eu>
Sat, 18 Jan 2020 08:17:45 +0000 (17:17 +0900)
committerMatthias Kruk <m@m10k.eu>
Sat, 18 Jan 2020 08:17:45 +0000 (17:17 +0900)
kernel/include/arch.h

index 6b5f216837ad0d05369e97b0fc70c1d8f95ae1b0..3a2aed0a69a4be5a6a0e1e6aeca7bb3db4355e3a 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef __ARCH_H
 #define __ARCH_H
 
+#include <config.h>
+
 #define TASK_STATE_NEW     0
 #define TASK_STATE_RUNNING 1
 #define TASK_STATE_READY   2
 #endif /* FEATURE(POSIX) */
 
 #define NUM_EXC_VECTORS     21
-#if CONFIG_APIC == 1
+
+#if FEATURE(APIC)
 #define NUM_INT_VECTORS     24
-#else
+#else /* ! FEATURE(APIC) */
 #define NUM_INT_VECTORS     16
-#endif /* CONFIG_APIC */
-#define NUM_SYS_VECTORS     1
+#endif /* ! FEATURE(APIC) */
 
 #define INT(n)              (INT_VECTOR0 + (n))
+#define IRQ(n)              ((n) - INT_VECTOR0)
+
 #define INT_TIMER           INT(0)
 #define INT_KEYBOARD        INT(1)
 
-#if CONFIG_APIC == 1
-
+#if FEATURE(APIC)
 #define INT_APICERR         INT(-2)
 #define INT_SPURIOUS        INT(-1)
 /* what do we use INT 2 on APIC systems for? */
-#else
+#else /* ! FEATURE(APIC) */
 /* on non-APIC systems, INT 2 is the cascaded i8259 PIC */
 #define INT_I8259           INT(2)
-#endif /* CONFIG_APIC */
+#endif /* ! FEATURE(APIC) */
 
 #define INT_FLOPPY          INT(3)
 #define INT_HARDDRIVE       INT(4)