From 8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3 Mon Sep 17 00:00:00 2001 From: rtm Date: Thu, 10 Aug 2006 02:07:10 +0000 Subject: low-level keyboard input (not hooked up to /dev yet) fix acquire() to cli() *before* incrementing nlock make T_SYSCALL a trap gate, not an interrupt gate sadly, various crashes if you hold down a keyboard key... --- trap.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'trap.c') 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; } -- cgit v1.2.3