coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
memcpy.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
#include <
string.h
>
4
#include <
stdbool.h
>
5
#include <
asan.h
>
6
7
void
*
memcpy
(
void
*dest,
const
void
*src,
size_t
n)
8
{
9
unsigned
long
d0, d1, d2;
10
11
#if (ENV_ROMSTAGE && CONFIG(ASAN_IN_ROMSTAGE)) || \
12
(ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE))
13
check_memory_region
((
unsigned
long
)src, n,
false
,
_RET_IP_
);
14
check_memory_region
((
unsigned
long
)dest, n,
true
,
_RET_IP_
);
15
#endif
16
17
asm
volatile
(
18
#if ENV_X86_64
19
"rep ; movsd\n\t"
20
"mov %4,%%rcx\n\t"
21
#else
22
"rep ; movsl\n\t"
23
"movl %4,%%ecx\n\t"
24
#endif
25
"rep ; movsb\n\t"
26
:
"=&c"
(d0),
"=&D"
(d1),
"=&S"
(d2)
27
:
"0"
(n >> 2),
"g"
(n & 3),
"1"
(dest),
"2"
(src)
28
:
"memory"
29
);
30
31
return
dest;
32
}
memcpy
void * memcpy(void *dest, const void *src, size_t n)
Definition:
memcpy.c:7
asan.h
check_memory_region
void check_memory_region(unsigned long addr, size_t size, bool write, unsigned long ret_ip)
Definition:
asan.c:264
_RET_IP_
#define _RET_IP_
Definition:
asan.h:20
stdbool.h
string.h
src
arch
x86
memcpy.c
Generated by
1.9.1