1/* 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 4 * for more details. 5 * 6 * Copyright (c) 1996, 1998, 1999 by Ralf Baechle 7 * Copyright (c) 1999 Silicon Graphics, Inc. 8 */ 9#include <asm/asm.h> 10#include <asm/offset.h> 11#include <asm/regdef.h> 12#include <asm/sgidefs.h> 13 14#define EX(insn,reg,addr,handler) \ 159: insn reg, addr; \ 16 .section __ex_table,"a"; \ 17 PTR 9b, handler; \ 18 .previous 19 20/* 21 * Return the size of a string (including the ending 0) 22 * 23 * Return 0 for error 24 */ 25LEAF(__strlen_user_asm) 26 lw v0, THREAD_CURDS($28) # pointer ok? 27 and v0, a0 28 bltz v0, fault 29 30FEXPORT(__strlen_user_nocheck_asm) 31 move v0, a0 321: EX(lb, t0, (v0), fault) 33 addiu v0, 1 34 bnez t0, 1b 35 subu v0, a0 36 jr ra 37 END(__strlen_user_asm) 38 39fault: move v0, zero 40 jr ra 41