2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1996, 1998, 1999, 2004 by Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
8 * Copyright (C) 2011 MIPS Technologies, Inc.
11 #include <asm/asm-offsets.h>
12 #include <asm/regdef.h>
14 #define EX(insn,reg,addr,handler) \
16 .section __ex_table,"a"; \
21 * Return the size of a string (including the ending 0)
25 .macro __BUILD_STRLEN_ASM func
26 LEAF(__strlen_\func\()_asm)
27 LONG_L v0, TI_ADDR_LIMIT($28) # pointer ok?
31 FEXPORT(__strlen_\func\()_nocheck_asm)
33 .ifeqs "\func", "kernel"
34 1: EX(lbu, v1, (v0), .Lfault\@)
36 1: EX(lbue, v1, (v0), .Lfault\@)
42 END(__strlen_\func\()_asm)
44 .Lfault\@: move v0, zero
50 .global __strlen_user_asm
51 .global __strlen_user_nocheck_asm
52 .set __strlen_user_asm, __strlen_kernel_asm
53 .set __strlen_user_nocheck_asm, __strlen_kernel_nocheck_asm
56 __BUILD_STRLEN_ASM kernel
62 __BUILD_STRLEN_ASM user