aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorMatt Redfearn <matt.redfearn@mips.com>2018-04-17 11:40:01 -0400
committerJames Hogan <jhogan@kernel.org>2018-04-18 17:02:29 -0400
commitb3d7e55c3f886493235bfee08e1e5a4a27cbcce8 (patch)
tree5de7a8125f8693278ef93b15ea9e45dbdfce6507 /arch/mips/include
parentc96eebf07692e53bf4dd5987510d8b550e793598 (diff)
MIPS: uaccess: Add micromips clobbers to bzero invocation
The micromips implementation of bzero additionally clobbers registers t7 & t8. Specify this in the clobbers list when invoking bzero. Fixes: 26c5e07d1478 ("MIPS: microMIPS: Optimise 'memset' core library function.") Reported-by: James Hogan <jhogan@kernel.org> Signed-off-by: Matt Redfearn <matt.redfearn@mips.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Cc: <stable@vger.kernel.org> # 3.10+ Patchwork: https://patchwork.linux-mips.org/patch/19110/ Signed-off-by: James Hogan <jhogan@kernel.org>
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/uaccess.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index b71306947290..06629011a434 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -654,6 +654,13 @@ __clear_user(void __user *addr, __kernel_size_t size)
654{ 654{
655 __kernel_size_t res; 655 __kernel_size_t res;
656 656
657#ifdef CONFIG_CPU_MICROMIPS
658/* micromips memset / bzero also clobbers t7 & t8 */
659#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$15", "$24", "$31"
660#else
661#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"
662#endif /* CONFIG_CPU_MICROMIPS */
663
657 if (eva_kernel_access()) { 664 if (eva_kernel_access()) {
658 __asm__ __volatile__( 665 __asm__ __volatile__(
659 "move\t$4, %1\n\t" 666 "move\t$4, %1\n\t"
@@ -663,7 +670,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
663 "move\t%0, $6" 670 "move\t%0, $6"
664 : "=r" (res) 671 : "=r" (res)
665 : "r" (addr), "r" (size) 672 : "r" (addr), "r" (size)
666 : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"); 673 : bzero_clobbers);
667 } else { 674 } else {
668 might_fault(); 675 might_fault();
669 __asm__ __volatile__( 676 __asm__ __volatile__(
@@ -674,7 +681,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
674 "move\t%0, $6" 681 "move\t%0, $6"
675 : "=r" (res) 682 : "=r" (res)
676 : "r" (addr), "r" (size) 683 : "r" (addr), "r" (size)
677 : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"); 684 : bzero_clobbers);
678 } 685 }
679 686
680 return res; 687 return res;