diff options
author | rsc <rsc> | 2007-08-10 17:17:42 +0000 |
---|---|---|
committer | rsc <rsc> | 2007-08-10 17:17:42 +0000 |
commit | dca5b5ca2e3687f27ebf589fe3855966932840d8 (patch) | |
tree | 79be03b3d6f950eb8ceb105449674aaa614bd17e /trap.c | |
parent | 6861140a667cd7219cf9bc1e051faadfc8c46c6f (diff) | |
download | xv6-labs-dca5b5ca2e3687f27ebf589fe3855966932840d8.tar.gz xv6-labs-dca5b5ca2e3687f27ebf589fe3855966932840d8.tar.bz2 xv6-labs-dca5b5ca2e3687f27ebf589fe3855966932840d8.zip |
avoid assignments in declarations
Diffstat (limited to 'trap.c')
-rw-r--r-- | trap.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -30,9 +30,7 @@ idtinit(void) void trap(struct trapframe *tf) { - int v = tf->trapno; - - if(v == T_SYSCALL){ + if(tf->trapno == T_SYSCALL){ if(cp->killed) proc_exit(); cp->tf = tf; @@ -47,7 +45,7 @@ trap(struct trapframe *tf) // during interrupt handler. Decrement before returning. cpus[cpu()].nlock++; - switch(v){ + switch(tf->trapno){ case IRQ_OFFSET + IRQ_TIMER: lapic_timerintr(); cpus[cpu()].nlock--; @@ -82,12 +80,13 @@ trap(struct trapframe *tf) if(cp) { // Assume process divided by zero or dereferenced null, etc. cprintf("pid %d %s: unhandled trap %d on cpu %d eip %x -- kill proc\n", - cp->pid, cp->name, v, cpu(), tf->eip); + cp->pid, cp->name, tf->trapno, cpu(), tf->eip); proc_exit(); } // Otherwise it's our mistake. - cprintf("unexpected trap %d from cpu %d eip %x\n", v, cpu(), tf->eip); + cprintf("unexpected trap %d from cpu %d eip %x\n", + tf->trapno, cpu(), tf->eip); panic("trap"); } |