diff options
author | Vineet Gupta <Vineet.Gupta1@synopsys.com> | 2013-08-20 04:08:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-29 12:47:29 -0400 |
commit | 9b2c750d8e81da33cdf6e16db911faa2008652cd (patch) | |
tree | 551cbb516890e8fe8d92d3d79714836529a82168 /arch | |
parent | 6e4fdb803584635587bd4dc00d1f8c0883a02d3b (diff) |
ARC: gdbserver breakage in Big-Endian configuration #1
[Based on mainline commit 502a0c775c7f0a: "ARC: pt_regs update #5"]
gdbserver needs @stop_pc, served by ptrace, but fetched from pt_regs
differently, based on in_brkpt_traps(), which in turn relies on
additional machine state in pt_regs->event bitfield.
unsigned long orig_r8:16, event:16;
For big endian config, this macro was returning false, despite being in
breakpoint Trap exception, causing wrong @stop_pc to be returned to gdb.
Issue #1: In BE, @event above is at offset 2 in word, while a STW insn
at offset 0 was used to update it. Resort to using ST insn
which updates the half-word at right location.
Issue #2: The union involving bitfields causes all the members to be
laid out at offset 0. So with fix #1 above, ASM was now
updating at offset 2, "C" code was still referencing at
offset 0. Fixed by wrapping bitfield in a struct.
Reported-by: Noam Camus <noamc@ezchip.com>
Tested-by: Anton Kolesov <akolesov@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arc/include/asm/ptrace.h | 2 | ||||
-rw-r--r-- | arch/arc/kernel/entry.S | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h index 6179de7e07c2..2046a89a57cf 100644 --- a/arch/arc/include/asm/ptrace.h +++ b/arch/arc/include/asm/ptrace.h | |||
@@ -52,12 +52,14 @@ struct pt_regs { | |||
52 | 52 | ||
53 | /*to distinguish bet excp, syscall, irq */ | 53 | /*to distinguish bet excp, syscall, irq */ |
54 | union { | 54 | union { |
55 | struct { | ||
55 | #ifdef CONFIG_CPU_BIG_ENDIAN | 56 | #ifdef CONFIG_CPU_BIG_ENDIAN |
56 | /* so that assembly code is same for LE/BE */ | 57 | /* so that assembly code is same for LE/BE */ |
57 | unsigned long orig_r8:16, event:16; | 58 | unsigned long orig_r8:16, event:16; |
58 | #else | 59 | #else |
59 | unsigned long event:16, orig_r8:16; | 60 | unsigned long event:16, orig_r8:16; |
60 | #endif | 61 | #endif |
62 | }; | ||
61 | long orig_r8_word; | 63 | long orig_r8_word; |
62 | }; | 64 | }; |
63 | }; | 65 | }; |
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S index 0c6d664d4a83..6dbe359c760d 100644 --- a/arch/arc/kernel/entry.S +++ b/arch/arc/kernel/entry.S | |||
@@ -498,7 +498,7 @@ tracesys_exit: | |||
498 | trap_with_param: | 498 | trap_with_param: |
499 | 499 | ||
500 | ; stop_pc info by gdb needs this info | 500 | ; stop_pc info by gdb needs this info |
501 | stw orig_r8_IS_BRKPT, [sp, PT_orig_r8] | 501 | st orig_r8_IS_BRKPT, [sp, PT_orig_r8] |
502 | 502 | ||
503 | mov r0, r12 | 503 | mov r0, r12 |
504 | lr r1, [efa] | 504 | lr r1, [efa] |
@@ -723,7 +723,7 @@ not_exception: | |||
723 | ; things to what they were, before returning from L2 context | 723 | ; things to what they were, before returning from L2 context |
724 | ;---------------------------------------------------------------- | 724 | ;---------------------------------------------------------------- |
725 | 725 | ||
726 | ldw r9, [sp, PT_orig_r8] ; get orig_r8 to make sure it is | 726 | ld r9, [sp, PT_orig_r8] ; get orig_r8 to make sure it is |
727 | brne r9, orig_r8_IS_IRQ2, 149f ; infact a L2 ISR ret path | 727 | brne r9, orig_r8_IS_IRQ2, 149f ; infact a L2 ISR ret path |
728 | 728 | ||
729 | ld r9, [sp, PT_status32] ; get statu32_l2 (saved in pt_regs) | 729 | ld r9, [sp, PT_status32] ; get statu32_l2 (saved in pt_regs) |