2 * linux/arch/unicore32/lib/strncpy_from_user.S
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #include <linux/linkage.h>
13 #include <asm/assembler.h>
14 #include <asm/errno.h>
20 * Copy a string from user space to kernel space.
21 * r0 = dst, r1 = src, r2 = byte length
22 * returns the number of characters copied (strlen of copied string),
23 * -EFAULT on exception, or "len" if we fill the whole buffer
25 ENTRY(__strncpy_from_user)
33 sub r1, r1, #1 @ take NUL character out of count
36 ENDPROC(__strncpy_from_user)
38 .pushsection .fixup,"ax"
41 stb r3, [r0+], #0 @ null terminate