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