strlen_user.S
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  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. #define EX(insn,reg,addr,handler)
  14. 9: insn reg, addr;
  15. .section __ex_table,"a";
  16. PTR 9b, handler;
  17. .previous
  18. /*
  19.  * Return the size of a string (including the ending 0)
  20.  *
  21.  * Return 0 for error
  22.  */
  23. LEAF(__strlen_user_asm)
  24. lw v0, THREAD_CURDS($28) # pointer ok?
  25. and v0, a0
  26. bltz v0, fault
  27. FEXPORT(__strlen_user_nocheck_asm)
  28. move v0, a0
  29. 1: EX(lb, t0, (v0), fault)
  30. addiu v0, 1
  31. bnez t0, 1b
  32. subu v0, a0
  33. jr ra
  34. END(__strlen_user_asm)
  35. fault: move v0, zero
  36. jr ra