From 61897f56c94759baa73a2f7ce49d5c15f7be8b55 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 18 Jan 2020 17:17:45 +0900 Subject: [PATCH] Clean up kernel/include/arch.h a little and add IRQ() macro --- kernel/include/arch.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/kernel/include/arch.h b/kernel/include/arch.h index 6b5f216..3a2aed0 100644 --- a/kernel/include/arch.h +++ b/kernel/include/arch.h @@ -19,6 +19,8 @@ #ifndef __ARCH_H #define __ARCH_H +#include + #define TASK_STATE_NEW 0 #define TASK_STATE_RUNNING 1 #define TASK_STATE_READY 2 @@ -40,26 +42,27 @@ #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) -- 2.47.3