Commit 96805a529c3ce366f3ecfd58a8b72ec21432af1c
Committed by
Wolfgang Denk
1 parent
2eb1573f01
Exists in
master
and in
55 other branches
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>
Showing 2 changed files with 19 additions and 11 deletions Side-by-side Diff
arch/powerpc/lib/kgdb.c
... | ... | @@ -12,11 +12,13 @@ |
12 | 12 | int |
13 | 13 | kgdb_setjmp(long *buf) |
14 | 14 | { |
15 | - asm ("mflr 0; stw 0,0(%0);" | |
16 | - "stw 1,4(%0); stw 2,8(%0);" | |
17 | - "mfcr 0; stw 0,12(%0);" | |
18 | - "stmw 13,16(%0)" | |
19 | - : : "r" (buf)); | |
15 | + unsigned long temp; | |
16 | + | |
17 | + asm volatile("mflr %0; stw %0,0(%1);" | |
18 | + "stw %%r1,4(%1); stw %%r2,8(%1);" | |
19 | + "mfcr %0; stw %0,12(%1);" | |
20 | + "stmw %%r13,16(%1)" | |
21 | + : "=&r"(temp) : "r" (buf)); | |
20 | 22 | /* XXX should save fp regs as well */ |
21 | 23 | return 0; |
22 | 24 | } |
23 | 25 | |
... | ... | @@ -24,13 +26,16 @@ |
24 | 26 | void |
25 | 27 | kgdb_longjmp(long *buf, int val) |
26 | 28 | { |
29 | + unsigned long temp; | |
30 | + | |
27 | 31 | if (val == 0) |
28 | 32 | val = 1; |
29 | - asm ("lmw 13,16(%0);" | |
30 | - "lwz 0,12(%0); mtcrf 0x38,0;" | |
31 | - "lwz 0,0(%0); lwz 1,4(%0); lwz 2,8(%0);" | |
32 | - "mtlr 0; mr 3,%1" | |
33 | - : : "r" (buf), "r" (val)); | |
33 | + | |
34 | + asm volatile("lmw %%r13,16(%1);" | |
35 | + "lwz %0,12(%1); mtcrf 0x38,%0;" | |
36 | + "lwz %0,0(%1); lwz %%r1,4(%1); lwz %%r2,8(%1);" | |
37 | + "mtlr %0; mr %%r3,%2" | |
38 | + : "=&r"(temp) : "r" (buf), "r" (val)); | |
34 | 39 | } |
35 | 40 | |
36 | 41 | static inline unsigned long |
arch/powerpc/lib/time.c
... | ... | @@ -78,6 +78,8 @@ |
78 | 78 | |
79 | 79 | int init_timebase (void) |
80 | 80 | { |
81 | + unsigned long temp; | |
82 | + | |
81 | 83 | #if defined(CONFIG_5xx) || defined(CONFIG_8xx) |
82 | 84 | volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; |
83 | 85 | |
... | ... | @@ -86,7 +88,8 @@ |
86 | 88 | #endif |
87 | 89 | |
88 | 90 | /* reset */ |
89 | - asm ("li 3,0 ; mttbu 3 ; mttbl 3 ;"); | |
91 | + asm volatile("li %0,0 ; mttbu %0 ; mttbl %0;" | |
92 | + : "=&r"(temp) ); | |
90 | 93 | |
91 | 94 | #if defined(CONFIG_5xx) || defined(CONFIG_8xx) |
92 | 95 | /* enable */ |