diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2017-07-22 18:33:52 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2017-07-22 18:33:52 +0000 |
commit | b112bc31099df5a89f0a8905427b6034e56dc0ef (patch) | |
tree | e02459b5b44ed63b7b1b6524c5192e4fd526f7bb /sys/arch | |
parent | cd9ba2f11d27ae56edd766d7f7f5565e271be5a3 (diff) |
Rename variables for clarity.
It does not seem necessary to provide initial value for `sicode'.
When `signal' gets set, `sicode' is set as well.
OK deraadt@, kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mips64/mips64/trap.c | 83 |
1 files changed, 41 insertions, 42 deletions
diff --git a/sys/arch/mips64/mips64/trap.c b/sys/arch/mips64/mips64/trap.c index 2ab8fbf3e29..f01bff0c8a7 100644 --- a/sys/arch/mips64/mips64/trap.c +++ b/sys/arch/mips64/mips64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.126 2017/07/22 16:44:15 visa Exp $ */ +/* $OpenBSD: trap.c,v 1.127 2017/07/22 18:33:51 visa Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -267,12 +267,11 @@ void itsa(struct trapframe *trapframe, struct cpu_info *ci, struct proc *p, int type) { - int i; unsigned ucode = 0; vm_prot_t ftype; extern vaddr_t onfault_table[]; int onfault; - int typ = 0; + int signal, sicode; union sigval sv; struct pcb *pcb; @@ -436,13 +435,13 @@ fault_common_no_miss: } ucode = ftype; - i = SIGSEGV; - typ = SEGV_MAPERR; + signal = SIGSEGV; + sicode = SEGV_MAPERR; if (rv == EACCES) - typ = SEGV_ACCERR; + sicode = SEGV_ACCERR; if (rv == EIO) { - i = SIGBUS; - typ = BUS_OBJERR; + signal = SIGBUS; + sicode = BUS_OBJERR; } break; } @@ -450,14 +449,14 @@ fault_common_no_miss: case T_ADDR_ERR_LD+T_USER: /* misaligned or kseg access */ case T_ADDR_ERR_ST+T_USER: /* misaligned or kseg access */ ucode = 0; /* XXX should be PROT_something */ - i = SIGBUS; - typ = BUS_ADRALN; + signal = SIGBUS; + sicode = BUS_ADRALN; break; case T_BUS_ERR_IFETCH+T_USER: /* BERR asserted to cpu */ case T_BUS_ERR_LD_ST+T_USER: /* BERR asserted to cpu */ ucode = 0; /* XXX should be PROT_something */ - i = SIGBUS; - typ = BUS_OBJERR; + signal = SIGBUS; + sicode = BUS_OBJERR; break; case T_SYSCALL+T_USER: @@ -466,7 +465,7 @@ fault_common_no_miss: struct sysent *callp; unsigned int code; register_t tpc; - int numsys, error; + int error, numarg, numsys; struct args { register_t i[8]; } args; @@ -498,16 +497,16 @@ fault_common_no_miss: callp += p->p_p->ps_emul->e_nosys; /* (illegal) */ else callp += code; - i = callp->sy_argsize / sizeof(register_t); + numarg = callp->sy_argsize / sizeof(register_t); args.i[0] = locr0->a1; args.i[1] = locr0->a2; args.i[2] = locr0->a3; - if (i > 3) { + if (numarg > 3) { args.i[3] = locr0->a4; args.i[4] = locr0->a5; args.i[5] = locr0->a6; args.i[6] = locr0->a7; - if (i > 7) + if (numarg > 7) if ((error = copyin((void *)locr0->sp, &args.i[7], sizeof(register_t)))) goto bad; @@ -519,12 +518,12 @@ fault_common_no_miss: else callp += code; - i = callp->sy_narg; + numarg = callp->sy_narg; args.i[0] = locr0->a0; args.i[1] = locr0->a1; args.i[2] = locr0->a2; args.i[3] = locr0->a3; - if (i > 4) { + if (numarg > 4) { args.i[4] = locr0->a4; args.i[5] = locr0->a5; args.i[6] = locr0->a6; @@ -593,8 +592,8 @@ fault_common_no_miss: switch ((instr & BREAK_VAL_MASK) >> BREAK_VAL_SHIFT) { case 6: /* gcc range error */ - i = SIGFPE; - typ = FPE_FLTSUB; + signal = SIGFPE; + sicode = FPE_FLTSUB; /* skip instruction */ if (trapframe->cause & CR_BR_DELAY) locr0->pc = MipsEmulateBranch(locr0, @@ -603,8 +602,8 @@ fault_common_no_miss: locr0->pc += 4; break; case 7: /* gcc3 divide by zero */ - i = SIGFPE; - typ = FPE_INTDIV; + signal = SIGFPE; + sicode = FPE_INTDIV; /* skip instruction */ if (trapframe->cause & CR_BR_DELAY) locr0->pc = MipsEmulateBranch(locr0, @@ -627,11 +626,11 @@ fault_common_no_miss: KERNEL_LOCK(); process_sstep(p, 0); KERNEL_UNLOCK(); - typ = TRAP_BRKPT; + sicode = TRAP_BRKPT; } else { - typ = TRAP_TRACE; + sicode = TRAP_TRACE; } - i = SIGTRAP; + signal = SIGTRAP; break; #endif #ifdef FPUEMUL @@ -663,8 +662,8 @@ fault_common_no_miss: /* FALLTHROUGH */ #endif default: - typ = TRAP_TRACE; - i = SIGTRAP; + signal = SIGTRAP; + sicode = TRAP_TRACE; break; } break; @@ -679,8 +678,8 @@ fault_common_no_miss: if (trapframe->cause & CR_BR_DELAY) va += 4; printf("watch exception @ %p\n", va); - i = SIGTRAP; - typ = TRAP_BRKPT; + signal = SIGTRAP; + sicode = TRAP_BRKPT; break; } @@ -709,11 +708,11 @@ fault_common_no_miss: */ if ((instr & 0xfc00003f) == 0x00000034 /* teq */ && (instr & 0x001fffc0) == ((ZERO << 16) | (7 << 6))) { - i = SIGFPE; - typ = FPE_INTDIV; + signal = SIGFPE; + sicode = FPE_INTDIV; } else { - i = SIGEMT; /* Stuff it with something for now */ - typ = 0; + signal = SIGEMT; /* Stuff it with something for now */ + sicode = 0; } break; } @@ -731,8 +730,8 @@ fault_common_no_miss: /* Get the faulting instruction. */ if (copyin32((void *)va, &inst.word) != 0) { - i = SIGBUS; - typ = BUS_OBJERR; + signal = SIGBUS; + sicode = BUS_OBJERR; break; } @@ -753,8 +752,8 @@ fault_common_no_miss: return; } - i = SIGILL; - typ = ILL_ILLOPC; + signal = SIGILL; + sicode = ILL_ILLOPC; break; } @@ -765,8 +764,8 @@ fault_common_no_miss: * unusable coprocessor number. */ if ((trapframe->cause & CR_COP_ERR) != CR_COP1_ERR) { - i = SIGILL; /* only FPU instructions allowed */ - typ = ILL_ILLOPC; + signal = SIGILL; /* only FPU instructions allowed */ + sicode = ILL_ILLOPC; break; } #ifdef FPUEMUL @@ -786,8 +785,8 @@ fault_common_no_miss: return; case T_OVFLOW+T_USER: - i = SIGFPE; - typ = FPE_FLTOVF; + signal = SIGFPE; + sicode = FPE_FLTOVF; break; case T_ADDR_ERR_LD: /* misaligned access */ @@ -858,7 +857,7 @@ fault_common_no_miss: p->p_md.md_regs->badvaddr = trapframe->badvaddr; sv.sival_ptr = (void *)trapframe->badvaddr; KERNEL_LOCK(); - trapsignal(p, i, ucode, typ, sv); + trapsignal(p, signal, ucode, sicode, sv); KERNEL_UNLOCK(); } |