Import BaseMemoryLibMmx;
[mirror_edk2.git] / MdePkg / Library / DxeMemoryLib / MemLibInternals.h
1 /** @file
2 Declaration of internal functions for Base Memory Library.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: MemLibInternals.h
14
15 The following BaseMemoryLib instances share the same version of this file:
16
17 BaseMemoryLib
18 BaseMemoryLibMmx
19 BaseMemoryLibSse2
20 BaseMemoryLibRepStr
21 PeiMemoryLib
22 DxeMemoryLib
23
24 **/
25
26 #ifndef __MEM_LIB_INTERNALS__
27 #define __MEM_LIB_INTERNALS__
28
29 /**
30 Copy Length bytes from Source to Destination.
31
32 @param Destination Target of copy
33 @param Source Place to copy from
34 @param Length Number of bytes to copy
35
36 @return Destination
37
38 **/
39 VOID *
40 EFIAPI
41 InternalMemCopyMem (
42 OUT VOID *DestinationBuffer,
43 IN CONST VOID *SourceBuffer,
44 IN UINTN Length
45 );
46
47 /**
48 Set Buffer to Value for Size bytes.
49
50 @param Buffer Memory to set.
51 @param Size Number of bytes to set
52 @param Value Value of the set operation.
53
54 @return Buffer
55
56 **/
57 VOID *
58 EFIAPI
59 InternalMemSetMem (
60 OUT VOID *Buffer,
61 IN UINTN Length,
62 IN UINT8 Value
63 );
64
65 /**
66 Fills a target buffer with a 16-bit value, and returns the target buffer.
67
68 @param Buffer Pointer to the target buffer to fill.
69 @param Length Number of bytes in Buffer to fill.
70 @param Value Value with which to fill Length bytes of Buffer.
71
72 @return Buffer
73
74 **/
75 VOID *
76 EFIAPI
77 InternalMemSetMem16 (
78 OUT VOID *Buffer,
79 IN UINTN Length,
80 IN UINT16 Value
81 );
82
83 /**
84 Fills a target buffer with a 32-bit value, and returns the target buffer.
85
86 @param Buffer Pointer to the target buffer to fill.
87 @param Length Number of bytes in Buffer to fill.
88 @param Value Value with which to fill Length bytes of Buffer.
89
90 @return Buffer
91
92 **/
93 VOID *
94 EFIAPI
95 InternalMemSetMem32 (
96 OUT VOID *Buffer,
97 IN UINTN Length,
98 IN UINT32 Value
99 );
100
101 /**
102 Fills a target buffer with a 64-bit value, and returns the target buffer.
103
104 @param Buffer Pointer to the target buffer to fill.
105 @param Length Number of bytes in Buffer to fill.
106 @param Value Value with which to fill Length bytes of Buffer.
107
108 @return Buffer
109
110 **/
111 VOID *
112 EFIAPI
113 InternalMemSetMem64 (
114 OUT VOID *Buffer,
115 IN UINTN Length,
116 IN UINT64 Value
117 );
118
119 /**
120 Set Buffer to 0 for Size bytes.
121
122 @param Buffer Memory to set.
123 @param Size Number of bytes to set
124
125 @return Buffer
126
127 **/
128 VOID *
129 EFIAPI
130 InternalMemZeroMem (
131 OUT VOID *Buffer,
132 IN UINTN Length
133 );
134
135 /**
136 Compares two memory buffers of a given length.
137
138 @param DestinationBuffer First memory buffer
139 @param SourceBuffer Second memory buffer
140 @param Length Length of DestinationBuffer and SourceBuffer memory
141 regions to compare. Must be non-zero.
142
143 @retval 0 if MemOne == MemTwo
144
145 **/
146 INTN
147 EFIAPI
148 InternalMemCompareMem (
149 IN CONST VOID *DestinationBuffer,
150 IN CONST VOID *SourceBuffer,
151 IN UINTN Length
152 );
153
154 /**
155 Scans a target buffer for an 8-bit value, and returns a pointer to the
156 matching 8-bit value in the target buffer.
157
158 @param Buffer Pointer to the target buffer to scan.
159 @param Length Number of bytes in Buffer to scan. Must be non-zero.
160 @param Value Value to search for in the target buffer.
161
162 @return Pointer to the first occurrence or NULL if not found.
163
164 **/
165 CONST VOID *
166 EFIAPI
167 InternalMemScanMem8 (
168 IN CONST VOID *Buffer,
169 IN UINTN Length,
170 IN UINT8 Value
171 );
172
173 /**
174 Scans a target buffer for a 16-bit value, and returns a pointer to the
175 matching 16-bit value in the target buffer.
176
177 @param Buffer Pointer to the target buffer to scan.
178 @param Length Number of bytes in Buffer to scan. Must be non-zero.
179 @param Value Value to search for in the target buffer.
180
181 @return Pointer to the first occurrence or NULL if not found.
182
183 **/
184 CONST VOID *
185 EFIAPI
186 InternalMemScanMem16 (
187 IN CONST VOID *Buffer,
188 IN UINTN Length,
189 IN UINT16 Value
190 );
191
192 /**
193 Scans a target buffer for a 32-bit value, and returns a pointer to the
194 matching 32-bit value in the target buffer.
195
196 @param Buffer Pointer to the target buffer to scan.
197 @param Length Number of bytes in Buffer to scan. Must be non-zero.
198 @param Value Value to search for in the target buffer.
199
200 @return Pointer to the first occurrence or NULL if not found.
201
202 **/
203 CONST VOID *
204 EFIAPI
205 InternalMemScanMem32 (
206 IN CONST VOID *Buffer,
207 IN UINTN Length,
208 IN UINT32 Value
209 );
210
211 /**
212 Scans a target buffer for a 64-bit value, and returns a pointer to the
213 matching 64-bit value in the target buffer.
214
215 @param Buffer Pointer to the target buffer to scan.
216 @param Length Number of bytes in Buffer to scan. Must be non-zero.
217 @param Value Value to search for in the target buffer.
218
219 @return Pointer to the first occurrence or NULL if not found.
220
221 **/
222 CONST VOID *
223 EFIAPI
224 InternalMemScanMem64 (
225 IN CONST VOID *Buffer,
226 IN UINTN Length,
227 IN UINT64 Value
228 );
229
230 #endif