]> Devi Nivas Git - cs3210-lab0.git/commitdiff
remove duplication
authorkaashoek <kaashoek>
Sun, 3 Sep 2006 15:39:29 +0000 (15:39 +0000)
committerkaashoek <kaashoek>
Sun, 3 Sep 2006 15:39:29 +0000 (15:39 +0000)
don't use the same name for two different pieces of code

asm.h
bootasm.S
bootother.S
console.c
ide.c
picirq.c
traps.h
x86.h

diff --git a/asm.h b/asm.h
index b5fca66b9d84e7621fa5ebae166fbb09c9e6d444..c9d7c1d7eb4d16f7dd87fd02a3faa3ad30de702b 100644 (file)
--- a/asm.h
+++ b/asm.h
@@ -2,10 +2,10 @@
 // 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)
index c2a3c3e3ffac9c7da7d1c0efb098309223e26d34..f776b83c23cbe55fb8026be2b0d450f6db7ef818 100644 (file)
--- a/bootasm.S
+++ b/bootasm.S
@@ -87,9 +87,9 @@ spin:         jmp spin                        # ..but in case it does, spin
        
 .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
index 2bdfdb26817354f885431cd5a98f176de4b09f3e..99e47139c01d1d46790802ef1d22fdd0cb06c1df 100644 (file)
@@ -70,9 +70,9 @@ protcseg:
        
 .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
index 803a89653ca5c7ef49c69208ec179d10bacea72d..1a64122858c6959b0b4f51c6eecb6f1c12bc4f0e 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1,5 +1,6 @@
 #include "types.h"
 #include "x86.h"
+#include "traps.h"
 #include "defs.h"
 #include "spinlock.h"
 #include "dev.h"
diff --git a/ide.c b/ide.c
index b999786fd4d056519346b64b268bf68cb45c29fd..dfbc6059d5a95669308194d5727a67de193a001f 100644 (file)
--- a/ide.c
+++ b/ide.c
@@ -8,6 +8,7 @@
 #include "proc.h"
 #include "defs.h"
 #include "x86.h"
+#include "traps.h"
 #include "spinlock.h"
 
 #define IDE_BSY                0x80
index ab3e7b96ec0f75362460122b0a4f9d93cc2b873c..86d1d1d6ef539885e7f429f8dda02318bd4e47e7 100644 (file)
--- a/picirq.c
+++ b/picirq.c
@@ -2,6 +2,7 @@
 
 #include "types.h"
 #include "x86.h"
+#include "traps.h"
 #include "defs.h"
 
 // I/O Addresses of the two 8259A programmable interrupt controllers
diff --git a/traps.h b/traps.h
index 4b2d368dc77ac6136ad0ee4ce98a22da0ce902cb..d093be0f4d3472f1a215804270d1b5fb53a2bf4a 100644 (file)
--- a/traps.h
+++ b/traps.h
@@ -27,6 +27,8 @@
 
 #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
diff --git a/x86.h b/x86.h
index 7d3452d8fff294cd835e5897c9b3ad917265575c..f9e2261d6133c4e05c216c8382b56b3ebc5a4e29 100644 (file)
--- a/x86.h
+++ b/x86.h
@@ -151,12 +151,3 @@ struct trapframe {
     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