]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Blackfin: adjust asm constraints with NMI workaround
authorMike Frysinger <vapier@gentoo.org>
Tue, 31 Jul 2012 09:38:56 +0000 (05:38 -0400)
committerSonic Zhang <sonic.zhang@analog.com>
Mon, 13 May 2013 07:47:24 +0000 (15:47 +0800)
Newer gcc versions will sometimes use a Preg when "r" constraints, but
that'll fail if we use an Ireg in the assignment.  So force the code
to always use a Dreg.

This also fixes early boot crashes for older Blackfin parts when compiled
with gcc-4.5.  This version ends up selecting the same register for the
input and output variables which corrupts the output assignment triggering
an exception.
P2 = 0xffe02008; /* EVT2 */
R0 = RETS;
CALL 1f;
RTN;
1: P2 = RETS; <-- BAD
RETS = R0;
[P2] = P2; <-- BAD

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
arch/blackfin/cpu/initcode.c

index 1a066806d1fe1e765d2d576574ee5e7cbfacc0d3..e8ea0ba66aff956020433b0f77e1e3b04a2e3c92 100644 (file)
@@ -262,7 +262,8 @@ program_nmi_handler(void)
                "%1 = RETS;" /* Load addr of NMI handler */
                "RETS = %0;" /* Restore RETS */
                "[%2] = %1;" /* Write NMI handler */
-               : "=r"(tmp1), "=r"(tmp2) : "ab"(EVT2)
+               : "=d"(tmp1), "=d"(tmp2)
+               : "ab"(EVT2)
        );
 }