diff options
author | rtm <rtm> | 2006-08-10 02:07:10 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-08-10 02:07:10 +0000 |
commit | 8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3 (patch) | |
tree | 8e04f2b39be9be0a06e2b14c2b24ed7328766c7e /trap.c | |
parent | 28d9ef04ddaa4cf32f3c63c976afdc535a36db98 (diff) | |
download | xv6-labs-8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3.tar.gz xv6-labs-8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3.tar.bz2 xv6-labs-8a8be1b8c36e38f58f8ba3e425b6e701ad65abf3.zip |
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...
Diffstat (limited to 'trap.c')
-rw-r--r-- | trap.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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; } |