// macros to create x86 segments from assembler
//
-#define SEG_NULL \
+#define SEG_NULLASM \
.word 0, 0; \
.byte 0, 0, 0, 0
-#define SEG(type,base,lim) \
+#define SEG_ASM(type,base,lim) \
.word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \
.byte (((base) >> 16) & 0xff), (0x90 | (type)), \
(0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff)
.p2align 2 # force 4 byte alignment
gdt:
- SEG_NULL # null seg
- SEG(STA_X|STA_R, 0x0, 0xffffffff) # code seg
- SEG(STA_W, 0x0, 0xffffffff) # data seg
+ SEG_NULLASM # null seg
+ SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code seg
+ SEG_ASM(STA_W, 0x0, 0xffffffff) # data seg
gdtdesc:
.word 0x17 # sizeof(gdt) - 1
.p2align 2 # force 4 byte alignment
gdt:
- SEG_NULL # null seg
- SEG(STA_X|STA_R, 0x0, 0xffffffff) # code seg
- SEG(STA_W, 0x0, 0xffffffff) # data seg
+ SEG_NULLASM # null seg
+ SEG_ASM(STA_X|STA_R, 0x0, 0xffffffff) # code seg
+ SEG_ASM(STA_W, 0x0, 0xffffffff) # data seg
gdtdesc:
.word 0x17 # sizeof(gdt) - 1
#include "types.h"
#include "x86.h"
+#include "traps.h"
#include "defs.h"
#include "spinlock.h"
#include "dev.h"
#include "proc.h"
#include "defs.h"
#include "x86.h"
+#include "traps.h"
#include "spinlock.h"
#define IDE_BSY 0x80
#include "types.h"
#include "x86.h"
+#include "traps.h"
#include "defs.h"
// I/O Addresses of the two 8259A programmable interrupt controllers
#define IRQ_OFFSET 32 // IRQ 0 corresponds to int IRQ_OFFSET
+#define IRQ_KBD 1
+#define IRQ_IDE 14
#define IRQ_TIMER 18
#define IRQ_ERROR 19
#define IRQ_SPURIOUS 31
ushort ss;
ushort padding4;
};
-
-#define MAX_IRQS 16 // Number of IRQs
-
-#define IRQ_OFFSET 32 // IRQ 0 corresponds to int IRQ_OFFSET
-
-#define IRQ_KBD 1
-#define IRQ_IDE 14
-#define IRQ_ERROR 19
-#define IRQ_SPURIOUS 31