Rev 2465 | Rev 3425 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2465 | Rev 2787 | ||
---|---|---|---|
1 | # |
1 | # |
2 | # Copyright (c) 2007 Michal Kebrt |
2 | # Copyright (c) 2007 Michal Kebrt |
3 | # All rights reserved. |
3 | # All rights reserved. |
4 | # |
4 | # |
5 | # Redistribution and use in source and binary forms, with or without |
5 | # Redistribution and use in source and binary forms, with or without |
6 | # modification, are permitted provided that the following conditions |
6 | # modification, are permitted provided that the following conditions |
7 | # are met: |
7 | # are met: |
8 | # |
8 | # |
9 | # - Redistributions of source code must retain the above copyright |
9 | # - Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. |
10 | # notice, this list of conditions and the following disclaimer. |
11 | # - Redistributions in binary form must reproduce the above copyright |
11 | # - Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the |
12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. |
13 | # documentation and/or other materials provided with the distribution. |
14 | # - The name of the author may not be used to endorse or promote products |
14 | # - The name of the author may not be used to endorse or promote products |
15 | # derived from this software without specific prior written permission. |
15 | # derived from this software without specific prior written permission. |
16 | # |
16 | # |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | # |
27 | # |
28 | 28 | ||
29 | 29 | ||
30 | .text |
30 | .text |
31 | 31 | ||
32 | .global memsetb |
32 | .global memsetb |
33 | .global memcpy |
33 | .global memcpy |
34 | .global memcpy_from_uspace |
34 | .global memcpy_from_uspace |
35 | .global memcpy_to_uspace |
35 | .global memcpy_to_uspace |
36 | .global memcpy_from_uspace_failover_address |
36 | .global memcpy_from_uspace_failover_address |
37 | .global memcpy_to_uspace_failover_address |
37 | .global memcpy_to_uspace_failover_address |
38 | 38 | ||
39 | memsetb: |
39 | memsetb: |
40 | b _memsetb |
40 | b _memsetb |
41 | 41 | ||
42 | memcpy: |
42 | memcpy: |
43 | memcpy_from_uspace: |
43 | memcpy_from_uspace: |
44 | memcpy_to_uspace: |
44 | memcpy_to_uspace: |
45 | add r3, r1, #3 |
45 | add r3, r1, #3 |
46 | bic r3, r3, #3 |
46 | bic r3, r3, #3 |
47 | cmp r1, r3 |
47 | cmp r1, r3 |
48 | stmdb sp!, {r4, lr} |
48 | stmdb sp!, {r4, lr} |
49 | beq 4f |
49 | beq 4f |
50 | 1: |
50 | 1: |
51 | cmp r2, #0 |
51 | cmp r2, #0 |
52 | movne ip, #0 |
52 | movne ip, #0 |
53 | beq 3f |
53 | beq 3f |
54 | 2: |
54 | 2: |
55 | ldrb r3, [ip, r1] |
55 | ldrb r3, [ip, r1] |
56 | strb r3, [ip, r0] |
56 | strb r3, [ip, r0] |
57 | add ip, ip, #1 |
57 | add ip, ip, #1 |
58 | cmp ip, r2 |
58 | cmp ip, r2 |
59 | bne 2b |
59 | bne 2b |
60 | 3: |
60 | 3: |
61 | mov r0, r1 |
61 | mov r0, r1 |
62 | ldmia sp!, {r4, pc} |
62 | ldmia sp!, {r4, pc} |
63 | 4: |
63 | 4: |
64 | add r3, r0, #3 |
64 | add r3, r0, #3 |
65 | bic r3, r3, #3 |
65 | bic r3, r3, #3 |
66 | cmp r0, r3 |
66 | cmp r0, r3 |
67 | bne 1b |
67 | bne 1b |
68 | movs r4, r2, lsr #2 |
68 | movs r4, r2, lsr #2 |
69 | moveq lr, r4 |
69 | moveq lr, r4 |
70 | beq 6f |
70 | beq 6f |
71 | mov lr, #0 |
71 | mov lr, #0 |
72 | mov ip, lr |
72 | mov ip, lr |
73 | 5: |
73 | 5: |
74 | ldr r3, [ip, r1] |
74 | ldr r3, [ip, r1] |
75 | add lr, lr, #1 |
75 | add lr, lr, #1 |
76 | cmp lr, r4 |
76 | cmp lr, r4 |
77 | str r3, [ip, r0] |
77 | str r3, [ip, r0] |
78 | add ip, ip, #4 |
78 | add ip, ip, #4 |
79 | bne 5b |
79 | bne 5b |
80 | 6: |
80 | 6: |
81 | ands r4, r2, #3 |
81 | ands r4, r2, #3 |
82 | beq 3b |
82 | beq 3b |
83 | mov r3, lr, lsl #2 |
83 | mov r3, lr, lsl #2 |
84 | add r0, r3, r0 |
84 | add r0, r3, r0 |
85 | add ip, r3, r1 |
85 | add ip, r3, r1 |
86 | mov r2, #0 |
86 | mov r2, #0 |
87 | 7: |
87 | 7: |
88 | ldrb r3, [r2, ip] |
88 | ldrb r3, [r2, ip] |
89 | strb r3, [r2, r0] |
89 | strb r3, [r2, r0] |
90 | add r2, r2, #1 |
90 | add r2, r2, #1 |
91 | cmp r2, r4 |
91 | cmp r2, r4 |
92 | bne 7b |
92 | bne 7b |
93 | b 3b |
93 | b 3b |
94 | 94 | ||
95 | memcpy_from_uspace_failover_address: |
95 | memcpy_from_uspace_failover_address: |
96 | memcpy_to_uspace_failover_address: |
96 | memcpy_to_uspace_failover_address: |
97 | mov r0, #0 |
97 | mov r0, #0 |
98 | ldmia sp!, {r4, pc} |
98 | ldmia sp!, {r4, pc} |
99 | 99 |