diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2013-01-23 06:00:36 -0500 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2013-02-15 12:46:06 -0500 |
commit | 2e651ea1596b0ee25af4fcdc4cd13cbb33ffc254 (patch) | |
tree | 51210f1cd80327a00e2fd4b0d20849b6329925d6 /arch/arc/include | |
parent | bf14e3b979a01cd7298d631736f965fe83c6e2bc (diff) |
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 <tim.yao@amlogic.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Tim Yao <tim.yao@amlogic.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arc/include')
-rw-r--r-- | arch/arc/include/asm/Kbuild | 1 | ||||
-rw-r--r-- | arch/arc/include/asm/ptrace.h | 3 | ||||
-rw-r--r-- | arch/arc/include/asm/unaligned.h | 29 |
3 files changed, 32 insertions, 1 deletions
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index 78e982dad537..b24089c974a9 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild | |||
@@ -52,7 +52,6 @@ generic-y += topology.h | |||
52 | generic-y += trace_clock.h | 52 | generic-y += trace_clock.h |
53 | generic-y += types.h | 53 | generic-y += types.h |
54 | generic-y += ucontext.h | 54 | generic-y += ucontext.h |
55 | generic-y += unaligned.h | ||
56 | generic-y += user.h | 55 | generic-y += user.h |
57 | generic-y += vga.h | 56 | generic-y += vga.h |
58 | generic-y += xor.h | 57 | generic-y += xor.h |
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h index 063ed0040ef7..df5b95213776 100644 --- a/arch/arc/include/asm/ptrace.h +++ b/arch/arc/include/asm/ptrace.h | |||
@@ -97,6 +97,9 @@ struct callee_regs { | |||
97 | sp; \ | 97 | sp; \ |
98 | }) | 98 | }) |
99 | 99 | ||
100 | /* return 1 if PC in delay slot */ | ||
101 | #define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK) | ||
102 | |||
100 | #define in_syscall(regs) (regs->event & orig_r8_IS_SCALL) | 103 | #define in_syscall(regs) (regs->event & orig_r8_IS_SCALL) |
101 | #define in_brkpt_trap(regs) (regs->event & orig_r8_IS_BRKPT) | 104 | #define in_brkpt_trap(regs) (regs->event & orig_r8_IS_BRKPT) |
102 | 105 | ||
diff --git a/arch/arc/include/asm/unaligned.h b/arch/arc/include/asm/unaligned.h new file mode 100644 index 000000000000..5dbe63f17b66 --- /dev/null +++ b/arch/arc/include/asm/unaligned.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_ARC_UNALIGNED_H | ||
10 | #define _ASM_ARC_UNALIGNED_H | ||
11 | |||
12 | /* ARC700 can't handle unaligned Data accesses. */ | ||
13 | |||
14 | #include <asm-generic/unaligned.h> | ||
15 | #include <asm/ptrace.h> | ||
16 | |||
17 | #ifdef CONFIG_ARC_MISALIGN_ACCESS | ||
18 | int misaligned_fixup(unsigned long address, struct pt_regs *regs, | ||
19 | unsigned long cause, struct callee_regs *cregs); | ||
20 | #else | ||
21 | static inline int | ||
22 | misaligned_fixup(unsigned long address, struct pt_regs *regs, | ||
23 | unsigned long cause, struct callee_regs *cregs) | ||
24 | { | ||
25 | return 0; | ||
26 | } | ||
27 | #endif | ||
28 | |||
29 | #endif /* _ASM_ARC_UNALIGNED_H */ | ||