diff options
Diffstat (limited to 'arch/mips/lib/strnlen_user.S')
| -rw-r--r-- | arch/mips/lib/strnlen_user.S | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S index fcacea5e61f1..f3af6995e2a6 100644 --- a/arch/mips/lib/strnlen_user.S +++ b/arch/mips/lib/strnlen_user.S | |||
| @@ -25,22 +25,46 @@ | |||
| 25 | * bytes. There's nothing secret there. On 64-bit accessing beyond | 25 | * bytes. There's nothing secret there. On 64-bit accessing beyond |
| 26 | * the maximum is a tad hairier ... | 26 | * the maximum is a tad hairier ... |
| 27 | */ | 27 | */ |
| 28 | LEAF(__strnlen_user_asm) | 28 | .macro __BUILD_STRNLEN_ASM func |
| 29 | LEAF(__strnlen_\func\()_asm) | ||
| 29 | LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok? | 30 | LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok? |
| 30 | and v0, a0 | 31 | and v0, a0 |
| 31 | bnez v0, .Lfault | 32 | bnez v0, .Lfault\@ |
| 32 | 33 | ||
| 33 | FEXPORT(__strnlen_user_nocheck_asm) | 34 | FEXPORT(__strnlen_\func\()_nocheck_asm) |
| 34 | move v0, a0 | 35 | move v0, a0 |
| 35 | PTR_ADDU a1, a0 # stop pointer | 36 | PTR_ADDU a1, a0 # stop pointer |
| 36 | 1: beq v0, a1, 1f # limit reached? | 37 | 1: beq v0, a1, 1f # limit reached? |
| 37 | EX(lb, t0, (v0), .Lfault) | 38 | .ifeqs "\func", "kernel" |
| 39 | EX(lb, t0, (v0), .Lfault\@) | ||
| 40 | .else | ||
| 41 | EX(lbe, t0, (v0), .Lfault\@) | ||
| 42 | .endif | ||
| 38 | PTR_ADDIU v0, 1 | 43 | PTR_ADDIU v0, 1 |
| 39 | bnez t0, 1b | 44 | bnez t0, 1b |
| 40 | 1: PTR_SUBU v0, a0 | 45 | 1: PTR_SUBU v0, a0 |
| 41 | jr ra | 46 | jr ra |
| 42 | END(__strnlen_user_asm) | 47 | END(__strnlen_\func\()_asm) |
| 43 | 48 | ||
| 44 | .Lfault: | 49 | .Lfault\@: |
| 45 | move v0, zero | 50 | move v0, zero |
| 46 | jr ra | 51 | jr ra |
| 52 | .endm | ||
| 53 | |||
| 54 | #ifndef CONFIG_EVA | ||
| 55 | /* Set aliases */ | ||
| 56 | .global __strnlen_user_asm | ||
| 57 | .global __strnlen_user_nocheck_asm | ||
| 58 | .set __strnlen_user_asm, __strnlen_kernel_asm | ||
| 59 | .set __strnlen_user_nocheck_asm, __strnlen_kernel_nocheck_asm | ||
| 60 | #endif | ||
| 61 | |||
| 62 | __BUILD_STRNLEN_ASM kernel | ||
| 63 | |||
| 64 | #ifdef CONFIG_EVA | ||
| 65 | |||
| 66 | .set push | ||
| 67 | .set eva | ||
| 68 | __BUILD_STRNLEN_ASM user | ||
| 69 | .set pop | ||
| 70 | #endif | ||
