libc_string.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2019 Actions Semi Co., Inc.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /* poriting from newlib */
  7. #ifndef __UVISION_VERSION
  8. #include <string.h>
  9. /* Support the alias for the __aeabi_memset which may
  10. assume memory alignment. */
  11. void __aeabi_memset4 (void *dest, size_t n, int c)
  12. __attribute__ ((alias ("__aeabi_memset")));
  13. void __aeabi_memset8 (void *dest, size_t n, int c)
  14. __attribute__ ((alias ("__aeabi_memset")));
  15. /* Support the routine __aeabi_memset. Can't alias to memset
  16. because it's not defined in the same translation unit. */
  17. void __aeabi_memset (void *dest, size_t n, int c)
  18. {
  19. /*Note that relative to ANSI memset, __aeabi_memset hase the order
  20. of its second and third arguments reversed. */
  21. memset (dest, c, n);
  22. }
  23. /* Support the alias for the __aeabi_memclr which may
  24. assume memory alignment. */
  25. void __aeabi_memclr4 (void *dest, size_t n)
  26. __attribute__ ((alias ("__aeabi_memclr")));
  27. void __aeabi_memclr8 (void *dest, size_t n)
  28. __attribute__ ((alias ("__aeabi_memclr")));
  29. /* Support the routine __aeabi_memclr. */
  30. void __aeabi_memclr (void *dest, size_t n)
  31. {
  32. extern void __aeabi_memset (void *dest, size_t n, int c);
  33. __aeabi_memset (dest, n, 0);
  34. }
  35. /* Support the alias for the __aeabi_memcpy which may
  36. assume memory alignment. */
  37. void __aeabi_memcpy4 (void *dest, const void *source, size_t n)
  38. __attribute__ ((alias ("__aeabi_memcpy")));
  39. void __aeabi_memcpy8 (void *dest, const void *source, size_t n)
  40. __attribute__ ((alias ("__aeabi_memcpy")));
  41. /* Support the routine __aeabi_memcpy. Can't alias to memcpy
  42. because it's not defined in the same translation unit. */
  43. void __aeabi_memcpy (void *dest, const void *source, size_t n)
  44. {
  45. memcpy (dest, source, n);
  46. }
  47. #endif