Blame view
arch/mips/lib/strlen_user.S
1.33 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 |
/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * |
b1bac3734 MIPS: microMIPS: ... |
6 7 8 |
* Copyright (C) 1996, 1998, 1999, 2004 by Ralf Baechle * Copyright (C) 1999 Silicon Graphics, Inc. * Copyright (C) 2011 MIPS Technologies, Inc. |
1da177e4c Linux-2.6.12-rc2 |
9 10 |
*/ #include <asm/asm.h> |
048eb582f kbuild: mips use ... |
11 |
#include <asm/asm-offsets.h> |
1da177e4c Linux-2.6.12-rc2 |
12 13 14 15 16 17 18 19 20 21 22 23 24 |
#include <asm/regdef.h> #define EX(insn,reg,addr,handler) \ 9: insn reg, addr; \ .section __ex_table,"a"; \ PTR 9b, handler; \ .previous /* * Return the size of a string (including the ending 0) * * Return 0 for error */ |
5cc494972 MIPS: lib: strlen... |
25 26 |
.macro __BUILD_STRLEN_ASM func LEAF(__strlen_\func\()_asm) |
1da177e4c Linux-2.6.12-rc2 |
27 28 |
LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok? and v0, a0 |
5cc494972 MIPS: lib: strlen... |
29 |
bnez v0, .Lfault\@ |
1da177e4c Linux-2.6.12-rc2 |
30 |
|
5cc494972 MIPS: lib: strlen... |
31 |
FEXPORT(__strlen_\func\()_nocheck_asm) |
1da177e4c Linux-2.6.12-rc2 |
32 |
move v0, a0 |
053970542 MIPS: lib: strlen... |
33 |
.ifeqs "\func", "kernel" |
5cc494972 MIPS: lib: strlen... |
34 |
1: EX(lbu, v1, (v0), .Lfault\@) |
053970542 MIPS: lib: strlen... |
35 36 37 |
.else 1: EX(lbue, v1, (v0), .Lfault\@) .endif |
1da177e4c Linux-2.6.12-rc2 |
38 |
PTR_ADDIU v0, 1 |
b1bac3734 MIPS: microMIPS: ... |
39 |
bnez v1, 1b |
1da177e4c Linux-2.6.12-rc2 |
40 41 |
PTR_SUBU v0, a0 jr ra |
5cc494972 MIPS: lib: strlen... |
42 |
END(__strlen_\func\()_asm) |
1da177e4c Linux-2.6.12-rc2 |
43 |
|
5cc494972 MIPS: lib: strlen... |
44 |
.Lfault\@: move v0, zero |
1da177e4c Linux-2.6.12-rc2 |
45 |
jr ra |
5cc494972 MIPS: lib: strlen... |
46 |
.endm |
053970542 MIPS: lib: strlen... |
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
#ifndef CONFIG_EVA /* Set aliases */ .global __strlen_user_asm .global __strlen_user_nocheck_asm .set __strlen_user_asm, __strlen_kernel_asm .set __strlen_user_nocheck_asm, __strlen_kernel_nocheck_asm #endif __BUILD_STRLEN_ASM kernel #ifdef CONFIG_EVA .set push .set eva |
5cc494972 MIPS: lib: strlen... |
61 |
__BUILD_STRLEN_ASM user |
053970542 MIPS: lib: strlen... |
62 63 |
.set pop #endif |