s/IRQ_OFFSET/T_IRQ0/: it's a trap number, not an irq number.
move the SYSCALL number up, so does not overlap the IRQ traps.
This commit is contained in:
parent
27ff8f0e6f
commit
8b75366ce4
2 changed files with 10 additions and 9 deletions
14
trap.c
14
trap.c
|
@ -45,7 +45,7 @@ trap(struct trapframe *tf)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(tf->trapno){
|
switch(tf->trapno){
|
||||||
case IRQ_OFFSET + IRQ_TIMER:
|
case T_IRQ0 + IRQ_TIMER:
|
||||||
if(cpu() == 0){
|
if(cpu() == 0){
|
||||||
acquire(&tickslock);
|
acquire(&tickslock);
|
||||||
ticks++;
|
ticks++;
|
||||||
|
@ -54,20 +54,20 @@ trap(struct trapframe *tf)
|
||||||
}
|
}
|
||||||
lapiceoi();
|
lapiceoi();
|
||||||
break;
|
break;
|
||||||
case IRQ_OFFSET + IRQ_IDE:
|
case T_IRQ0 + IRQ_IDE:
|
||||||
ideintr();
|
ideintr();
|
||||||
lapiceoi();
|
lapiceoi();
|
||||||
break;
|
break;
|
||||||
case IRQ_OFFSET + IRQ_KBD:
|
case T_IRQ0 + IRQ_KBD:
|
||||||
kbdintr();
|
kbdintr();
|
||||||
lapiceoi();
|
lapiceoi();
|
||||||
break;
|
break;
|
||||||
case IRQ_OFFSET + IRQ_COM1:
|
case T_IRQ0 + IRQ_COM1:
|
||||||
uartintr();
|
uartintr();
|
||||||
lapiceoi();
|
lapiceoi();
|
||||||
break;
|
break;
|
||||||
case IRQ_OFFSET + 7:
|
case T_IRQ0 + 7:
|
||||||
case IRQ_OFFSET + IRQ_SPURIOUS:
|
case T_IRQ0 + IRQ_SPURIOUS:
|
||||||
cprintf("cpu%d: spurious interrupt at %x:%x\n",
|
cprintf("cpu%d: spurious interrupt at %x:%x\n",
|
||||||
cpu(), tf->cs, tf->eip);
|
cpu(), tf->cs, tf->eip);
|
||||||
lapiceoi();
|
lapiceoi();
|
||||||
|
@ -94,7 +94,7 @@ trap(struct trapframe *tf)
|
||||||
|
|
||||||
// Force process to give up CPU on clock tick.
|
// Force process to give up CPU on clock tick.
|
||||||
// If interrupts were on while locks held, would need to check nlock.
|
// If interrupts were on while locks held, would need to check nlock.
|
||||||
if(cp && cp->state == RUNNING && tf->trapno == IRQ_OFFSET+IRQ_TIMER)
|
if(cp && cp->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
|
||||||
yield();
|
yield();
|
||||||
|
|
||||||
// Check if the process has been killed since we yielded
|
// Check if the process has been killed since we yielded
|
||||||
|
|
5
traps.h
5
traps.h
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
// These are arbitrarily chosen, but with care not to overlap
|
// These are arbitrarily chosen, but with care not to overlap
|
||||||
// processor defined exceptions or interrupt vectors.
|
// processor defined exceptions or interrupt vectors.
|
||||||
#define T_SYSCALL 48 // system call
|
#define T_SYSCALL 64 // system call
|
||||||
#define T_DEFAULT 500 // catchall
|
#define T_DEFAULT 500 // catchall
|
||||||
|
|
||||||
#define IRQ_OFFSET 32 // IRQ 0 corresponds to int IRQ_OFFSET
|
#define T_IRQ0 32 // IRQ 0 corresponds to int T_IRQ
|
||||||
|
|
||||||
#define IRQ_TIMER 0
|
#define IRQ_TIMER 0
|
||||||
#define IRQ_KBD 1
|
#define IRQ_KBD 1
|
||||||
|
@ -35,3 +35,4 @@
|
||||||
#define IRQ_IDE 14
|
#define IRQ_IDE 14
|
||||||
#define IRQ_ERROR 19
|
#define IRQ_ERROR 19
|
||||||
#define IRQ_SPURIOUS 31
|
#define IRQ_SPURIOUS 31
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue