aeabi_memset.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #include "../assembly.h"
  9. // void __aeabi_memset(void *dest, size_t n, int c) { memset(dest, c, n); }
  10. // void __aeabi_memclr(void *dest, size_t n) { __aeabi_memset(dest, n, 0); }
  11. .syntax unified
  12. .p2align 2
  13. DEFINE_COMPILERRT_FUNCTION(__aeabi_memset)
  14. mov r3, r1
  15. mov r1, r2
  16. mov r2, r3
  17. #ifdef USE_THUMB_1
  18. push {r7, lr}
  19. bl memset
  20. pop {r7, pc}
  21. #else
  22. b memset
  23. #endif
  24. END_COMPILERRT_FUNCTION(__aeabi_memset)
  25. DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset4, __aeabi_memset)
  26. DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memset8, __aeabi_memset)
  27. .p2align 2
  28. DEFINE_COMPILERRT_FUNCTION(__aeabi_memclr)
  29. mov r2, r1
  30. movs r1, #0
  31. #ifdef USE_THUMB_1
  32. push {r7, lr}
  33. bl memset
  34. pop {r7, pc}
  35. #else
  36. b memset
  37. #endif
  38. END_COMPILERRT_FUNCTION(__aeabi_memclr)
  39. DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr4, __aeabi_memclr)
  40. DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_memclr8, __aeabi_memclr)
  41. NO_EXEC_STACK_DIRECTIVE