Skip to content

Commit

Permalink
remove duplication
Browse files Browse the repository at this point in the history
don't use the same name for two different pieces of code
  • Loading branch information
kaashoek committed Sep 3, 2006
1 parent 801affc commit 7abf49d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
4 changes: 2 additions & 2 deletions asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions bootasm.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bootother.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions console.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "types.h"
#include "x86.h"
#include "traps.h"
#include "defs.h"
#include "spinlock.h"
#include "dev.h"
Expand Down
1 change: 1 addition & 0 deletions ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "proc.h"
#include "defs.h"
#include "x86.h"
#include "traps.h"
#include "spinlock.h"

#define IDE_BSY 0x80
Expand Down
1 change: 1 addition & 0 deletions picirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions traps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 0 additions & 9 deletions x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7abf49d

Please sign in to comment.