1
2
3
4
5
6
7
8
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
11 #include <asm/errno.h>
12
13 .text
14 .align 5
15
16
17
18
19
20
21
22 ENTRY(__strncpy_from_user)
23 mov ip, r1
24 1: sub.a r2, r2, #1
25 ldrusr r3, r1, 1, ns
26 bfs 2f
27 stb.w r3, [r0]+, #1
28 cxor.a r3, #0
29 bne 1b
30 sub r1, r1, #1 @ take NUL character out of count
31 2: sub r0, r1, ip
32 mov pc, lr
33 ENDPROC(__strncpy_from_user)
34
35 .pushsection .fixup,"ax"
36 .align 0
37 9001: mov r3, #0
38 stb r3, [r0+], #0 @ null terminate
39 mov r0, #-EFAULT
40 mov pc, lr
41 .popsection
42