Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: math-emu: dsemul: Reduce `get_isa16_mode' clutter

Signed-off-by: Maciej W. Rozycki <macro@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12178/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Maciej W. Rozycki and committed by
Ralf Baechle
6d7b1415 29e28003

+9 -8
+9 -8
arch/mips/math-emu/dsemul.c
··· 38 38 */ 39 39 int mips_dsemul(struct pt_regs *regs, mips_instruction ir, unsigned long cpc) 40 40 { 41 + int isa16 = get_isa16_mode(regs->cp0_epc); 41 42 mips_instruction break_math; 42 43 struct emuframe __user *fr; 43 44 int err; ··· 48 47 return -1; 49 48 50 49 /* microMIPS instructions */ 51 - if (get_isa16_mode(regs->cp0_epc)) { 50 + if (isa16) { 52 51 union mips_instruction insn = { .word = ir }; 53 52 54 53 /* NOP16 aka MOVE16 $0, $0 */ ··· 82 81 * multiprocessor support. For Linux we use a BREAK 514 83 82 * instruction causing a breakpoint exception. 84 83 */ 85 - break_math = BREAK_MATH(get_isa16_mode(regs->cp0_epc)); 84 + break_math = BREAK_MATH(isa16); 86 85 87 86 /* Ensure that the two instructions are in the same cache line */ 88 87 fr = (struct emuframe __user *) ··· 92 91 if (unlikely(!access_ok(VERIFY_WRITE, fr, sizeof(struct emuframe)))) 93 92 return SIGBUS; 94 93 95 - if (get_isa16_mode(regs->cp0_epc)) { 94 + if (isa16) { 96 95 err = __put_user(ir >> 16, 97 96 (u16 __user *)(&fr->emul)); 98 97 err |= __put_user(ir & 0xffff, ··· 114 113 return SIGBUS; 115 114 } 116 115 117 - regs->cp0_epc = ((unsigned long) &fr->emul) | 118 - get_isa16_mode(regs->cp0_epc); 116 + regs->cp0_epc = (unsigned long)&fr->emul | isa16; 119 117 120 118 flush_cache_sigtramp((unsigned long)&fr->emul); 121 119 ··· 123 123 124 124 int do_dsemulret(struct pt_regs *xcp) 125 125 { 126 + int isa16 = get_isa16_mode(xcp->cp0_epc); 126 127 struct emuframe __user *fr; 127 128 unsigned long epc; 128 129 u32 insn, cookie; ··· 146 145 * - Is the instruction pointed to by the EPC an BREAK_MATH? 147 146 * - Is the following memory word the BD_COOKIE? 148 147 */ 149 - if (get_isa16_mode(xcp->cp0_epc)) { 148 + if (isa16) { 150 149 err = __get_user(instr[0], 151 150 (u16 __user *)(&fr->badinst)); 152 151 err |= __get_user(instr[1], ··· 157 156 } 158 157 err |= __get_user(cookie, &fr->cookie); 159 158 160 - if (unlikely(err || insn != BREAK_MATH(get_isa16_mode(xcp->cp0_epc)) || 161 - cookie != BD_COOKIE)) { 159 + if (unlikely(err || 160 + insn != BREAK_MATH(isa16) || cookie != BD_COOKIE)) { 162 161 MIPS_FPU_EMU_INC_STATS(errors); 163 162 return 0; 164 163 }