summaryrefslogtreecommitdiff
path: root/src/arch/x86/lib/memcpy.c
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2011-10-25 23:43:34 +0000
committerStefan Reinauer <stefan.reinauer@coreboot.org>2012-03-30 00:51:31 +0200
commit0054afa11daa8db78dbe6aa55150238525187596 (patch)
tree4abd0ccc44c48378c3257816b9e0f6c878a3abd2 /src/arch/x86/lib/memcpy.c
parent19e7e7d2e7cb4ff0ae821448355ec8b14e0bd2bf (diff)
Add faster, architecture dependent memcpy()
Change-Id: I38d15f3f1ec65f0cb7974d2dd4ae6356433bddd8 Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: http://review.coreboot.org/736 Reviewed-by: Ronald G. Minnich <rminnich@gmail.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/arch/x86/lib/memcpy.c')
-rw-r--r--src/arch/x86/lib/memcpy.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/arch/x86/lib/memcpy.c b/src/arch/x86/lib/memcpy.c
new file mode 100644
index 0000000000..de210928a3
--- /dev/null
+++ b/src/arch/x86/lib/memcpy.c
@@ -0,0 +1,13 @@
+#include <string.h>
+
+void *memcpy(void *__restrict __dest,
+ __const void *__restrict __src, size_t __n)
+{
+ asm("cld\n"
+ "rep\n"
+ "movsb"
+ : /* no input (?) */
+ :"S"(__src), "D"(__dest), "c"(__n)
+ );
+ return __dest;
+}