2
* Copyright (C) 2008 The Android Open Source Project
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
8
* * Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* * Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in
12
* the documentation and/or other materials provided with the
15
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31
.type memset, %function
34
.type bzero, %function
39
* Optimized memset() for ARM.
41
* memset() returns its first argument.
49
/* compute the offset to align the destination
50
* offset = (4-(src&3))&3 = -src & 3
54
stmfd sp!, {r0, r4-r7, lr}
62
orr r1, r1, r1, lsr #8
63
orr r1, r1, r1, lsr #16
66
strcsb r1, [r0], #1 /* can't use strh (alignment unknown) */
70
ldmlsfd sp!, {r0, r4-r7, lr} /* return */
73
/* align the destination to a cache-line */
88
/* conditionnaly writes 0 to 7 words (length in r3) */
101
stmia r0!, {r1,r3,r4,r5,r6,r7,r12,lr}
105
/* conditionnaly stores 0 to 31 bytes */
107
stmcsia r0!, {r1,r3,r12,lr}
108
stmmiia r0!, {r1, lr}
114
ldmfd sp!, {r0, r4-r7, lr}