Commit 96805a529c3ce366f3ecfd58a8b72ec21432af1c

Authored by Timur Tabi
Committed by Wolfgang Denk
1 parent 2eb1573f01
Exists in master and in 55 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf_v2022.04, emb_lf_v2023.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

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 */