MIPS: Don't save/restore OCTEON wide multiplier state on syscalls.
authorDavid Daney <david.daney@cavium.com>
Fri, 21 Jun 2013 21:14:53 +0000 (21:14 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 1 Jul 2013 13:10:56 +0000 (15:10 +0200)
The ABI allows these to be clobbered on syscalls, so only save and
restore the multiplier state when the temporary registers need to be
preserved.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: David Daney <david.daney@cavium.com>
Patchwork: https://patchwork.linux-mips.org/patch/5540/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/stackframe.h

index a89d1b10d027ce65d83eecb9dd57bfda7859400e..23fc95e65673bcb5d907a77f83714c424092add6 100644 (file)
                LONG_S  $24, PT_R24(sp)
 #ifndef CONFIG_CPU_HAS_SMARTMIPS
                LONG_S  v1, PT_LO(sp)
+#endif
+#ifdef CONFIG_CPU_CAVIUM_OCTEON
+               /*
+                * The Octeon multiplier state is affected by general
+                * multiply instructions. It must be saved before and
+                * kernel code might corrupt it
+                */
+               jal     octeon_mult_save
 #endif
                .endm
 
                ori     $28, sp, _THREAD_MASK
                xori    $28, _THREAD_MASK
 #ifdef CONFIG_CPU_CAVIUM_OCTEON
-               .set    mips64
-               pref    0, 0($28)       /* Prefetch the current pointer */
-               pref    0, PT_R31(sp)   /* Prefetch the $31(ra) */
-               /* The Octeon multiplier state is affected by general multiply
-                   instructions. It must be saved before and kernel code might
-                   corrupt it */
-               jal     octeon_mult_save
-               LONG_L  v1, 0($28)  /* Load the current pointer */
-                        /* Restore $31(ra) that was changed by the jal */
-               LONG_L  ra, PT_R31(sp)
-               pref    0, 0(v1)    /* Prefetch the current thread */
+               .set    mips64
+               pref    0, 0($28)       /* Prefetch the current pointer */
 #endif
                .set    pop
                .endm
                .endm
 
                .macro  RESTORE_TEMP
+#ifdef CONFIG_CPU_CAVIUM_OCTEON
+               /* Restore the Octeon multiplier state */
+               jal     octeon_mult_restore
+#endif
 #ifdef CONFIG_CPU_HAS_SMARTMIPS
                LONG_L  $24, PT_ACX(sp)
                mtlhx   $24
                DVPE    5                               # dvpe a1
                jal     mips_ihb
 #endif /* CONFIG_MIPS_MT_SMTC */
-#ifdef CONFIG_CPU_CAVIUM_OCTEON
-               /* Restore the Octeon multiplier state */
-               jal     octeon_mult_restore
-#endif
                mfc0    a0, CP0_STATUS
                ori     a0, STATMASK
                xori    a0, STATMASK