Skip to content

Commit

Permalink
sh: Setup the frame register in asm code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matt Fleming authored and Paul Mundt committed Aug 13, 2009
1 parent bd35386 commit 0b93048
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions arch/sh/include/asm/entry-macros.S
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,15 @@
#else
# define PREF(x) nop
#endif

/*
* Macro for use within assembly. Because the DWARF unwinder
* needs to use the frame register to unwind the stack, we
* need to setup r14 with the value of the stack pointer as
* the return address is usually on the stack somewhere.
*/
.macro setup_frame_reg
#ifdef CONFIG_DWARF_UNWINDER
mov r15, r14
#endif
.endm
1 change: 1 addition & 0 deletions arch/sh/kernel/cpu/sh3/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ ENTRY(tlb_protection_violation_store)
mov #1, r5

call_dpf:
setup_frame_reg
mov.l 1f, r0
mov r5, r8
mov.l @r0, r6
Expand Down
1 change: 1 addition & 0 deletions arch/sh/kernel/entry-common.S
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ ret_from_fork:
* system calls and debug traps through their respective jump tables.
*/
ENTRY(system_call)
setup_frame_reg
#if !defined(CONFIG_CPU_SH2)
mov.l 1f, r9
mov.l @r9, r8 ! Read from TRA (Trap Address) Register
Expand Down

0 comments on commit 0b93048

Please sign in to comment.