56 lines · plain
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-exception6//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 unified15 .p2align 216DEFINE_COMPILERRT_FUNCTION(__aeabi_memset)17#if defined(__ARM_FEATURE_BTI_DEFAULT)18 bti19#endif20 mov r3, r121 mov r1, r222 mov r2, r323#ifdef USE_THUMB_124 push {r7, lr}25 bl memset26 pop {r7, pc}27#else28 b memset29#endif30END_COMPILERRT_FUNCTION(__aeabi_memset)31 32DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset4, __aeabi_memset)33DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset8, __aeabi_memset)34 35 .p2align 236DEFINE_COMPILERRT_FUNCTION(__aeabi_memclr)37#if defined(__ARM_FEATURE_BTI_DEFAULT)38 bti39#endif40 mov r2, r141 movs r1, #042#ifdef USE_THUMB_143 push {r7, lr}44 bl memset45 pop {r7, pc}46#else47 b memset48#endif49END_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_DIRECTIVE55 56