]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
MIPS: asm: asmmacro: Replace "add" instructions with "addu"
authorMarkos Chandras <markos.chandras@imgtec.com>
Wed, 5 Nov 2014 14:17:52 +0000 (14:17 +0000)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 2 Mar 2015 15:04:29 +0000 (15:04 +0000)
commit 98a833c1fa4de0695830f77b2d13fd86693da298 upstream.

The "add" instruction is actually a macro in binutils and depending on
the size of the immediate it can expand to an "addi" instruction.
However, the "addi" instruction traps on overflows which is not
something we want on address calculation.

Link: http://www.linux-mips.org/archives/linux-mips/2015-01/msg00121.html
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
arch/mips/include/asm/asmmacro.h

index 935543f1453848660ae6fdc69922bcb9b10cae5b..9dbc454ad14e848dc7b173cff40e63db4eef8d15 100644 (file)
        .macro  ld_d    wd, off, base
        .set    push
        .set    noat
-       add     $1, \base, \off
+       addu    $1, \base, \off
        .word   LDD_MSA_INSN | (\wd << 6)
        .set    pop
        .endm
        .macro  st_d    wd, off, base
        .set    push
        .set    noat
-       add     $1, \base, \off
+       addu    $1, \base, \off
        .word   STD_MSA_INSN | (\wd << 6)
        .set    pop
        .endm