aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2013-04-04 05:07:52 -0400
committerVineet Gupta <vgupta@synopsys.com>2013-05-07 04:13:55 -0400
commitc723ea4620a67fb0dbed5f5c33183543799e2177 (patch)
tree19ee9abf49caa767017d41d2a337d8f174a8a87f
parentbd3c8b11eccddd311c9e6a56aa00c1af24ea5958 (diff)
ARC: unaligned access emulation error handling consolidation
If CONFIG_ARC_MISALIGN_ACCESS is not enabled, or if the fixup fails, call the same error handler: same signal/si_code to user (SIGBUS) Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/kernel/entry.S4
-rw-r--r--arch/arc/kernel/traps.c17
2 files changed, 6 insertions, 15 deletions
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
index 91eeab81f52d..666a486f1e7b 100644
--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -393,12 +393,12 @@ ARC_ENTRY EV_TLBProtV
393#ifdef CONFIG_ARC_MISALIGN_ACCESS 393#ifdef CONFIG_ARC_MISALIGN_ACCESS
394 SAVE_CALLEE_SAVED_USER 394 SAVE_CALLEE_SAVED_USER
395 mov r3, sp ; callee_regs 395 mov r3, sp ; callee_regs
396#endif
397 396
398 bl do_misaligned_access 397 bl do_misaligned_access
399 398
400#ifdef CONFIG_ARC_MISALIGN_ACCESS
401 DISCARD_CALLEE_SAVED_USER 399 DISCARD_CALLEE_SAVED_USER
400#else
401 bl do_misaligned_error
402#endif 402#endif
403 403
404 b ret_from_exception 404 b ret_from_exception
diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c
index 74839d10d80f..0471d9c9dd54 100644
--- a/arch/arc/kernel/traps.c
+++ b/arch/arc/kernel/traps.c
@@ -84,6 +84,7 @@ DO_ERROR_INFO(SIGILL, "Invalid Extn Insn", do_extension_fault, ILL_ILLOPC)
84DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC) 84DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC)
85DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR) 85DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR)
86DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) 86DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT)
87DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN)
87 88
88#ifdef CONFIG_ARC_MISALIGN_ACCESS 89#ifdef CONFIG_ARC_MISALIGN_ACCESS
89/* 90/*
@@ -92,21 +93,11 @@ DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT)
92int do_misaligned_access(unsigned long cause, unsigned long address, 93int do_misaligned_access(unsigned long cause, unsigned long address,
93 struct pt_regs *regs, struct callee_regs *cregs) 94 struct pt_regs *regs, struct callee_regs *cregs)
94{ 95{
95 if (misaligned_fixup(address, regs, cause, cregs) != 0) { 96 if (misaligned_fixup(address, regs, cause, cregs) != 0)
96 siginfo_t info; 97 return do_misaligned_error(cause, address, regs);
97 98
98 info.si_signo = SIGBUS;
99 info.si_errno = 0;
100 info.si_code = BUS_ADRALN;
101 info.si_addr = (void __user *)address;
102 return handle_exception(cause, "Misaligned Access", regs,
103 &info);
104 }
105 return 0; 99 return 0;
106} 100}
107
108#else
109DO_ERROR_INFO(SIGSEGV, "Misaligned Access", do_misaligned_access, SEGV_ACCERR)
110#endif 101#endif
111 102
112/* 103/*