aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lib/strncpy_user.S
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2014-04-14 10:44:42 -0400
committerIngo Molnar <mingo@kernel.org>2014-04-14 10:44:42 -0400
commit740c699a8d316c8bf8593f19e2ca47795e690622 (patch)
treea78886955770a477945c5d84e06b2e7678733b54 /arch/mips/lib/strncpy_user.S
parente69af4657e7764d03ad555f0b583d9c4217bcefa (diff)
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
Merge tag 'v3.15-rc1' into perf/urgent
Pick up the latest fixes. Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/mips/lib/strncpy_user.S')
-rw-r--r--arch/mips/lib/strncpy_user.S40
1 files changed, 32 insertions, 8 deletions
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S
index 92870b6b53ea..d3301cd1e9a5 100644
--- a/arch/mips/lib/strncpy_user.S
+++ b/arch/mips/lib/strncpy_user.S
@@ -28,16 +28,21 @@
28 * it happens at most some bytes of the exceptions handlers will be copied. 28 * it happens at most some bytes of the exceptions handlers will be copied.
29 */ 29 */
30 30
31LEAF(__strncpy_from_user_asm) 31 .macro __BUILD_STRNCPY_ASM func
32LEAF(__strncpy_from_\func\()_asm)
32 LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok? 33 LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok?
33 and v0, a1 34 and v0, a1
34 bnez v0, .Lfault 35 bnez v0, .Lfault\@
35 36
36FEXPORT(__strncpy_from_user_nocheck_asm) 37FEXPORT(__strncpy_from_\func\()_nocheck_asm)
37 .set noreorder 38 .set noreorder
38 move t0, zero 39 move t0, zero
39 move v1, a1 40 move v1, a1
401: EX(lbu, v0, (v1), .Lfault) 41.ifeqs "\func","kernel"
421: EX(lbu, v0, (v1), .Lfault\@)
43.else
441: EX(lbue, v0, (v1), .Lfault\@)
45.endif
41 PTR_ADDIU v1, 1 46 PTR_ADDIU v1, 1
42 R10KCBARRIER(0(ra)) 47 R10KCBARRIER(0(ra))
43 beqz v0, 2f 48 beqz v0, 2f
@@ -47,15 +52,34 @@ FEXPORT(__strncpy_from_user_nocheck_asm)
47 PTR_ADDIU a0, 1 52 PTR_ADDIU a0, 1
482: PTR_ADDU v0, a1, t0 532: PTR_ADDU v0, a1, t0
49 xor v0, a1 54 xor v0, a1
50 bltz v0, .Lfault 55 bltz v0, .Lfault\@
51 nop 56 nop
52 jr ra # return n 57 jr ra # return n
53 move v0, t0 58 move v0, t0
54 END(__strncpy_from_user_asm) 59 END(__strncpy_from_\func\()_asm)
55 60
56.Lfault: jr ra 61.Lfault\@: jr ra
57 li v0, -EFAULT 62 li v0, -EFAULT
58 63
59 .section __ex_table,"a" 64 .section __ex_table,"a"
60 PTR 1b, .Lfault 65 PTR 1b, .Lfault\@
61 .previous 66 .previous
67
68 .endm
69
70#ifndef CONFIG_EVA
71 /* Set aliases */
72 .global __strncpy_from_user_asm
73 .global __strncpy_from_user_nocheck_asm
74 .set __strncpy_from_user_asm, __strncpy_from_kernel_asm
75 .set __strncpy_from_user_nocheck_asm, __strncpy_from_kernel_nocheck_asm
76#endif
77
78__BUILD_STRNCPY_ASM kernel
79
80#ifdef CONFIG_EVA
81 .set push
82 .set eva
83__BUILD_STRNCPY_ASM user
84 .set pop
85#endif