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