Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / arch / mips / lib / strlen_user.S
blob0902817c08c514cfd9aafa910625dff257edb54b
1 /* $Id: strlen_user.S,v 1.3 1999/08/21 22:19:11 ralf Exp $
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (c) 1996, 1998, 1999 by Ralf Baechle
8  * Copyright (c) 1999 Silicon Graphics, Inc.
9  */
10 #include <asm/asm.h>
11 #include <asm/offset.h>
12 #include <asm/regdef.h>
13 #include <asm/sgidefs.h>
15 #define EX(insn,reg,addr,handler)                       \
16 9:      insn    reg, addr;                              \
17         .section __ex_table,"a";                        \
18         PTR     9b, handler;                            \
19         .previous
22  * Return the size of a string (including the ending 0)
23  *
24  * Return 0 for error
25  */
26 LEAF(__strlen_user_asm)
27         lw      v0, THREAD_CURDS($28)   # pointer ok?
28         and     v0, a0
29         bltz    v0, fault
31 EXPORT(__strlen_user_nocheck_asm)
32         move    v0, a0
33 1:      EX(lb, t0, (v0), fault)
34         addiu   v0, 1
35         bnez    t0, 1b
36         subu    v0, a0
37         jr      ra
38         END(__strlen_user_nocheck_asm)
40         .section __ex_table,"a"
41         PTR     1b, fault
42         .previous
44 fault:  move    v0, zero
45         jr      ra