From 2e651ea1596b0ee25af4fcdc4cd13cbb33ffc254 Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Wed, 23 Jan 2013 16:30:36 +0530 Subject: ARC: Unaligned access emulation ARC700 doesn't natively support unaligned access, but can be emulated -Unaligned Access Exception -Disassembly at the Fault address to find the exact insn (long/short) Also per Arnd's comment, we runtime control it using 2 sysctl knobs: * SYSCTL_ARCH_UNALIGN_ALLOW: Runtime enable/disble * SYSCTL_ARCH_UNALIGN_NO_WARN: Warn on each emulation attempt Originally contributed by Tim Yao Signed-off-by: Vineet Gupta Cc: Tim Yao Acked-by: Arnd Bergmann --- arch/arc/kernel/entry.S | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'arch/arc/kernel/entry.S') diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S index 021cfa46a1dc..f8efade15368 100644 --- a/arch/arc/kernel/entry.S +++ b/arch/arc/kernel/entry.S @@ -7,6 +7,9 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * + * vineetg: May 2011 + * -Userspace unaligned access emulation + * * vineetg: Feb 2011 (ptrace low level code fixes) * -traced syscall return code (r0) was not saved into pt_regs for restoring * into user reg-file when traded task rets to user space. @@ -387,7 +390,17 @@ ARC_ENTRY EV_TLBProtV mov r1, r4 ; faulting address mov r2, sp ; pt_regs +#ifdef CONFIG_ARC_MISALIGN_ACCESS + SAVE_CALLEE_SAVED_USER + mov r3, sp ; callee_regs +#endif + bl do_misaligned_access + +#ifdef CONFIG_ARC_MISALIGN_ACCESS + DISCARD_CALLEE_SAVED_USER +#endif + b ret_from_exception ARC_EXIT EV_TLBProtV -- cgit v1.2.1