diff options
author | Timur Tabi <timur@freescale.com> | 2010-12-14 23:18:51 (GMT) |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-12-17 20:18:08 (GMT) |
commit | 96805a529c3ce366f3ecfd58a8b72ec21432af1c (patch) | |
tree | 4ac41188bab2157146c8273b3d0e0dbe60e452d0 /arch/powerpc/lib/kgdb.c | |
parent | 2eb1573f01710832bbe60a4ece89cb301727612a (diff) | |
download | u-boot-96805a529c3ce366f3ecfd58a8b72ec21432af1c.tar.xz |
powerpc: fix register usage in some inline assembly code
In some usages of inline assembly, hard-coded registers were
specified when a scratch register should have been used instead.
Signed-off-by: Timur Tabi <timur@freescale.com>
Diffstat (limited to 'arch/powerpc/lib/kgdb.c')
-rw-r--r-- | arch/powerpc/lib/kgdb.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/arch/powerpc/lib/kgdb.c b/arch/powerpc/lib/kgdb.c index 1ec6818..19a56db 100644 --- a/arch/powerpc/lib/kgdb.c +++ b/arch/powerpc/lib/kgdb.c @@ -12,11 +12,13 @@ void breakinst(void); int kgdb_setjmp(long *buf) { - asm ("mflr 0; stw 0,0(%0);" - "stw 1,4(%0); stw 2,8(%0);" - "mfcr 0; stw 0,12(%0);" - "stmw 13,16(%0)" - : : "r" (buf)); + unsigned long temp; + + asm volatile("mflr %0; stw %0,0(%1);" + "stw %%r1,4(%1); stw %%r2,8(%1);" + "mfcr %0; stw %0,12(%1);" + "stmw %%r13,16(%1)" + : "=&r"(temp) : "r" (buf)); /* XXX should save fp regs as well */ return 0; } @@ -24,13 +26,16 @@ kgdb_setjmp(long *buf) void kgdb_longjmp(long *buf, int val) { + unsigned long temp; + if (val == 0) val = 1; - asm ("lmw 13,16(%0);" - "lwz 0,12(%0); mtcrf 0x38,0;" - "lwz 0,0(%0); lwz 1,4(%0); lwz 2,8(%0);" - "mtlr 0; mr 3,%1" - : : "r" (buf), "r" (val)); + + asm volatile("lmw %%r13,16(%1);" + "lwz %0,12(%1); mtcrf 0x38,%0;" + "lwz %0,0(%1); lwz %%r1,4(%1); lwz %%r2,8(%1);" + "mtlr %0; mr %%r3,%2" + : "=&r"(temp) : "r" (buf), "r" (val)); } static inline unsigned long |