TianoCore EDK2
master
Loading...
Searching...
No Matches
memset.c
1
// ------------------------------------------------------------------------------
2
//
3
// Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
4
// Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
5
//
6
// SPDX-License-Identifier: BSD-2-Clause-Patent
7
//
8
// ------------------------------------------------------------------------------
9
10
typedef
__SIZE_TYPE__ size_t;
11
12
static
__attribute__
((__used__))
13
void
*
14
__memset (
15
void
*s,
16
int
c,
17
size_t
n
18
)
19
{
20
unsigned
char
*d;
21
22
d = s;
23
24
while
(n-- != 0) {
25
*d++ = c;
26
}
27
28
return
s;
29
}
30
31
//
32
// Other modules (such as CryptoPkg/IntrinsicLib) may provide another
33
// implementation of memset(), which may conflict with this one if this
34
// object was pulled into the link due to the definitions below. So make
35
// our memset() 'weak' to let the other implementation take precedence.
36
//
37
__attribute__
((__weak__, __alias__ (
"__memset"
)))
38
void *
39
memset (
40
void
*dest,
41
int
c,
42
size_t
n
43
);
44
45
#ifdef __arm__
46
47
void
48
__aeabi_memset (
49
void
*dest,
50
size_t
n,
51
int
c
52
)
53
{
54
__memset (dest, c, n);
55
}
56
57
__attribute__
((__alias__ (
"__aeabi_memset"
)))
58
void
59
__aeabi_memset4 (
60
void
*dest,
61
size_t
n,
62
int
c
63
);
64
65
__attribute__
((__alias__ ("__aeabi_memset")))
66
void
67
__aeabi_memset8 (
68
void
*dest,
69
size_t
n,
70
int
c
71
);
72
73
void
74
__aeabi_memclr (
75
void
*dest,
76
size_t
n
77
)
78
{
79
__memset (dest, 0, n);
80
}
81
82
__attribute__
((__alias__ (
"__aeabi_memclr"
)))
83
void
84
__aeabi_memclr4 (
85
void
*dest,
86
size_t
n
87
);
88
89
__attribute__
((__alias__ ("__aeabi_memclr")))
90
void
91
__aeabi_memclr8 (
92
void
*dest,
93
size_t
n
94
);
95
96
#endif
__attribute__
unsigned long long UINT64 __attribute__((aligned(8)))
Definition:
ProcessorBind.h:28
MdePkg
Library
CompilerIntrinsicsLib
memset.c
Generated on Fri Nov 15 2024 18:01:17 for TianoCore EDK2 by
1.9.6