Skip to content

Commit 0b93048

Browse files
mflemingpmundt
authored andcommitted
sh: Setup the frame register in asm code
In order to use DWARF unwinder info the frame register has to contain a valid value. Whilst GCC takes care of this for C code, we have to do it ourselves for assembly. Signed-off-by: Matt Fleming <matt@console-pimps.org> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
1 parent bd35386 commit 0b93048

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎arch/sh/include/asm/entry-macros.S‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,15 @@
108108
#else
109109
# define PREF(x) nop
110110
#endif
111+
112+
/*
113+
* Macro for use within assembly. Because the DWARF unwinder
114+
* needs to use the frame register to unwind the stack, we
115+
* need to setup r14 with the value of the stack pointer as
116+
* the return address is usually on the stack somewhere.
117+
*/
118+
.macro setup_frame_reg
119+
#ifdef CONFIG_DWARF_UNWINDER
120+
mov r15, r14
121+
#endif
122+
.endm

‎arch/sh/kernel/cpu/sh3/entry.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ ENTRY(tlb_protection_violation_store)
137137
mov #1, r5
138138

139139
call_dpf:
140+
setup_frame_reg
140141
mov.l 1f, r0
141142
mov r5, r8
142143
mov.l @r0, r6

‎arch/sh/kernel/entry-common.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ ret_from_fork:
285285
* system calls and debug traps through their respective jump tables.
286286
*/
287287
ENTRY(system_call)
288+
setup_frame_reg
288289
#if !defined(CONFIG_CPU_SH2)
289290
mov.l 1f, r9
290291
mov.l @r9, r8 ! Read from TRA (Trap Address) Register

0 commit comments

Comments
 (0)