diff options
Diffstat (limited to 'arch/arc/kernel/traps.c')
-rw-r--r-- | arch/arc/kernel/traps.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c index c6396b48fcd2..ec802c52a1ca 100644 --- a/arch/arc/kernel/traps.c +++ b/arch/arc/kernel/traps.c | |||
@@ -7,6 +7,9 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 as | 7 | * it under the terms of the GNU General Public License version 2 as |
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | * | 9 | * |
10 | * vineetg: May 2011 | ||
11 | * -user-space unaligned access emulation | ||
12 | * | ||
10 | * Rahul Trivedi: Codito Technologies 2004 | 13 | * Rahul Trivedi: Codito Technologies 2004 |
11 | */ | 14 | */ |
12 | 15 | ||
@@ -16,6 +19,7 @@ | |||
16 | #include <asm/ptrace.h> | 19 | #include <asm/ptrace.h> |
17 | #include <asm/setup.h> | 20 | #include <asm/setup.h> |
18 | #include <asm/kprobes.h> | 21 | #include <asm/kprobes.h> |
22 | #include <asm/unaligned.h> | ||
19 | 23 | ||
20 | void __init trap_init(void) | 24 | void __init trap_init(void) |
21 | { | 25 | { |
@@ -79,7 +83,29 @@ DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC) | |||
79 | DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR) | 83 | DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR) |
80 | DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) | 84 | DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) |
81 | 85 | ||
86 | #ifdef CONFIG_ARC_MISALIGN_ACCESS | ||
87 | /* | ||
88 | * Entry Point for Misaligned Data access Exception, for emulating in software | ||
89 | */ | ||
90 | int do_misaligned_access(unsigned long cause, unsigned long address, | ||
91 | struct pt_regs *regs, struct callee_regs *cregs) | ||
92 | { | ||
93 | if (misaligned_fixup(address, regs, cause, cregs) != 0) { | ||
94 | siginfo_t info; | ||
95 | |||
96 | info.si_signo = SIGBUS; | ||
97 | info.si_errno = 0; | ||
98 | info.si_code = BUS_ADRALN; | ||
99 | info.si_addr = (void __user *)address; | ||
100 | return handle_exception(cause, "Misaligned Access", regs, | ||
101 | &info); | ||
102 | } | ||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | #else | ||
82 | DO_ERROR_INFO(SIGSEGV, "Misaligned Access", do_misaligned_access, SEGV_ACCERR) | 107 | DO_ERROR_INFO(SIGSEGV, "Misaligned Access", do_misaligned_access, SEGV_ACCERR) |
108 | #endif | ||
83 | 109 | ||
84 | /* | 110 | /* |
85 | * Entry point for miscll errors such as Nested Exceptions | 111 | * Entry point for miscll errors such as Nested Exceptions |