diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2014-01-02 11:36:49 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-03-26 18:09:14 -0400 |
commit | cc59fe5b88bff926376019851aa88e96b6039eea (patch) | |
tree | 772641ee2d5e6c3dd4fc116a7dd1586da694e60d /arch/mips/lib | |
parent | 053970542f049d3e30dc4be6eb19e92ff1f70f00 (diff) |
MIPS: lib: strncpy_user: Use macro to build the strncpy_from_user symbol
Build the __strncpy_from_user symbol using a macro. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Diffstat (limited to 'arch/mips/lib')
-rw-r--r-- | arch/mips/lib/strncpy_user.S | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S index 92870b6b53ea..51b38ab1478a 100644 --- a/arch/mips/lib/strncpy_user.S +++ b/arch/mips/lib/strncpy_user.S | |||
@@ -28,16 +28,17 @@ | |||
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 | ||
31 | LEAF(__strncpy_from_user_asm) | 31 | .macro __BUILD_STRNCPY_ASM func |
32 | LEAF(__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 | ||
36 | FEXPORT(__strncpy_from_user_nocheck_asm) | 37 | FEXPORT(__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 |
40 | 1: EX(lbu, v0, (v1), .Lfault) | 41 | 1: EX(lbu, v0, (v1), .Lfault\@) |
41 | PTR_ADDIU v1, 1 | 42 | PTR_ADDIU v1, 1 |
42 | R10KCBARRIER(0(ra)) | 43 | R10KCBARRIER(0(ra)) |
43 | beqz v0, 2f | 44 | beqz v0, 2f |
@@ -47,15 +48,19 @@ FEXPORT(__strncpy_from_user_nocheck_asm) | |||
47 | PTR_ADDIU a0, 1 | 48 | PTR_ADDIU a0, 1 |
48 | 2: PTR_ADDU v0, a1, t0 | 49 | 2: PTR_ADDU v0, a1, t0 |
49 | xor v0, a1 | 50 | xor v0, a1 |
50 | bltz v0, .Lfault | 51 | bltz v0, .Lfault\@ |
51 | nop | 52 | nop |
52 | jr ra # return n | 53 | jr ra # return n |
53 | move v0, t0 | 54 | move v0, t0 |
54 | END(__strncpy_from_user_asm) | 55 | END(__strncpy_from_\func\()_asm) |
55 | 56 | ||
56 | .Lfault: jr ra | 57 | .Lfault\@: jr ra |
57 | li v0, -EFAULT | 58 | li v0, -EFAULT |
58 | 59 | ||
59 | .section __ex_table,"a" | 60 | .section __ex_table,"a" |
60 | PTR 1b, .Lfault | 61 | PTR 1b, .Lfault\@ |
61 | .previous | 62 | .previous |
63 | |||
64 | .endm | ||
65 | |||
66 | __BUILD_STRNCPY_ASM user | ||