1
by Michael Hope
Pulled in the initial versions |
1 |
/* Copyright (C) 1998, 2003 Free Software Foundation, Inc. |
2 |
This file is part of the GNU C Library. |
|
3 |
Contributed by Philip Blundell <philb@gnu.org> |
|
4 |
||
5 |
The GNU C Library is free software; you can redistribute it and/or |
|
6 |
modify it under the terms of the GNU Lesser General Public |
|
7 |
License as published by the Free Software Foundation; either |
|
8 |
version 2.1 of the License, or (at your option) any later version. |
|
9 |
||
10 |
The GNU C Library is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
Lesser General Public License for more details. |
|
14 |
||
15 |
You should have received a copy of the GNU Lesser General Public |
|
16 |
License along with the GNU C Library; if not, write to the Free |
|
17 |
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
|
18 |
02111-1307 USA. */ |
|
19 |
||
20 |
/* void *memset (dstpp, c, len) */ |
|
77
by Michael Hope
Added function type attributes to all reference assembly versions. |
21 |
.text
|
22 |
.global memset |
|
23 |
.type memset, %function |
|
24 |
||
4
by Michael Hope
Modified the imported versions to build locally. Added the CSL routines. |
25 |
memset: |
1
by Michael Hope
Pulled in the initial versions |
26 |
mov r3, r0 |
27 |
cmp r2, #8 |
|
28 |
bcc 2f @ less than 8 bytes to move |
|
29 |
||
30 |
1: |
|
31 |
tst r3, #3 @ aligned yet? |
|
32 |
strneb r1, [r3], #1 |
|
33 |
subne r2, r2, #1 |
|
34 |
bne 1b |
|
35 |
||
36 |
and r1, r1, #255 @ clear any sign bits |
|
37 |
orr r1, r1, r1, lsl $8 |
|
38 |
orr r1, r1, r1, lsl $16 |
|
39 |
mov ip, r1 |
|
40 |
||
41 |
1: |
|
42 |
subs r2, r2, #8 |
|
43 |
stmcsia r3!, {r1, ip} @ store up to 32 bytes per loop iteration |
|
44 |
subcss r2, r2, #8 |
|
45 |
stmcsia r3!, {r1, ip} |
|
46 |
subcss r2, r2, #8 |
|
47 |
stmcsia r3!, {r1, ip} |
|
48 |
subcss r2, r2, #8 |
|
49 |
stmcsia r3!, {r1, ip} |
|
50 |
bcs 1b |
|
51 |
||
52 |
and r2, r2, #7 |
|
53 |
2: |
|
54 |
subs r2, r2, #1 @ store up to 4 bytes per loop iteration |
|
55 |
strcsb r1, [r3], #1 |
|
56 |
subcss r2, r2, #1 |
|
57 |
strcsb r1, [r3], #1 |
|
58 |
subcss r2, r2, #1 |
|
59 |
strcsb r1, [r3], #1 |
|
60 |
subcss r2, r2, #1 |
|
61 |
strcsb r1, [r3], #1 |
|
62 |
bcs 2b |
|
63 |
||
4
by Michael Hope
Modified the imported versions to build locally. Added the CSL routines. |
64 |
bx lr |