summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/Kconfig4
-rw-r--r--src/arch/x86/lib/Makefile.inc4
-rw-r--r--src/arch/x86/lib/memcpy.c13
3 files changed, 21 insertions, 0 deletions
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 314646fdb9..5ee7c4ac77 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -76,6 +76,10 @@ config CMOS_DEFAULT_FILE
config BOOTBLOCK_SOUTHBRIDGE_INIT
string
+config HAVE_ARCH_MEMCPY
+ bool
+ default y
+
config BIG_ENDIAN
bool
default n
diff --git a/src/arch/x86/lib/Makefile.inc b/src/arch/x86/lib/Makefile.inc
index 3388a9dea3..f99e429eef 100644
--- a/src/arch/x86/lib/Makefile.inc
+++ b/src/arch/x86/lib/Makefile.inc
@@ -8,8 +8,12 @@ ramstage-$(CONFIG_MMCONF_SUPPORT) += pci_ops_mmconf.c
ramstage-y += pci_ops_auto.c
ramstage-y += exception.c
ramstage-$(CONFIG_IOAPIC) += ioapic.c
+ramstage-y += memcpy.c
romstage-y += romstage_console.c
romstage-y += cbfs_and_run.c
+romstage-y += memcpy.c
+
+smm-y += memcpy.c
$(obj)/arch/x86/lib/console.ramstage.o :: $(obj)/build.h
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;
+}