summaryrefslogtreecommitdiff
path: root/trap.c
diff options
context:
space:
mode:
Diffstat (limited to 'trap.c')
-rw-r--r--trap.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/trap.c b/trap.c
index 7031223..b172a77 100644
--- a/trap.c
+++ b/trap.c
@@ -21,7 +21,7 @@ tvinit(void)
for(i = 0; i < 256; i++){
SETGATE(idt[i], 1, SEG_KCODE << 3, vectors[i], 0);
}
- SETGATE(idt[T_SYSCALL], T_SYSCALL, SEG_KCODE << 3, vectors[48], 3);
+ SETGATE(idt[T_SYSCALL], 1, SEG_KCODE << 3, vectors[48], 3);
}
void
@@ -40,12 +40,12 @@ trap(struct trapframe *tf)
v, tf->eip, cpu(), cpus[cpu()].nlock);
panic("interrupt while holding a lock");
}
- if((read_eflags() & FL_IF) == 0)
- panic("interrupt but interrupts now disabled");
if(v == T_SYSCALL){
struct proc *cp = curproc[cpu()];
int num = cp->tf->eax;
+ if((read_eflags() & FL_IF) == 0)
+ panic("syscall but interrupts now disabled");
if(cp == 0)
panic("syscall with no proc");
if(cp->killed)
@@ -73,6 +73,9 @@ trap(struct trapframe *tf)
return;
}
+ //if(read_eflags() & FL_IF)
+ //panic("interrupt but interrupts enabled");
+
if(v == (IRQ_OFFSET + IRQ_TIMER)){
struct proc *cp = curproc[cpu()];
lapic_timerintr();
@@ -97,5 +100,12 @@ trap(struct trapframe *tf)
return;
}
+ if(v == (IRQ_OFFSET + IRQ_KBD)){
+ kbd_intr();
+ return;
+ }
+
+ cprintf("trap %d\n", v);
+
return;
}