1 | //===-- aeabi_memset.S - EABI memset implementation -----------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "../assembly.h" |
10 | |
11 | // void __aeabi_memset(void *dest, size_t n, int c) { memset(dest, c, n); } |
12 | // void __aeabi_memclr(void *dest, size_t n) { __aeabi_memset(dest, n, 0); } |
13 | |
14 | .syntax unified |
15 | .p2align 2 |
16 | DEFINE_COMPILERRT_FUNCTION(__aeabi_memset) |
17 | mov r3, r1 |
18 | mov r1, r2 |
19 | mov r2, r3 |
20 | #ifdef USE_THUMB_1 |
21 | push {r7, lr} |
22 | bl memset |
23 | pop {r7, pc} |
24 | #else |
25 | b memset |
26 | #endif |
27 | END_COMPILERRT_FUNCTION(__aeabi_memset) |
28 | |
29 | DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset4, __aeabi_memset) |
30 | DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset8, __aeabi_memset) |
31 | |
32 | .p2align 2 |
33 | DEFINE_COMPILERRT_FUNCTION(__aeabi_memclr) |
34 | mov r2, r1 |
35 | movs r1, #0 |
36 | #ifdef USE_THUMB_1 |
37 | push {r7, lr} |
38 | bl memset |
39 | pop {r7, pc} |
40 | #else |
41 | b memset |
42 | #endif |
43 | END_COMPILERRT_FUNCTION(__aeabi_memclr) |
44 | |
45 | DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr4, __aeabi_memclr) |
46 | DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr8, __aeabi_memclr) |
47 | |
48 | NO_EXEC_STACK_DIRECTIVE |
49 | |
50 | |