Path: blob/master/arch/unicore32/lib/strnlen_user.S
10817 views
/*1* linux/arch/unicore32/lib/strnlen_user.S2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/11#include <linux/linkage.h>12#include <asm/assembler.h>13#include <asm/errno.h>1415.text16.align 51718/* Prototype: unsigned long __strnlen_user(const char *str, long n)19* Purpose : get length of a string in user memory20* Params : str - address of string in user memory21* Returns : length of string *including terminator*22* or zero on exception, or n + 1 if too long23*/24ENTRY(__strnlen_user)25mov r2, r0261:27ldrusr r3, r0, 128cxor.a r3, #029beq 2f30sub.a r1, r1, #131bne 1b32add r0, r0, #1332: sub r0, r0, r234mov pc, lr35ENDPROC(__strnlen_user)3637.pushsection .fixup,"ax"38.align 0399001: mov r0, #040mov pc, lr41.popsection424344