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