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 | #if defined(__ARM_FEATURE_BTI_DEFAULT) |
18 | bti |
19 | #endif |
20 | mov r3, r1 |
21 | mov r1, r2 |
22 | mov r2, r3 |
23 | #ifdef USE_THUMB_1 |
24 | push {r7, lr} |
25 | bl memset |
26 | pop {r7, pc} |
27 | #else |
28 | b memset |
29 | #endif |
30 | END_COMPILERRT_FUNCTION(__aeabi_memset) |
31 | |
32 | DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset4, __aeabi_memset) |
33 | DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset8, __aeabi_memset) |
34 | |
35 | .p2align 2 |
36 | DEFINE_COMPILERRT_FUNCTION(__aeabi_memclr) |
37 | #if defined(__ARM_FEATURE_BTI_DEFAULT) |
38 | bti |
39 | #endif |
40 | mov r2, r1 |
41 | movs r1, #0 |
42 | #ifdef USE_THUMB_1 |
43 | push {r7, lr} |
44 | bl memset |
45 | pop {r7, pc} |
46 | #else |
47 | b memset |
48 | #endif |
49 | END_COMPILERRT_FUNCTION(__aeabi_memclr) |
50 | |
51 | DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr4, __aeabi_memclr) |
52 | DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr8, __aeabi_memclr) |
53 | |
54 | NO_EXEC_STACK_DIRECTIVE |
55 | |
56 |