diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/lib/strncpy_user.S | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S index bad539487503..92870b6b53ea 100644 --- a/arch/mips/lib/strncpy_user.S +++ b/arch/mips/lib/strncpy_user.S | |||
@@ -3,7 +3,8 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (c) 1996, 1999 by Ralf Baechle | 6 | * Copyright (C) 1996, 1999 by Ralf Baechle |
7 | * Copyright (C) 2011 MIPS Technologies, Inc. | ||
7 | */ | 8 | */ |
8 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
9 | #include <asm/asm.h> | 10 | #include <asm/asm.h> |
@@ -33,26 +34,27 @@ LEAF(__strncpy_from_user_asm) | |||
33 | bnez v0, .Lfault | 34 | bnez v0, .Lfault |
34 | 35 | ||
35 | FEXPORT(__strncpy_from_user_nocheck_asm) | 36 | FEXPORT(__strncpy_from_user_nocheck_asm) |
36 | move v0, zero | ||
37 | move v1, a1 | ||
38 | .set noreorder | 37 | .set noreorder |
39 | 1: EX(lbu, t0, (v1), .Lfault) | 38 | move t0, zero |
39 | move v1, a1 | ||
40 | 1: EX(lbu, v0, (v1), .Lfault) | ||
40 | PTR_ADDIU v1, 1 | 41 | PTR_ADDIU v1, 1 |
41 | R10KCBARRIER(0(ra)) | 42 | R10KCBARRIER(0(ra)) |
42 | beqz t0, 2f | 43 | beqz v0, 2f |
43 | sb t0, (a0) | 44 | sb v0, (a0) |
44 | PTR_ADDIU v0, 1 | 45 | PTR_ADDIU t0, 1 |
45 | .set reorder | 46 | bne t0, a2, 1b |
46 | PTR_ADDIU a0, 1 | 47 | PTR_ADDIU a0, 1 |
47 | bne v0, a2, 1b | 48 | 2: PTR_ADDU v0, a1, t0 |
48 | 2: PTR_ADDU t0, a1, v0 | 49 | xor v0, a1 |
49 | xor t0, a1 | 50 | bltz v0, .Lfault |
50 | bltz t0, .Lfault | 51 | nop |
51 | jr ra # return n | 52 | jr ra # return n |
53 | move v0, t0 | ||
52 | END(__strncpy_from_user_asm) | 54 | END(__strncpy_from_user_asm) |
53 | 55 | ||
54 | .Lfault: li v0, -EFAULT | 56 | .Lfault: jr ra |
55 | jr ra | 57 | li v0, -EFAULT |
56 | 58 | ||
57 | .section __ex_table,"a" | 59 | .section __ex_table,"a" |
58 | PTR 1b, .Lfault | 60 | PTR 1b, .Lfault |