xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/arm/aeabi_memset.S (revision d4eeb02986980bf33dd56c41ceb9fc5f180c0d47)
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        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
27END_COMPILERRT_FUNCTION(__aeabi_memset)
28
29DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset4, __aeabi_memset)
30DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset8, __aeabi_memset)
31
32        .p2align 2
33DEFINE_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
43END_COMPILERRT_FUNCTION(__aeabi_memclr)
44
45DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr4, __aeabi_memclr)
46DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr8, __aeabi_memclr)
47
48NO_EXEC_STACK_DIRECTIVE
49
50