Yoshinori Sato | a71a29d | 2015-01-28 02:48:15 +0900 | [diff] [blame^] | 1 | ;;; strncpy.S |
2 | |||||
3 | #include <asm/linkage.h> | ||||
4 | |||||
5 | .text | ||||
6 | .global strncpy_from_user | ||||
7 | |||||
8 | ;;; long strncpy_from_user(void *to, void *from, size_t n) | ||||
9 | strncpy_from_user: | ||||
10 | mov.l er2,er2 | ||||
11 | bne 1f | ||||
12 | sub.l er0,er0 | ||||
13 | rts | ||||
14 | 1: | ||||
15 | mov.l er4,@-sp | ||||
16 | sub.l er3,er3 | ||||
17 | 2: | ||||
18 | mov.b @er1+,r4l | ||||
19 | mov.b r4l,@er0 | ||||
20 | adds #1,er0 | ||||
21 | beq 3f | ||||
22 | inc.l #1,er3 | ||||
23 | dec.l #1,er2 | ||||
24 | bne 2b | ||||
25 | 3: | ||||
26 | dec.l #1,er2 | ||||
27 | 4: | ||||
28 | mov.b r4l,@er0 | ||||
29 | adds #1,er0 | ||||
30 | dec.l #1,er2 | ||||
31 | bne 4b | ||||
32 | mov.l er3,er0 | ||||
33 | mov.l @sp+,er4 | ||||
34 | rts |