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
16DEFINE_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
30END_COMPILERRT_FUNCTION(__aeabi_memset)
31
32DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset4, __aeabi_memset)
33DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset8, __aeabi_memset)
34
35 .p2align 2
36DEFINE_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
49END_COMPILERRT_FUNCTION(__aeabi_memclr)
50
51DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr4, __aeabi_memclr)
52DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr8, __aeabi_memclr)
53
54NO_EXEC_STACK_DIRECTIVE
55
56

Provided by KDAB

Privacy Policy
Update your C++ knowledge – Modern C++11/14/17 Training
Find out more

source code of compiler-rt/lib/builtins/arm/aeabi_memset.S