summaryrefslogtreecommitdiffstats
path: root/arch/mips/lib/strlen_user.S
blob: c42144b351b85677a5e51aaa2b1283d700be6260 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * arch/mips/lib/strlen_user.S
 *
 * 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.
 *
 * Copyright (c) 1996 by Ralf Baechle
 */
#include <asm/asm.h>
#include <asm/regdef.h>
#include <asm/sgidefs.h>

/*
 * Return the size of a string (including the ending 0)
 *
 * Return 0 for error
 */
LEAF(__strlen_user)
		move		v0,zero
1:		lb		t0,(a0)
		LONG_ADDIU	v0,1
		LONG_ADDIU	a0,1
		bnez		t0,1b
		jr		ra
		END(__strlen_user)

		.section	__ex_table,"a"
		PTR		1b,fault
		.previous

fault:		move		v0,zero
		jr		ra