From: Matthias Kruk Date: Tue, 14 Jan 2020 12:03:03 +0000 (+0900) Subject: Move several definitions from kernel/arch/defs.h to kernel/include/arch.h to make... X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=fc1baec037eeb26953939c6387b7a6a2b4be9869;p=corax Move several definitions from kernel/arch/defs.h to kernel/include/arch.h to make them visible to other parts of the kernel (especially device drivers) --- diff --git a/kernel/arch/apic.S b/kernel/arch/apic.S index 986199b..3039128 100644 --- a/kernel/arch/apic.S +++ b/kernel/arch/apic.S @@ -16,7 +16,9 @@ * along with Corax. If not, see . */ +#define __ASSEMBLY_SOURCE #include +#include #include "defs.h" #include "apic.h" @@ -146,7 +148,7 @@ _apic_init: cmp $INT(2), %al jnz 2f orl $0x00010000, %eax -2: +2: /* *** Previous comment block is required for this to work properly *** movl %eax, 16(%esp) movl %edx, 12(%esp) diff --git a/kernel/arch/defs.h b/kernel/arch/defs.h index b8825b9..e526438 100644 --- a/kernel/arch/defs.h +++ b/kernel/arch/defs.h @@ -134,26 +134,6 @@ #endif /* CONFIG_APIC */ -#define EXC_VECTOR0 0x00 -#define INT_VECTOR0 0x40 -#define SYS_VECTOR0 SYS_VECTOR_CORAX - -#define SYS_VECTOR_CORAX 0xCC -#define SYS_VECTOR_CXNET 0xCD -#define SYS_VECTOR_CXIPC 0xCE - -#if FEATURE(POSIX) -#define SYS_VECTOR_POSIX 0x80 -#endif /* FEATURE(POSIX) */ - -#define NUM_EXC_VECTORS 21 -#if CONFIG_APIC == 1 -#define NUM_INT_VECTORS 24 -#else -#define NUM_INT_VECTORS 16 -#endif /* CONFIG_APIC */ -#define NUM_SYS_VECTORS 1 - /* i8259 definitions */ #define PIC1_BASE 0x20 #define PIC1_COMM PIC1_BASE @@ -193,28 +173,7 @@ #define EXC_VIRTUALIZATION EXC(20) #define EXC_MAX EXC(21) -/* Interrupt vectors */ - -#define INT(n) (INT_VECTOR0 + (n)) -#define INT_TIMER INT(0) -#define INT_KEYBOARD INT(1) - -#if CONFIG_APIC == 1 - -#define INT_APICERR INT(-2) -#define INT_SPURIOUS INT(-1) -/* what do we use INT 2 on APIC systems for? */ -#else -/* on non-APIC systems, INT 2 is the cascaded i8259 PIC */ -#define INT_I8259 INT(2) -#endif /* CONFIG_APIC */ - -#define INT_FLOPPY INT(3) -#define INT_HARDDRIVE INT(4) -#define INT_RTC INT(5) -#define INT_HPET INT(6) /* is it really? */ -#define INT_NETWORK INT(7) -#define INT_MAX INT(8) +/* Interrupt vectors have been moved to kernel/include/arch.h */ /* definitions for tasks and task switching */ diff --git a/kernel/arch/entry.S b/kernel/arch/entry.S index 99481bd..51a3f3f 100644 --- a/kernel/arch/entry.S +++ b/kernel/arch/entry.S @@ -19,6 +19,7 @@ #define __ASSEMBLY_SOURCE #include +#include #include "defs.h" .section .text diff --git a/kernel/arch/heap.c b/kernel/arch/heap.c index 8a248ae..4c38f2b 100644 --- a/kernel/arch/heap.c +++ b/kernel/arch/heap.c @@ -16,6 +16,7 @@ * along with Corax. If not, see . */ +#include #include #include #include diff --git a/kernel/arch/i8259.S b/kernel/arch/i8259.S index b0e1201..dc7560f 100644 --- a/kernel/arch/i8259.S +++ b/kernel/arch/i8259.S @@ -16,6 +16,9 @@ * along with Corax. If not, see . */ +#define __ASSEMBLY_SOURCE +#include +#include #include "defs.h" #define I8259_EOI 0x20 diff --git a/kernel/arch/init.S b/kernel/arch/init.S index 8860d4e..101c679 100644 --- a/kernel/arch/init.S +++ b/kernel/arch/init.S @@ -16,7 +16,10 @@ * along with Corax. If not, see . */ +#define __ASSEMBLY_SOURCE + #include +#include #include "defs.h" .global arch_init diff --git a/kernel/arch/paging.c b/kernel/arch/paging.c index bf944a7..8e7d16e 100644 --- a/kernel/arch/paging.c +++ b/kernel/arch/paging.c @@ -16,6 +16,7 @@ * along with Corax. If not, see . */ +#include #include #include #include diff --git a/kernel/include/arch.h b/kernel/include/arch.h index 9917ea4..19f40a9 100644 --- a/kernel/include/arch.h +++ b/kernel/include/arch.h @@ -27,6 +27,47 @@ #define TASK_STATE_EXIT 5 #define TASK_STATE_FORKED 6 +#define EXC_VECTOR0 0x00 +#define INT_VECTOR0 0x40 +#define SYS_VECTOR0 SYS_VECTOR_CORAX + +#define SYS_VECTOR_CORAX 0xCC +#define SYS_VECTOR_CXNET 0xCD +#define SYS_VECTOR_CXIPC 0xCE + +#if FEATURE(POSIX) +#define SYS_VECTOR_POSIX 0x80 +#endif /* FEATURE(POSIX) */ + +#define NUM_EXC_VECTORS 21 +#if CONFIG_APIC == 1 +#define NUM_INT_VECTORS 24 +#else +#define NUM_INT_VECTORS 16 +#endif /* CONFIG_APIC */ +#define NUM_SYS_VECTORS 1 + +#define INT(n) (INT_VECTOR0 + (n)) +#define INT_TIMER INT(0) +#define INT_KEYBOARD INT(1) + +#if CONFIG_APIC == 1 + +#define INT_APICERR INT(-2) +#define INT_SPURIOUS INT(-1) +/* what do we use INT 2 on APIC systems for? */ +#else +/* on non-APIC systems, INT 2 is the cascaded i8259 PIC */ +#define INT_I8259 INT(2) +#endif /* CONFIG_APIC */ + +#define INT_FLOPPY INT(3) +#define INT_HARDDRIVE INT(4) +#define INT_RTC INT(5) +#define INT_HPET INT(6) /* is it really? */ +#define INT_NETWORK INT(7) +#define INT_MAX INT(8) + #ifndef __ASSEMBLY_SOURCE #include