]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/sparc/lib/strncpy_from_user_32.S
sparc32: use the common implementation of alloc_thread_info_node()
[mirror_ubuntu-zesty-kernel.git] / arch / sparc / lib / strncpy_from_user_32.S
CommitLineData
1da177e4
LT
1/* strncpy_from_user.S: Sparc strncpy from userspace.
2 *
3 * Copyright(C) 1996 David S. Miller
4 */
5
8695c37d 6#include <linux/linkage.h>
1da177e4
LT
7#include <asm/ptrace.h>
8#include <asm/errno.h>
9
10 .text
1da177e4
LT
11
12 /* Must return:
13 *
14 * -EFAULT for an exception
15 * count if we hit the buffer limit
16 * bytes copied if we hit a null byte
17 */
18
8695c37d 19ENTRY(__strncpy_from_user)
1da177e4
LT
20 /* %o0=dest, %o1=src, %o2=count */
21 mov %o2, %o3
221:
23 subcc %o2, 1, %o2
24 bneg 2f
25 nop
2610:
27 ldub [%o1], %o4
28 add %o0, 1, %o0
29 cmp %o4, 0
30 add %o1, 1, %o1
31 bne 1b
32 stb %o4, [%o0 - 1]
332:
34 add %o2, 1, %o0
35 retl
36 sub %o3, %o0, %o0
8695c37d 37ENDPROC(__strncpy_from_user)
1da177e4
LT
38
39 .section .fixup,#alloc,#execinstr
40 .align 4
414:
42 retl
43 mov -EFAULT, %o0
44
45 .section __ex_table,#alloc
46 .align 4
47 .word 10b, 4b