unaligned.c (45deb5faeb9e02951361ceba5ffee721745661c3) unaligned.c (7cba4128c2c6e9c67a819c5946ed8066c7306418)
1/*
2 * Handle unaligned accesses by emulation.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1998, 1999, 2002 by Ralf Baechle

--- 95 unchanged lines hidden (view full) ---

104static u32 unaligned_instructions;
105static u32 unaligned_action;
106#else
107#define unaligned_action UNALIGNED_ACTION_QUIET
108#endif
109extern void show_registers(struct pt_regs *regs);
110
111static void emulate_load_store_insn(struct pt_regs *regs,
1/*
2 * Handle unaligned accesses by emulation.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1998, 1999, 2002 by Ralf Baechle

--- 95 unchanged lines hidden (view full) ---

104static u32 unaligned_instructions;
105static u32 unaligned_action;
106#else
107#define unaligned_action UNALIGNED_ACTION_QUIET
108#endif
109extern void show_registers(struct pt_regs *regs);
110
111static void emulate_load_store_insn(struct pt_regs *regs,
112 void __user *addr, unsigned int __user *pc)
112 void __user *addr, unsigned int *pc)
113{
114 unsigned long origpc, orig31, value;
115 union mips_instruction insn;
116 unsigned int res;
117 bool user = user_mode(regs);
118
119 origpc = (unsigned long)pc;
120 orig31 = regs->regs[31];

--- 1349 unchanged lines hidden (view full) ---

1470 die_if_kernel
1471 ("Unhandled kernel unaligned access or invalid instruction", regs);
1472 force_sig(SIGILL);
1473}
1474
1475asmlinkage void do_ade(struct pt_regs *regs)
1476{
1477 enum ctx_state prev_state;
113{
114 unsigned long origpc, orig31, value;
115 union mips_instruction insn;
116 unsigned int res;
117 bool user = user_mode(regs);
118
119 origpc = (unsigned long)pc;
120 orig31 = regs->regs[31];

--- 1349 unchanged lines hidden (view full) ---

1470 die_if_kernel
1471 ("Unhandled kernel unaligned access or invalid instruction", regs);
1472 force_sig(SIGILL);
1473}
1474
1475asmlinkage void do_ade(struct pt_regs *regs)
1476{
1477 enum ctx_state prev_state;
1478 unsigned int __user *pc;
1478 unsigned int *pc;
1479
1480 prev_state = exception_enter();
1481 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,
1482 1, regs, regs->cp0_badvaddr);
1483 /*
1484 * Did we catch a fault trying to load an instruction?
1485 */
1486 if (regs->cp0_badvaddr == regs->cp0_epc)

--- 34 unchanged lines hidden (view full) ---

1521 return;
1522 }
1523
1524 goto sigbus;
1525 }
1526
1527 if (unaligned_action == UNALIGNED_ACTION_SHOW)
1528 show_registers(regs);
1479
1480 prev_state = exception_enter();
1481 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,
1482 1, regs, regs->cp0_badvaddr);
1483 /*
1484 * Did we catch a fault trying to load an instruction?
1485 */
1486 if (regs->cp0_badvaddr == regs->cp0_epc)

--- 34 unchanged lines hidden (view full) ---

1521 return;
1522 }
1523
1524 goto sigbus;
1525 }
1526
1527 if (unaligned_action == UNALIGNED_ACTION_SHOW)
1528 show_registers(regs);
1529 pc = (unsigned int __user *)exception_epc(regs);
1529 pc = (unsigned int *)exception_epc(regs);
1530
1531 emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc);
1532
1533 return;
1534
1535sigbus:
1536 die_if_kernel("Kernel unaligned instruction access", regs);
1537 force_sig(SIGBUS);

--- 18 unchanged lines hidden ---
1530
1531 emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc);
1532
1533 return;
1534
1535sigbus:
1536 die_if_kernel("Kernel unaligned instruction access", regs);
1537 force_sig(SIGBUS);

--- 18 unchanged lines hidden ---