summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/CompilerIntrinsicsLib/memcpy.c
blob: 415146f7f2bf9a92b7ff3de4972579a4942c4af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// ------------------------------------------------------------------------------
//
// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
// ------------------------------------------------------------------------------

typedef __SIZE_TYPE__ size_t;

static void
__memcpy (
  void        *dest,
  const void  *src,
  size_t      n
  )
{
  unsigned char        *d;
  unsigned char const  *s;

  d = dest;
  s = src;

  while (n-- != 0) {
    *d++ = *s++;
  }
}

void *
memcpy (
  void        *dest,
  const void  *src,
  size_t      n
  )
{
  __memcpy (dest, src, n);
  return dest;
}

#ifdef __arm__

__attribute__ ((__alias__ ("__memcpy")))
void
__aeabi_memcpy (
  void        *dest,
  const void  *src,
  size_t      n
  );

__attribute__ ((__alias__ ("__memcpy")))
void
__aeabi_memcpy4 (
  void        *dest,
  const void  *src,
  size_t      n
  );

__attribute__ ((__alias__ ("__memcpy")))
void
__aeabi_memcpy8 (
  void        *dest,
  const void  *src,
  size_t      n
  );

#endif