Skip to content

Commit

Permalink
[MIPS] Make prepare_frametrace() not clobber v0
Browse files Browse the repository at this point in the history
Since lmo commit 323a380 ("Simplify
dump_stack()") made prepare_frametrace() always inlined, using $2 (v0)
in __asm__ is not safe anymore.  We can use $1 (at) instead.  Also we
should use "dla" instead of "la" for 64-bit kernel.

Signed-off-by: Atsushi Nemoto <[email protected]>
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
atsushi-nemoto authored and ralfbaechle committed Sep 27, 2006
1 parent f650279 commit 898d229
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions arch/mips/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,20 @@ static void show_stacktrace(struct task_struct *task, struct pt_regs *regs)
static __always_inline void prepare_frametrace(struct pt_regs *regs)
{
__asm__ __volatile__(
"1: la $2, 1b\n\t"
".set push\n\t"
".set noat\n\t"
#ifdef CONFIG_64BIT
"sd $2, %0\n\t"
"1: dla $1, 1b\n\t"
"sd $1, %0\n\t"
"sd $29, %1\n\t"
"sd $31, %2\n\t"
#else
"sw $2, %0\n\t"
"1: la $1, 1b\n\t"
"sw $1, %0\n\t"
"sw $29, %1\n\t"
"sw $31, %2\n\t"
#endif
".set pop\n\t"
: "=m" (regs->cp0_epc),
"=m" (regs->regs[29]), "=m" (regs->regs[31])
: : "memory");
Expand Down

0 comments on commit 898d229

Please sign in to comment.