MN10300: Extract the displacement from an insn correctly in misalignment fixup

Extract the displacement from an MN10300 instruction correctly in the
misalignment fixup handler.

The code should extract the displacement in LSB order, not MSB order.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by David Howells and committed by Linus Torvalds b308bf3b ee6e740c

+13 -13
+13 -13
arch/mn10300/mm/misalignment.c
··· 43 #endif 44 45 static int misalignment_addr(unsigned long *registers, unsigned params, 46 - unsigned opcode, unsigned disp, 47 void **_address, unsigned long **_postinc); 48 49 static int misalignment_reg(unsigned long *registers, unsigned params, 50 - unsigned opcode, unsigned disp, 51 unsigned long **_register); 52 53 static const unsigned Dreg_index[] = { ··· 304 const struct exception_table_entry *fixup; 305 const struct mn10300_opcode *pop; 306 unsigned long *registers = (unsigned long *) regs; 307 - unsigned long data, *store, *postinc; 308 mm_segment_t seg; 309 siginfo_t info; 310 - uint32_t opcode, disp, noc, xo, xm; 311 uint8_t *pc, byte; 312 void *address; 313 - unsigned tmp, npop; 314 315 kdebug("==>misalignment({pc=%lx})", regs->pc); 316 ··· 445 446 /* grab the extra displacement (note it's LSB first) */ 447 disp = 0; 448 - tmp = format_tbl[pop->format].dispsz >> 3; 449 - while (tmp > 0) { 450 - tmp--; 451 - disp <<= 8; 452 - 453 pc++; 454 if (__get_user(byte, pc) != 0) 455 goto fetch_error; 456 - disp |= byte; 457 } 458 459 set_fs(KERNEL_XDS); 460 if (fixup || regs->epsw & EPSW_nSL) ··· 538 * determine the address that was being accessed 539 */ 540 static int misalignment_addr(unsigned long *registers, unsigned params, 541 - unsigned opcode, unsigned disp, 542 void **_address, unsigned long **_postinc) 543 { 544 unsigned long *postinc = NULL, address = 0, tmp; ··· 644 * determine the register that is acting as source/dest 645 */ 646 static int misalignment_reg(unsigned long *registers, unsigned params, 647 - unsigned opcode, unsigned disp, 648 unsigned long **_register) 649 { 650 params &= 0x7fffffff;
··· 43 #endif 44 45 static int misalignment_addr(unsigned long *registers, unsigned params, 46 + unsigned opcode, unsigned long disp, 47 void **_address, unsigned long **_postinc); 48 49 static int misalignment_reg(unsigned long *registers, unsigned params, 50 + unsigned opcode, unsigned long disp, 51 unsigned long **_register); 52 53 static const unsigned Dreg_index[] = { ··· 304 const struct exception_table_entry *fixup; 305 const struct mn10300_opcode *pop; 306 unsigned long *registers = (unsigned long *) regs; 307 + unsigned long data, *store, *postinc, disp; 308 mm_segment_t seg; 309 siginfo_t info; 310 + uint32_t opcode, noc, xo, xm; 311 uint8_t *pc, byte; 312 void *address; 313 + unsigned tmp, npop, dispsz, loop; 314 315 kdebug("==>misalignment({pc=%lx})", regs->pc); 316 ··· 445 446 /* grab the extra displacement (note it's LSB first) */ 447 disp = 0; 448 + dispsz = format_tbl[pop->format].dispsz; 449 + for (loop = 0; loop < dispsz; loop += 8) { 450 pc++; 451 if (__get_user(byte, pc) != 0) 452 goto fetch_error; 453 + disp |= byte << loop; 454 + kdebug("{%p} disp[%02x]=%02x", pc, loop, byte); 455 } 456 + 457 + kdebug("disp=%lx", disp); 458 459 set_fs(KERNEL_XDS); 460 if (fixup || regs->epsw & EPSW_nSL) ··· 538 * determine the address that was being accessed 539 */ 540 static int misalignment_addr(unsigned long *registers, unsigned params, 541 + unsigned opcode, unsigned long disp, 542 void **_address, unsigned long **_postinc) 543 { 544 unsigned long *postinc = NULL, address = 0, tmp; ··· 644 * determine the register that is acting as source/dest 645 */ 646 static int misalignment_reg(unsigned long *registers, unsigned params, 647 + unsigned opcode, unsigned long disp, 648 unsigned long **_register) 649 { 650 params &= 0x7fffffff;