summaryrefslogtreecommitdiff
path: root/trap.c
diff options
context:
space:
mode:
authorrsc <rsc>2007-08-10 17:17:42 +0000
committerrsc <rsc>2007-08-10 17:17:42 +0000
commitdca5b5ca2e3687f27ebf589fe3855966932840d8 (patch)
tree79be03b3d6f950eb8ceb105449674aaa614bd17e /trap.c
parent6861140a667cd7219cf9bc1e051faadfc8c46c6f (diff)
downloadxv6-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.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/trap.c b/trap.c
index 7a47516..ed66e99 100644
--- a/trap.c
+++ b/trap.c
@@ -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");
}