source: trunk/libs/newlib/src/newlib/libc/machine/arm/aeabi_memset-thumb2.S @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.5 KB
Line 
1/*
2 * Copyright (c) 2015 ARM Ltd
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. The name of the company may not be used to endorse or promote
14 *    products derived from this software without specific prior written
15 *    permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29        .thumb
30        .syntax unified
31        .global __aeabi_memset
32        .type   __aeabi_memset, %function
33        ASM_ALIAS __aeabi_memset4 __aeabi_memset
34        ASM_ALIAS __aeabi_memset8 __aeabi_memset
35__aeabi_memset:
36        push    {r4, r5, r6}
37        lsls    r4, r0, #30
38        beq     10f
39        subs    r4, r1, #1
40        cmp     r1, #0
41        beq     9f
42        uxtb    r5, r2
43        mov     r3, r0
44        b       2f
451:
46        subs    r1, r4, #1
47        cbz     r4, 9f
48        mov     r4, r1
492:
50        strb    r5, [r3], #1
51        lsls    r1, r3, #30
52        bne     1b
533:
54        cmp     r4, #3
55        bls     7f
56        uxtb    r5, r2
57        orr     r5, r5, r5, lsl #8
58        cmp     r4, #15
59        orr     r5, r5, r5, lsl #16
60        bls     5f
61        mov     r6, r4
62        add     r1, r3, #16
634:
64        subs    r6, r6, #16
65        cmp     r6, #15
66        str     r5, [r1, #-16]
67        str     r5, [r1, #-12]
68        str     r5, [r1, #-8]
69        str     r5, [r1, #-4]
70        add     r1, r1, #16
71        bhi     4b
72        sub     r1, r4, #16
73        bic     r1, r1, #15
74        and     r4, r4, #15
75        adds    r1, r1, #16
76        cmp     r4, #3
77        add     r3, r3, r1
78        bls     7f
795:
80        mov     r6, r3
81        mov     r1, r4
826:
83        subs    r1, r1, #4
84        cmp     r1, #3
85        str     r5, [r6], #4
86        bhi     6b
87        subs    r1, r4, #4
88        bic     r1, r1, #3
89        adds    r1, r1, #4
90        add     r3, r3, r1
91        and     r4, r4, #3
927:
93        cbz     r4, 9f
94        uxtb    r2, r2
95        add     r4, r4, r3
968:
97        strb    r2, [r3], #1
98        cmp     r3, r4
99        bne     8b
1009:
101        pop     {r4, r5, r6}
102        bx      lr
10310:
104        mov     r4, r1
105        mov     r3, r0
106        b       3b
107        .size __aeabi_memset, . - __aeabi_memset
Note: See TracBrowser for help on using the repository browser.