aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86/memcpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/memcpy.c')
-rw-r--r--src/arch/x86/memcpy.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/arch/x86/memcpy.c b/src/arch/x86/memcpy.c
index 2f23219de5..1cfdf89175 100644
--- a/src/arch/x86/memcpy.c
+++ b/src/arch/x86/memcpy.c
@@ -1,11 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <string.h>
+#include <stdbool.h>
+#include <asan.h>
void *memcpy(void *dest, const void *src, size_t n)
{
unsigned long d0, d1, d2;
+#if (ENV_ROMSTAGE && CONFIG(ASAN_IN_ROMSTAGE)) || \
+ (ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE))
+ check_memory_region((unsigned long)src, n, false, _RET_IP_);
+ check_memory_region((unsigned long)dest, n, true, _RET_IP_);
+#endif
+
asm volatile(
#ifdef __x86_64__
"rep ; movsd\n\t"