1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/unicore32/lib/strncpy_from_user.S
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Copyright (C) 2001-2010 GUAN Xue-tao
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
11 #include <asm/errno.h>
17 * Copy a string from user space to kernel space.
18 * r0 = dst, r1 = src, r2 = byte length
19 * returns the number of characters copied (strlen of copied string),
20 * -EFAULT on exception, or "len" if we fill the whole buffer
22 ENTRY(__strncpy_from_user)
30 sub r1, r1, #1 @ take NUL character out of count
33 ENDPROC(__strncpy_from_user)
35 .pushsection .fixup,"ax"
38 stb r3, [r0+], #0 @ null terminate