]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
ArmPkg/CompilerIntrinsicsLib: replace memcpy and memset with C code
[mirror_edk2.git] / ArmPkg / Library / CompilerIntrinsicsLib / memcpy.c
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c b/ArmPkg/Library/CompilerIntrinsicsLib/memcpy.c
new file mode 100644 (file)
index 0000000..a944e00
--- /dev/null
@@ -0,0 +1,44 @@
+//------------------------------------------------------------------------------\r
+//\r
+// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials are licensed and made\r
+// available under the terms and conditions of the BSD License which\r
+// accompanies this distribution.  The full text of the license may be\r
+// found at http://opensource.org/licenses/bsd-license.php\r
+//\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR\r
+// IMPLIED.\r
+//\r
+//------------------------------------------------------------------------------\r
+\r
+typedef __SIZE_TYPE__ size_t;\r
+\r
+static __attribute__((__used__))\r
+void *__memcpy(void *dest, const void *src, size_t n)\r
+{\r
+  unsigned char *d = dest;\r
+  unsigned char const *s = src;\r
+\r
+  while (n--)\r
+    *d++ = *s++;\r
+\r
+  return dest;\r
+}\r
+\r
+__attribute__((__alias__("__memcpy")))\r
+void *memcpy(void *dest, const void *src, size_t n);\r
+\r
+#ifdef __arm__\r
+\r
+__attribute__((__alias__("__memcpy")))\r
+void __aeabi_memcpy(void *dest, const void *src, size_t n);\r
+\r
+__attribute__((__alias__("__memcpy")))\r
+void __aeabi_memcpy4(void *dest, const void *src, size_t n);\r
+\r
+__attribute__((__alias__("__memcpy")))\r
+void __aeabi_memcpy8(void *dest, const void *src, size_t n);\r
+\r
+#endif\r