]>
Commit | Line | Data |
---|---|---|
ac644614 | 1 | /** @file\r |
50a64e5b | 2 | Provides string functions, linked list functions, math functions, synchronization\r |
ae591c14 | 3 | functions, file path functions, and CPU architecture-specific functions.\r |
ac644614 | 4 | \r |
b590e43a | 5 | Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r |
9df063a0 HT |
6 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
7 | This program and the accompanying materials\r | |
50a64e5b | 8 | are licensed and made available under the terms and conditions of the BSD License\r |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
af2dc6a7 | 10 | http://opensource.org/licenses/bsd-license.php.\r |
ac644614 | 11 | \r |
50a64e5b | 12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
ac644614 | 14 | \r |
15 | **/\r | |
16 | \r | |
17 | #ifndef __BASE_LIB__\r | |
18 | #define __BASE_LIB__\r | |
19 | \r | |
1106ffe1 | 20 | //\r |
1a2f870c | 21 | // Definitions for architecture-specific types\r |
1106ffe1 | 22 | //\r |
ac644614 | 23 | #if defined (MDE_CPU_IA32)\r |
fc30687f | 24 | ///\r |
af2dc6a7 | 25 | /// The IA-32 architecture context buffer used by SetJump() and LongJump().\r |
fc30687f | 26 | ///\r |
ac644614 | 27 | typedef struct {\r |
28 | UINT32 Ebx;\r | |
29 | UINT32 Esi;\r | |
30 | UINT32 Edi;\r | |
31 | UINT32 Ebp;\r | |
32 | UINT32 Esp;\r | |
33 | UINT32 Eip;\r | |
34 | } BASE_LIBRARY_JUMP_BUFFER;\r | |
35 | \r | |
36 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4\r | |
37 | \r | |
aa4df547 | 38 | #endif // defined (MDE_CPU_IA32)\r |
39 | \r | |
40 | #if defined (MDE_CPU_IPF)\r | |
ac644614 | 41 | \r |
fc30687f | 42 | ///\r |
af2dc6a7 | 43 | /// The Itanium architecture context buffer used by SetJump() and LongJump().\r |
fc30687f | 44 | ///\r |
ac644614 | 45 | typedef struct {\r |
46 | UINT64 F2[2];\r | |
47 | UINT64 F3[2];\r | |
48 | UINT64 F4[2];\r | |
49 | UINT64 F5[2];\r | |
50 | UINT64 F16[2];\r | |
51 | UINT64 F17[2];\r | |
52 | UINT64 F18[2];\r | |
53 | UINT64 F19[2];\r | |
54 | UINT64 F20[2];\r | |
55 | UINT64 F21[2];\r | |
56 | UINT64 F22[2];\r | |
57 | UINT64 F23[2];\r | |
58 | UINT64 F24[2];\r | |
59 | UINT64 F25[2];\r | |
60 | UINT64 F26[2];\r | |
61 | UINT64 F27[2];\r | |
62 | UINT64 F28[2];\r | |
63 | UINT64 F29[2];\r | |
64 | UINT64 F30[2];\r | |
65 | UINT64 F31[2];\r | |
66 | UINT64 R4;\r | |
67 | UINT64 R5;\r | |
68 | UINT64 R6;\r | |
69 | UINT64 R7;\r | |
70 | UINT64 SP;\r | |
71 | UINT64 BR0;\r | |
72 | UINT64 BR1;\r | |
73 | UINT64 BR2;\r | |
74 | UINT64 BR3;\r | |
75 | UINT64 BR4;\r | |
76 | UINT64 BR5;\r | |
77 | UINT64 InitialUNAT;\r | |
78 | UINT64 AfterSpillUNAT;\r | |
79 | UINT64 PFS;\r | |
80 | UINT64 BSP;\r | |
81 | UINT64 Predicates;\r | |
82 | UINT64 LoopCount;\r | |
83 | UINT64 FPSR;\r | |
84 | } BASE_LIBRARY_JUMP_BUFFER;\r | |
85 | \r | |
86 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 0x10\r | |
87 | \r | |
aa4df547 | 88 | #endif // defined (MDE_CPU_IPF)\r |
89 | \r | |
90 | #if defined (MDE_CPU_X64)\r | |
fc30687f | 91 | ///\r |
af2dc6a7 | 92 | /// The x64 architecture context buffer used by SetJump() and LongJump().\r |
fc30687f | 93 | ///\r |
ac644614 | 94 | typedef struct {\r |
95 | UINT64 Rbx;\r | |
96 | UINT64 Rsp;\r | |
97 | UINT64 Rbp;\r | |
98 | UINT64 Rdi;\r | |
99 | UINT64 Rsi;\r | |
100 | UINT64 R12;\r | |
101 | UINT64 R13;\r | |
102 | UINT64 R14;\r | |
103 | UINT64 R15;\r | |
104 | UINT64 Rip;\r | |
9b9641c6 | 105 | UINT64 MxCsr;\r |
af2dc6a7 | 106 | UINT8 XmmBuffer[160]; ///< XMM6-XMM15.\r |
ac644614 | 107 | } BASE_LIBRARY_JUMP_BUFFER;\r |
108 | \r | |
109 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8\r | |
110 | \r | |
aa4df547 | 111 | #endif // defined (MDE_CPU_X64)\r |
112 | \r | |
113 | #if defined (MDE_CPU_EBC)\r | |
fc30687f | 114 | ///\r |
af2dc6a7 | 115 | /// The EBC context buffer used by SetJump() and LongJump().\r |
fc30687f | 116 | ///\r |
ac644614 | 117 | typedef struct {\r |
118 | UINT64 R0;\r | |
119 | UINT64 R1;\r | |
120 | UINT64 R2;\r | |
121 | UINT64 R3;\r | |
122 | UINT64 IP;\r | |
123 | } BASE_LIBRARY_JUMP_BUFFER;\r | |
124 | \r | |
125 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8\r | |
126 | \r | |
aa4df547 | 127 | #endif // defined (MDE_CPU_EBC)\r |
ac644614 | 128 | \r |
ebd04fc2 | 129 | #if defined (MDE_CPU_ARM)\r |
130 | \r | |
131 | typedef struct {\r | |
af2dc6a7 | 132 | UINT32 R3; ///< A copy of R13.\r |
01a54966 | 133 | UINT32 R4;\r |
134 | UINT32 R5;\r | |
135 | UINT32 R6;\r | |
136 | UINT32 R7;\r | |
137 | UINT32 R8;\r | |
138 | UINT32 R9;\r | |
139 | UINT32 R10;\r | |
140 | UINT32 R11;\r | |
141 | UINT32 R12;\r | |
142 | UINT32 R14;\r | |
ebd04fc2 | 143 | } BASE_LIBRARY_JUMP_BUFFER;\r |
144 | \r | |
145 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4\r | |
146 | \r | |
147 | #endif // defined (MDE_CPU_ARM)\r | |
148 | \r | |
807e2604 HL |
149 | #if defined (MDE_CPU_AARCH64)\r |
150 | typedef struct {\r | |
151 | // GP regs\r | |
152 | UINT64 X19;\r | |
153 | UINT64 X20;\r | |
154 | UINT64 X21;\r | |
155 | UINT64 X22;\r | |
156 | UINT64 X23;\r | |
157 | UINT64 X24;\r | |
158 | UINT64 X25;\r | |
159 | UINT64 X26;\r | |
160 | UINT64 X27;\r | |
161 | UINT64 X28;\r | |
162 | UINT64 FP;\r | |
163 | UINT64 LR;\r | |
164 | UINT64 IP0;\r | |
165 | \r | |
166 | // FP regs\r | |
167 | UINT64 D8;\r | |
168 | UINT64 D9;\r | |
169 | UINT64 D10;\r | |
170 | UINT64 D11;\r | |
171 | UINT64 D12;\r | |
172 | UINT64 D13;\r | |
173 | UINT64 D14;\r | |
174 | UINT64 D15;\r | |
175 | } BASE_LIBRARY_JUMP_BUFFER;\r | |
176 | \r | |
177 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8\r | |
178 | \r | |
179 | #endif // defined (MDE_CPU_AARCH64)\r | |
180 | \r | |
181 | \r | |
ac644614 | 182 | //\r |
183 | // String Services\r | |
184 | //\r | |
185 | \r | |
c058d59f JY |
186 | \r |
187 | /**\r | |
188 | Returns the length of a Null-terminated Unicode string.\r | |
189 | \r | |
328f84b1 JY |
190 | This function is similar as strlen_s defined in C11.\r |
191 | \r | |
c058d59f JY |
192 | If String is not aligned on a 16-bit boundary, then ASSERT().\r |
193 | \r | |
194 | @param String A pointer to a Null-terminated Unicode string.\r | |
195 | @param MaxSize The maximum number of Destination Unicode\r | |
196 | char, including terminating null char.\r | |
197 | \r | |
198 | @retval 0 If String is NULL.\r | |
199 | @retval MaxSize If there is no null character in the first MaxSize characters of String.\r | |
200 | @return The number of characters that percede the terminating null character.\r | |
201 | \r | |
202 | **/\r | |
203 | UINTN\r | |
204 | EFIAPI\r | |
205 | StrnLenS (\r | |
206 | IN CONST CHAR16 *String,\r | |
207 | IN UINTN MaxSize\r | |
208 | );\r | |
209 | \r | |
b590e43a HW |
210 | /**\r |
211 | Returns the size of a Null-terminated Unicode string in bytes, including the\r | |
212 | Null terminator.\r | |
213 | \r | |
214 | This function returns the size of the Null-terminated Unicode string\r | |
215 | specified by String in bytes, including the Null terminator.\r | |
216 | \r | |
217 | If String is not aligned on a 16-bit boundary, then ASSERT().\r | |
218 | \r | |
219 | @param String A pointer to a Null-terminated Unicode string.\r | |
220 | @param MaxSize The maximum number of Destination Unicode\r | |
221 | char, including the Null terminator.\r | |
222 | \r | |
223 | @retval 0 If String is NULL.\r | |
224 | @retval (sizeof (CHAR16) * (MaxSize + 1))\r | |
225 | If there is no Null terminator in the first MaxSize characters of\r | |
226 | String.\r | |
227 | @return The size of the Null-terminated Unicode string in bytes, including\r | |
228 | the Null terminator.\r | |
229 | \r | |
230 | **/\r | |
231 | UINTN\r | |
232 | EFIAPI\r | |
233 | StrnSizeS (\r | |
234 | IN CONST CHAR16 *String,\r | |
235 | IN UINTN MaxSize\r | |
236 | );\r | |
237 | \r | |
c058d59f JY |
238 | /**\r |
239 | Copies the string pointed to by Source (including the terminating null char)\r | |
240 | to the array pointed to by Destination.\r | |
241 | \r | |
328f84b1 JY |
242 | This function is similar as strcpy_s defined in C11.\r |
243 | \r | |
c058d59f JY |
244 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r |
245 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
0e93edbb | 246 | If an error would be returned, then the function will also ASSERT().\r |
c058d59f | 247 | \r |
328f84b1 JY |
248 | If an error is returned, then the Destination is unmodified.\r |
249 | \r | |
c058d59f JY |
250 | @param Destination A pointer to a Null-terminated Unicode string.\r |
251 | @param DestMax The maximum number of Destination Unicode\r | |
252 | char, including terminating null char.\r | |
253 | @param Source A pointer to a Null-terminated Unicode string.\r | |
254 | \r | |
255 | @retval RETURN_SUCCESS String is copied.\r | |
256 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).\r | |
257 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
258 | If Source is NULL.\r | |
259 | If PcdMaximumUnicodeStringLength is not zero,\r | |
260 | and DestMax is greater than \r | |
261 | PcdMaximumUnicodeStringLength.\r | |
262 | If DestMax is 0.\r | |
263 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
264 | **/\r | |
265 | RETURN_STATUS\r | |
266 | EFIAPI\r | |
267 | StrCpyS (\r | |
268 | OUT CHAR16 *Destination,\r | |
269 | IN UINTN DestMax,\r | |
270 | IN CONST CHAR16 *Source\r | |
271 | );\r | |
272 | \r | |
273 | /**\r | |
274 | Copies not more than Length successive char from the string pointed to by\r | |
275 | Source to the array pointed to by Destination. If no null char is copied from\r | |
276 | Source, then Destination[Length] is always set to null.\r | |
277 | \r | |
328f84b1 JY |
278 | This function is similar as strncpy_s defined in C11.\r |
279 | \r | |
c058d59f JY |
280 | If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r |
281 | If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
0e93edbb | 282 | If an error would be returned, then the function will also ASSERT().\r |
c058d59f | 283 | \r |
328f84b1 JY |
284 | If an error is returned, then the Destination is unmodified.\r |
285 | \r | |
c058d59f JY |
286 | @param Destination A pointer to a Null-terminated Unicode string.\r |
287 | @param DestMax The maximum number of Destination Unicode\r | |
288 | char, including terminating null char.\r | |
289 | @param Source A pointer to a Null-terminated Unicode string.\r | |
290 | @param Length The maximum number of Unicode characters to copy.\r | |
291 | \r | |
292 | @retval RETURN_SUCCESS String is copied.\r | |
293 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than \r | |
294 | MIN(StrLen(Source), Length).\r | |
295 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
296 | If Source is NULL.\r | |
297 | If PcdMaximumUnicodeStringLength is not zero,\r | |
298 | and DestMax is greater than \r | |
299 | PcdMaximumUnicodeStringLength.\r | |
300 | If DestMax is 0.\r | |
301 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
302 | **/\r | |
303 | RETURN_STATUS\r | |
304 | EFIAPI\r | |
305 | StrnCpyS (\r | |
306 | OUT CHAR16 *Destination,\r | |
307 | IN UINTN DestMax,\r | |
308 | IN CONST CHAR16 *Source,\r | |
309 | IN UINTN Length\r | |
310 | );\r | |
311 | \r | |
312 | /**\r | |
313 | Appends a copy of the string pointed to by Source (including the terminating\r | |
314 | null char) to the end of the string pointed to by Destination.\r | |
315 | \r | |
328f84b1 JY |
316 | This function is similar as strcat_s defined in C11.\r |
317 | \r | |
c058d59f JY |
318 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r |
319 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
0e93edbb | 320 | If an error would be returned, then the function will also ASSERT().\r |
c058d59f | 321 | \r |
328f84b1 JY |
322 | If an error is returned, then the Destination is unmodified.\r |
323 | \r | |
c058d59f JY |
324 | @param Destination A pointer to a Null-terminated Unicode string.\r |
325 | @param DestMax The maximum number of Destination Unicode\r | |
326 | char, including terminating null char.\r | |
327 | @param Source A pointer to a Null-terminated Unicode string.\r | |
328 | \r | |
329 | @retval RETURN_SUCCESS String is appended.\r | |
330 | @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than \r | |
331 | StrLen(Destination).\r | |
332 | @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT\r | |
333 | greater than StrLen(Source).\r | |
334 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
335 | If Source is NULL.\r | |
336 | If PcdMaximumUnicodeStringLength is not zero,\r | |
337 | and DestMax is greater than \r | |
338 | PcdMaximumUnicodeStringLength.\r | |
339 | If DestMax is 0.\r | |
340 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
341 | **/\r | |
342 | RETURN_STATUS\r | |
343 | EFIAPI\r | |
344 | StrCatS (\r | |
345 | IN OUT CHAR16 *Destination,\r | |
346 | IN UINTN DestMax,\r | |
347 | IN CONST CHAR16 *Source\r | |
348 | );\r | |
349 | \r | |
350 | /**\r | |
351 | Appends not more than Length successive char from the string pointed to by\r | |
352 | Source to the end of the string pointed to by Destination. If no null char is\r | |
353 | copied from Source, then Destination[StrLen(Destination) + Length] is always\r | |
354 | set to null.\r | |
355 | \r | |
328f84b1 JY |
356 | This function is similar as strncat_s defined in C11.\r |
357 | \r | |
c058d59f | 358 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r |
0e93edbb JY |
359 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r |
360 | If an error would be returned, then the function will also ASSERT().\r | |
c058d59f | 361 | \r |
328f84b1 JY |
362 | If an error is returned, then the Destination is unmodified.\r |
363 | \r | |
c058d59f JY |
364 | @param Destination A pointer to a Null-terminated Unicode string.\r |
365 | @param DestMax The maximum number of Destination Unicode\r | |
366 | char, including terminating null char.\r | |
367 | @param Source A pointer to a Null-terminated Unicode string.\r | |
368 | @param Length The maximum number of Unicode characters to copy.\r | |
369 | \r | |
370 | @retval RETURN_SUCCESS String is appended.\r | |
371 | @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than\r | |
372 | StrLen(Destination).\r | |
373 | @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT\r | |
374 | greater than MIN(StrLen(Source), Length).\r | |
375 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
376 | If Source is NULL.\r | |
377 | If PcdMaximumUnicodeStringLength is not zero,\r | |
378 | and DestMax is greater than \r | |
379 | PcdMaximumUnicodeStringLength.\r | |
380 | If DestMax is 0.\r | |
381 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
382 | **/\r | |
383 | RETURN_STATUS\r | |
384 | EFIAPI\r | |
385 | StrnCatS (\r | |
386 | IN OUT CHAR16 *Destination,\r | |
387 | IN UINTN DestMax,\r | |
388 | IN CONST CHAR16 *Source,\r | |
389 | IN UINTN Length\r | |
390 | );\r | |
391 | \r | |
d8af3301 HW |
392 | /**\r |
393 | Convert a Null-terminated Unicode decimal string to a value of type UINTN.\r | |
394 | \r | |
395 | This function outputs a value of type UINTN by interpreting the contents of\r | |
396 | the Unicode string specified by String as a decimal number. The format of the\r | |
397 | input Unicode string String is:\r | |
398 | \r | |
399 | [spaces] [decimal digits].\r | |
400 | \r | |
401 | The valid decimal digit character is in the range [0-9]. The function will\r | |
402 | ignore the pad space, which includes spaces or tab characters, before\r | |
403 | [decimal digits]. The running zero in the beginning of [decimal digits] will\r | |
404 | be ignored. Then, the function stops at the first character that is a not a\r | |
405 | valid decimal character or a Null-terminator, whichever one comes first.\r | |
406 | \r | |
407 | If String is NULL, then ASSERT().\r | |
408 | If Data is NULL, then ASSERT().\r | |
409 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
410 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
411 | PcdMaximumUnicodeStringLength Unicode characters, not including the\r | |
412 | Null-terminator, then ASSERT().\r | |
413 | \r | |
414 | If String has no valid decimal digits in the above format, then 0 is stored\r | |
415 | at the location pointed to by Data.\r | |
416 | If the number represented by String exceeds the range defined by UINTN, then\r | |
417 | MAX_UINTN is stored at the location pointed to by Data.\r | |
418 | \r | |
419 | If EndPointer is not NULL, a pointer to the character that stopped the scan\r | |
420 | is stored at the location pointed to by EndPointer. If String has no valid\r | |
421 | decimal digits right after the optional pad spaces, the value of String is\r | |
422 | stored at the location pointed to by EndPointer.\r | |
423 | \r | |
424 | @param String Pointer to a Null-terminated Unicode string.\r | |
425 | @param EndPointer Pointer to character that stops scan.\r | |
426 | @param Data Pointer to the converted value.\r | |
427 | \r | |
428 | @retval RETURN_SUCCESS Value is translated from String.\r | |
429 | @retval RETURN_INVALID_PARAMETER If String is NULL.\r | |
430 | If Data is NULL.\r | |
431 | If PcdMaximumUnicodeStringLength is not\r | |
432 | zero, and String contains more than\r | |
433 | PcdMaximumUnicodeStringLength Unicode\r | |
434 | characters, not including the\r | |
435 | Null-terminator.\r | |
436 | @retval RETURN_UNSUPPORTED If the number represented by String exceeds\r | |
437 | the range defined by UINTN.\r | |
438 | \r | |
439 | **/\r | |
440 | RETURN_STATUS\r | |
441 | EFIAPI\r | |
442 | StrDecimalToUintnS (\r | |
443 | IN CONST CHAR16 *String,\r | |
444 | OUT CHAR16 **EndPointer, OPTIONAL\r | |
445 | OUT UINTN *Data\r | |
446 | );\r | |
447 | \r | |
448 | /**\r | |
449 | Convert a Null-terminated Unicode decimal string to a value of type UINT64.\r | |
450 | \r | |
451 | This function outputs a value of type UINT64 by interpreting the contents of\r | |
452 | the Unicode string specified by String as a decimal number. The format of the\r | |
453 | input Unicode string String is:\r | |
454 | \r | |
455 | [spaces] [decimal digits].\r | |
456 | \r | |
457 | The valid decimal digit character is in the range [0-9]. The function will\r | |
458 | ignore the pad space, which includes spaces or tab characters, before\r | |
459 | [decimal digits]. The running zero in the beginning of [decimal digits] will\r | |
460 | be ignored. Then, the function stops at the first character that is a not a\r | |
461 | valid decimal character or a Null-terminator, whichever one comes first.\r | |
462 | \r | |
463 | If String is NULL, then ASSERT().\r | |
464 | If Data is NULL, then ASSERT().\r | |
465 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
466 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
467 | PcdMaximumUnicodeStringLength Unicode characters, not including the\r | |
468 | Null-terminator, then ASSERT().\r | |
469 | \r | |
470 | If String has no valid decimal digits in the above format, then 0 is stored\r | |
471 | at the location pointed to by Data.\r | |
472 | If the number represented by String exceeds the range defined by UINT64, then\r | |
473 | MAX_UINT64 is stored at the location pointed to by Data.\r | |
474 | \r | |
475 | If EndPointer is not NULL, a pointer to the character that stopped the scan\r | |
476 | is stored at the location pointed to by EndPointer. If String has no valid\r | |
477 | decimal digits right after the optional pad spaces, the value of String is\r | |
478 | stored at the location pointed to by EndPointer.\r | |
479 | \r | |
480 | @param String Pointer to a Null-terminated Unicode string.\r | |
481 | @param EndPointer Pointer to character that stops scan.\r | |
482 | @param Data Pointer to the converted value.\r | |
483 | \r | |
484 | @retval RETURN_SUCCESS Value is translated from String.\r | |
485 | @retval RETURN_INVALID_PARAMETER If String is NULL.\r | |
486 | If Data is NULL.\r | |
487 | If PcdMaximumUnicodeStringLength is not\r | |
488 | zero, and String contains more than\r | |
489 | PcdMaximumUnicodeStringLength Unicode\r | |
490 | characters, not including the\r | |
491 | Null-terminator.\r | |
492 | @retval RETURN_UNSUPPORTED If the number represented by String exceeds\r | |
493 | the range defined by UINT64.\r | |
494 | \r | |
495 | **/\r | |
496 | RETURN_STATUS\r | |
497 | EFIAPI\r | |
498 | StrDecimalToUint64S (\r | |
499 | IN CONST CHAR16 *String,\r | |
500 | OUT CHAR16 **EndPointer, OPTIONAL\r | |
501 | OUT UINT64 *Data\r | |
502 | );\r | |
503 | \r | |
504 | /**\r | |
505 | Convert a Null-terminated Unicode hexadecimal string to a value of type\r | |
506 | UINTN.\r | |
507 | \r | |
508 | This function outputs a value of type UINTN by interpreting the contents of\r | |
509 | the Unicode string specified by String as a hexadecimal number. The format of\r | |
510 | the input Unicode string String is:\r | |
511 | \r | |
512 | [spaces][zeros][x][hexadecimal digits].\r | |
513 | \r | |
514 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
515 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.\r | |
516 | If "x" appears in the input string, it must be prefixed with at least one 0.\r | |
517 | The function will ignore the pad space, which includes spaces or tab\r | |
518 | characters, before [zeros], [x] or [hexadecimal digit]. The running zero\r | |
519 | before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts\r | |
520 | after [x] or the first valid hexadecimal digit. Then, the function stops at\r | |
521 | the first character that is a not a valid hexadecimal character or NULL,\r | |
522 | whichever one comes first.\r | |
523 | \r | |
524 | If String is NULL, then ASSERT().\r | |
525 | If Data is NULL, then ASSERT().\r | |
526 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
527 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
528 | PcdMaximumUnicodeStringLength Unicode characters, not including the\r | |
529 | Null-terminator, then ASSERT().\r | |
530 | \r | |
531 | If String has no valid hexadecimal digits in the above format, then 0 is\r | |
532 | stored at the location pointed to by Data.\r | |
533 | If the number represented by String exceeds the range defined by UINTN, then\r | |
534 | MAX_UINTN is stored at the location pointed to by Data.\r | |
535 | \r | |
536 | If EndPointer is not NULL, a pointer to the character that stopped the scan\r | |
537 | is stored at the location pointed to by EndPointer. If String has no valid\r | |
538 | hexadecimal digits right after the optional pad spaces, the value of String\r | |
539 | is stored at the location pointed to by EndPointer.\r | |
540 | \r | |
541 | @param String Pointer to a Null-terminated Unicode string.\r | |
542 | @param EndPointer Pointer to character that stops scan.\r | |
543 | @param Data Pointer to the converted value.\r | |
544 | \r | |
545 | @retval RETURN_SUCCESS Value is translated from String.\r | |
546 | @retval RETURN_INVALID_PARAMETER If String is NULL.\r | |
547 | If Data is NULL.\r | |
548 | If PcdMaximumUnicodeStringLength is not\r | |
549 | zero, and String contains more than\r | |
550 | PcdMaximumUnicodeStringLength Unicode\r | |
551 | characters, not including the\r | |
552 | Null-terminator.\r | |
553 | @retval RETURN_UNSUPPORTED If the number represented by String exceeds\r | |
554 | the range defined by UINTN.\r | |
555 | \r | |
556 | **/\r | |
557 | RETURN_STATUS\r | |
558 | EFIAPI\r | |
559 | StrHexToUintnS (\r | |
560 | IN CONST CHAR16 *String,\r | |
561 | OUT CHAR16 **EndPointer, OPTIONAL\r | |
562 | OUT UINTN *Data\r | |
563 | );\r | |
564 | \r | |
565 | /**\r | |
566 | Convert a Null-terminated Unicode hexadecimal string to a value of type\r | |
567 | UINT64.\r | |
568 | \r | |
569 | This function outputs a value of type UINT64 by interpreting the contents of\r | |
570 | the Unicode string specified by String as a hexadecimal number. The format of\r | |
571 | the input Unicode string String is:\r | |
572 | \r | |
573 | [spaces][zeros][x][hexadecimal digits].\r | |
574 | \r | |
575 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
576 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.\r | |
577 | If "x" appears in the input string, it must be prefixed with at least one 0.\r | |
578 | The function will ignore the pad space, which includes spaces or tab\r | |
579 | characters, before [zeros], [x] or [hexadecimal digit]. The running zero\r | |
580 | before [x] or [hexadecimal digit] will be ignored. Then, the decoding starts\r | |
581 | after [x] or the first valid hexadecimal digit. Then, the function stops at\r | |
582 | the first character that is a not a valid hexadecimal character or NULL,\r | |
583 | whichever one comes first.\r | |
584 | \r | |
585 | If String is NULL, then ASSERT().\r | |
586 | If Data is NULL, then ASSERT().\r | |
587 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
588 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
589 | PcdMaximumUnicodeStringLength Unicode characters, not including the\r | |
590 | Null-terminator, then ASSERT().\r | |
591 | \r | |
592 | If String has no valid hexadecimal digits in the above format, then 0 is\r | |
593 | stored at the location pointed to by Data.\r | |
594 | If the number represented by String exceeds the range defined by UINT64, then\r | |
595 | MAX_UINT64 is stored at the location pointed to by Data.\r | |
596 | \r | |
597 | If EndPointer is not NULL, a pointer to the character that stopped the scan\r | |
598 | is stored at the location pointed to by EndPointer. If String has no valid\r | |
599 | hexadecimal digits right after the optional pad spaces, the value of String\r | |
600 | is stored at the location pointed to by EndPointer.\r | |
601 | \r | |
602 | @param String Pointer to a Null-terminated Unicode string.\r | |
603 | @param EndPointer Pointer to character that stops scan.\r | |
604 | @param Data Pointer to the converted value.\r | |
605 | \r | |
606 | @retval RETURN_SUCCESS Value is translated from String.\r | |
607 | @retval RETURN_INVALID_PARAMETER If String is NULL.\r | |
608 | If Data is NULL.\r | |
609 | If PcdMaximumUnicodeStringLength is not\r | |
610 | zero, and String contains more than\r | |
611 | PcdMaximumUnicodeStringLength Unicode\r | |
612 | characters, not including the\r | |
613 | Null-terminator.\r | |
614 | @retval RETURN_UNSUPPORTED If the number represented by String exceeds\r | |
615 | the range defined by UINT64.\r | |
616 | \r | |
617 | **/\r | |
618 | RETURN_STATUS\r | |
619 | EFIAPI\r | |
620 | StrHexToUint64S (\r | |
621 | IN CONST CHAR16 *String,\r | |
622 | OUT CHAR16 **EndPointer, OPTIONAL\r | |
623 | OUT UINT64 *Data\r | |
624 | );\r | |
625 | \r | |
c058d59f JY |
626 | /**\r |
627 | Returns the length of a Null-terminated Ascii string.\r | |
628 | \r | |
328f84b1 JY |
629 | This function is similar as strlen_s defined in C11.\r |
630 | \r | |
c058d59f JY |
631 | @param String A pointer to a Null-terminated Ascii string.\r |
632 | @param MaxSize The maximum number of Destination Ascii\r | |
633 | char, including terminating null char.\r | |
634 | \r | |
635 | @retval 0 If String is NULL.\r | |
636 | @retval MaxSize If there is no null character in the first MaxSize characters of String.\r | |
637 | @return The number of characters that percede the terminating null character.\r | |
638 | \r | |
639 | **/\r | |
640 | UINTN\r | |
641 | EFIAPI\r | |
642 | AsciiStrnLenS (\r | |
643 | IN CONST CHAR8 *String,\r | |
644 | IN UINTN MaxSize\r | |
645 | );\r | |
646 | \r | |
b590e43a HW |
647 | /**\r |
648 | Returns the size of a Null-terminated Ascii string in bytes, including the\r | |
649 | Null terminator.\r | |
650 | \r | |
651 | This function returns the size of the Null-terminated Ascii string specified\r | |
652 | by String in bytes, including the Null terminator.\r | |
653 | \r | |
654 | @param String A pointer to a Null-terminated Ascii string.\r | |
655 | @param MaxSize The maximum number of Destination Ascii\r | |
656 | char, including the Null terminator.\r | |
657 | \r | |
658 | @retval 0 If String is NULL.\r | |
659 | @retval (sizeof (CHAR8) * (MaxSize + 1))\r | |
660 | If there is no Null terminator in the first MaxSize characters of\r | |
661 | String.\r | |
662 | @return The size of the Null-terminated Ascii string in bytes, including the\r | |
663 | Null terminator.\r | |
664 | \r | |
665 | **/\r | |
666 | UINTN\r | |
667 | EFIAPI\r | |
668 | AsciiStrnSizeS (\r | |
669 | IN CONST CHAR8 *String,\r | |
670 | IN UINTN MaxSize\r | |
671 | );\r | |
672 | \r | |
c058d59f JY |
673 | /**\r |
674 | Copies the string pointed to by Source (including the terminating null char)\r | |
675 | to the array pointed to by Destination.\r | |
676 | \r | |
328f84b1 JY |
677 | This function is similar as strcpy_s defined in C11.\r |
678 | \r | |
0e93edbb JY |
679 | If an error would be returned, then the function will also ASSERT().\r |
680 | \r | |
328f84b1 JY |
681 | If an error is returned, then the Destination is unmodified.\r |
682 | \r | |
c058d59f JY |
683 | @param Destination A pointer to a Null-terminated Ascii string.\r |
684 | @param DestMax The maximum number of Destination Ascii\r | |
685 | char, including terminating null char.\r | |
686 | @param Source A pointer to a Null-terminated Ascii string.\r | |
687 | \r | |
688 | @retval RETURN_SUCCESS String is copied.\r | |
689 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).\r | |
690 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
691 | If Source is NULL.\r | |
692 | If PcdMaximumAsciiStringLength is not zero,\r | |
693 | and DestMax is greater than \r | |
694 | PcdMaximumAsciiStringLength.\r | |
695 | If DestMax is 0.\r | |
696 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
697 | **/\r | |
698 | RETURN_STATUS\r | |
699 | EFIAPI\r | |
700 | AsciiStrCpyS (\r | |
701 | OUT CHAR8 *Destination,\r | |
702 | IN UINTN DestMax,\r | |
703 | IN CONST CHAR8 *Source\r | |
704 | );\r | |
705 | \r | |
706 | /**\r | |
707 | Copies not more than Length successive char from the string pointed to by\r | |
708 | Source to the array pointed to by Destination. If no null char is copied from\r | |
709 | Source, then Destination[Length] is always set to null.\r | |
710 | \r | |
328f84b1 JY |
711 | This function is similar as strncpy_s defined in C11.\r |
712 | \r | |
0e93edbb JY |
713 | If an error would be returned, then the function will also ASSERT().\r |
714 | \r | |
328f84b1 JY |
715 | If an error is returned, then the Destination is unmodified.\r |
716 | \r | |
c058d59f JY |
717 | @param Destination A pointer to a Null-terminated Ascii string.\r |
718 | @param DestMax The maximum number of Destination Ascii\r | |
719 | char, including terminating null char.\r | |
720 | @param Source A pointer to a Null-terminated Ascii string.\r | |
721 | @param Length The maximum number of Ascii characters to copy.\r | |
722 | \r | |
723 | @retval RETURN_SUCCESS String is copied.\r | |
724 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than \r | |
725 | MIN(StrLen(Source), Length).\r | |
726 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
727 | If Source is NULL.\r | |
728 | If PcdMaximumAsciiStringLength is not zero,\r | |
729 | and DestMax is greater than \r | |
730 | PcdMaximumAsciiStringLength.\r | |
731 | If DestMax is 0.\r | |
732 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
733 | **/\r | |
734 | RETURN_STATUS\r | |
735 | EFIAPI\r | |
736 | AsciiStrnCpyS (\r | |
737 | OUT CHAR8 *Destination,\r | |
738 | IN UINTN DestMax,\r | |
739 | IN CONST CHAR8 *Source,\r | |
740 | IN UINTN Length\r | |
741 | );\r | |
742 | \r | |
743 | /**\r | |
744 | Appends a copy of the string pointed to by Source (including the terminating\r | |
745 | null char) to the end of the string pointed to by Destination.\r | |
746 | \r | |
328f84b1 JY |
747 | This function is similar as strcat_s defined in C11.\r |
748 | \r | |
0e93edbb JY |
749 | If an error would be returned, then the function will also ASSERT().\r |
750 | \r | |
328f84b1 JY |
751 | If an error is returned, then the Destination is unmodified.\r |
752 | \r | |
c058d59f JY |
753 | @param Destination A pointer to a Null-terminated Ascii string.\r |
754 | @param DestMax The maximum number of Destination Ascii\r | |
755 | char, including terminating null char.\r | |
756 | @param Source A pointer to a Null-terminated Ascii string.\r | |
757 | \r | |
758 | @retval RETURN_SUCCESS String is appended.\r | |
759 | @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than \r | |
760 | StrLen(Destination).\r | |
761 | @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT\r | |
762 | greater than StrLen(Source).\r | |
763 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
764 | If Source is NULL.\r | |
765 | If PcdMaximumAsciiStringLength is not zero,\r | |
766 | and DestMax is greater than \r | |
767 | PcdMaximumAsciiStringLength.\r | |
768 | If DestMax is 0.\r | |
769 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
770 | **/\r | |
771 | RETURN_STATUS\r | |
772 | EFIAPI\r | |
773 | AsciiStrCatS (\r | |
774 | IN OUT CHAR8 *Destination,\r | |
775 | IN UINTN DestMax,\r | |
776 | IN CONST CHAR8 *Source\r | |
777 | );\r | |
778 | \r | |
779 | /**\r | |
780 | Appends not more than Length successive char from the string pointed to by\r | |
781 | Source to the end of the string pointed to by Destination. If no null char is\r | |
782 | copied from Source, then Destination[StrLen(Destination) + Length] is always\r | |
783 | set to null.\r | |
784 | \r | |
328f84b1 JY |
785 | This function is similar as strncat_s defined in C11.\r |
786 | \r | |
0e93edbb JY |
787 | If an error would be returned, then the function will also ASSERT().\r |
788 | \r | |
328f84b1 JY |
789 | If an error is returned, then the Destination is unmodified.\r |
790 | \r | |
c058d59f JY |
791 | @param Destination A pointer to a Null-terminated Ascii string.\r |
792 | @param DestMax The maximum number of Destination Ascii\r | |
793 | char, including terminating null char.\r | |
794 | @param Source A pointer to a Null-terminated Ascii string.\r | |
795 | @param Length The maximum number of Ascii characters to copy.\r | |
796 | \r | |
797 | @retval RETURN_SUCCESS String is appended.\r | |
798 | @retval RETURN_BAD_BUFFER_SIZE If DestMax is NOT greater than\r | |
799 | StrLen(Destination).\r | |
800 | @retval RETURN_BUFFER_TOO_SMALL If (DestMax - StrLen(Destination)) is NOT\r | |
801 | greater than MIN(StrLen(Source), Length).\r | |
802 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
803 | If Source is NULL.\r | |
804 | If PcdMaximumAsciiStringLength is not zero,\r | |
805 | and DestMax is greater than \r | |
806 | PcdMaximumAsciiStringLength.\r | |
807 | If DestMax is 0.\r | |
808 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
809 | **/\r | |
810 | RETURN_STATUS\r | |
811 | EFIAPI\r | |
812 | AsciiStrnCatS (\r | |
813 | IN OUT CHAR8 *Destination,\r | |
814 | IN UINTN DestMax,\r | |
815 | IN CONST CHAR8 *Source,\r | |
816 | IN UINTN Length\r | |
817 | );\r | |
818 | \r | |
d8af3301 HW |
819 | /**\r |
820 | Convert a Null-terminated Ascii decimal string to a value of type UINTN.\r | |
821 | \r | |
822 | This function outputs a value of type UINTN by interpreting the contents of\r | |
823 | the Ascii string specified by String as a decimal number. The format of the\r | |
824 | input Ascii string String is:\r | |
825 | \r | |
826 | [spaces] [decimal digits].\r | |
827 | \r | |
828 | The valid decimal digit character is in the range [0-9]. The function will\r | |
829 | ignore the pad space, which includes spaces or tab characters, before\r | |
830 | [decimal digits]. The running zero in the beginning of [decimal digits] will\r | |
831 | be ignored. Then, the function stops at the first character that is a not a\r | |
832 | valid decimal character or a Null-terminator, whichever one comes first.\r | |
833 | \r | |
834 | If String is NULL, then ASSERT().\r | |
835 | If Data is NULL, then ASSERT().\r | |
836 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
837 | PcdMaximumAsciiStringLength Ascii characters, not including the\r | |
838 | Null-terminator, then ASSERT().\r | |
839 | \r | |
840 | If String has no valid decimal digits in the above format, then 0 is stored\r | |
841 | at the location pointed to by Data.\r | |
842 | If the number represented by String exceeds the range defined by UINTN, then\r | |
843 | MAX_UINTN is stored at the location pointed to by Data.\r | |
844 | \r | |
845 | If EndPointer is not NULL, a pointer to the character that stopped the scan\r | |
846 | is stored at the location pointed to by EndPointer. If String has no valid\r | |
847 | decimal digits right after the optional pad spaces, the value of String is\r | |
848 | stored at the location pointed to by EndPointer.\r | |
849 | \r | |
850 | @param String Pointer to a Null-terminated Ascii string.\r | |
851 | @param EndPointer Pointer to character that stops scan.\r | |
852 | @param Data Pointer to the converted value.\r | |
853 | \r | |
854 | @retval RETURN_SUCCESS Value is translated from String.\r | |
855 | @retval RETURN_INVALID_PARAMETER If String is NULL.\r | |
856 | If Data is NULL.\r | |
857 | If PcdMaximumAsciiStringLength is not zero,\r | |
858 | and String contains more than\r | |
859 | PcdMaximumAsciiStringLength Ascii\r | |
860 | characters, not including the\r | |
861 | Null-terminator.\r | |
862 | @retval RETURN_UNSUPPORTED If the number represented by String exceeds\r | |
863 | the range defined by UINTN.\r | |
864 | \r | |
865 | **/\r | |
866 | RETURN_STATUS\r | |
867 | EFIAPI\r | |
868 | AsciiStrDecimalToUintnS (\r | |
869 | IN CONST CHAR8 *String,\r | |
870 | OUT CHAR8 **EndPointer, OPTIONAL\r | |
871 | OUT UINTN *Data\r | |
872 | );\r | |
873 | \r | |
874 | /**\r | |
875 | Convert a Null-terminated Ascii decimal string to a value of type UINT64.\r | |
876 | \r | |
877 | This function outputs a value of type UINT64 by interpreting the contents of\r | |
878 | the Ascii string specified by String as a decimal number. The format of the\r | |
879 | input Ascii string String is:\r | |
880 | \r | |
881 | [spaces] [decimal digits].\r | |
882 | \r | |
883 | The valid decimal digit character is in the range [0-9]. The function will\r | |
884 | ignore the pad space, which includes spaces or tab characters, before\r | |
885 | [decimal digits]. The running zero in the beginning of [decimal digits] will\r | |
886 | be ignored. Then, the function stops at the first character that is a not a\r | |
887 | valid decimal character or a Null-terminator, whichever one comes first.\r | |
888 | \r | |
889 | If String is NULL, then ASSERT().\r | |
890 | If Data is NULL, then ASSERT().\r | |
891 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
892 | PcdMaximumAsciiStringLength Ascii characters, not including the\r | |
893 | Null-terminator, then ASSERT().\r | |
894 | \r | |
895 | If String has no valid decimal digits in the above format, then 0 is stored\r | |
896 | at the location pointed to by Data.\r | |
897 | If the number represented by String exceeds the range defined by UINT64, then\r | |
898 | MAX_UINT64 is stored at the location pointed to by Data.\r | |
899 | \r | |
900 | If EndPointer is not NULL, a pointer to the character that stopped the scan\r | |
901 | is stored at the location pointed to by EndPointer. If String has no valid\r | |
902 | decimal digits right after the optional pad spaces, the value of String is\r | |
903 | stored at the location pointed to by EndPointer.\r | |
904 | \r | |
905 | @param String Pointer to a Null-terminated Ascii string.\r | |
906 | @param EndPointer Pointer to character that stops scan.\r | |
907 | @param Data Pointer to the converted value.\r | |
908 | \r | |
909 | @retval RETURN_SUCCESS Value is translated from String.\r | |
910 | @retval RETURN_INVALID_PARAMETER If String is NULL.\r | |
911 | If Data is NULL.\r | |
912 | If PcdMaximumAsciiStringLength is not zero,\r | |
913 | and String contains more than\r | |
914 | PcdMaximumAsciiStringLength Ascii\r | |
915 | characters, not including the\r | |
916 | Null-terminator.\r | |
917 | @retval RETURN_UNSUPPORTED If the number represented by String exceeds\r | |
918 | the range defined by UINT64.\r | |
919 | \r | |
920 | **/\r | |
921 | RETURN_STATUS\r | |
922 | EFIAPI\r | |
923 | AsciiStrDecimalToUint64S (\r | |
924 | IN CONST CHAR8 *String,\r | |
925 | OUT CHAR8 **EndPointer, OPTIONAL\r | |
926 | OUT UINT64 *Data\r | |
927 | );\r | |
928 | \r | |
929 | /**\r | |
930 | Convert a Null-terminated Ascii hexadecimal string to a value of type UINTN.\r | |
931 | \r | |
932 | This function outputs a value of type UINTN by interpreting the contents of\r | |
933 | the Ascii string specified by String as a hexadecimal number. The format of\r | |
934 | the input Ascii string String is:\r | |
935 | \r | |
936 | [spaces][zeros][x][hexadecimal digits].\r | |
937 | \r | |
938 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
939 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If\r | |
940 | "x" appears in the input string, it must be prefixed with at least one 0. The\r | |
941 | function will ignore the pad space, which includes spaces or tab characters,\r | |
942 | before [zeros], [x] or [hexadecimal digits]. The running zero before [x] or\r | |
943 | [hexadecimal digits] will be ignored. Then, the decoding starts after [x] or\r | |
944 | the first valid hexadecimal digit. Then, the function stops at the first\r | |
945 | character that is a not a valid hexadecimal character or Null-terminator,\r | |
946 | whichever on comes first.\r | |
947 | \r | |
948 | If String is NULL, then ASSERT().\r | |
949 | If Data is NULL, then ASSERT().\r | |
950 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
951 | PcdMaximumAsciiStringLength Ascii characters, not including the\r | |
952 | Null-terminator, then ASSERT().\r | |
953 | \r | |
954 | If String has no valid hexadecimal digits in the above format, then 0 is\r | |
955 | stored at the location pointed to by Data.\r | |
956 | If the number represented by String exceeds the range defined by UINTN, then\r | |
957 | MAX_UINTN is stored at the location pointed to by Data.\r | |
958 | \r | |
959 | If EndPointer is not NULL, a pointer to the character that stopped the scan\r | |
960 | is stored at the location pointed to by EndPointer. If String has no valid\r | |
961 | hexadecimal digits right after the optional pad spaces, the value of String\r | |
962 | is stored at the location pointed to by EndPointer.\r | |
963 | \r | |
964 | @param String Pointer to a Null-terminated Ascii string.\r | |
965 | @param EndPointer Pointer to character that stops scan.\r | |
966 | @param Data Pointer to the converted value.\r | |
967 | \r | |
968 | @retval RETURN_SUCCESS Value is translated from String.\r | |
969 | @retval RETURN_INVALID_PARAMETER If String is NULL.\r | |
970 | If Data is NULL.\r | |
971 | If PcdMaximumAsciiStringLength is not zero,\r | |
972 | and String contains more than\r | |
973 | PcdMaximumAsciiStringLength Ascii\r | |
974 | characters, not including the\r | |
975 | Null-terminator.\r | |
976 | @retval RETURN_UNSUPPORTED If the number represented by String exceeds\r | |
977 | the range defined by UINTN.\r | |
978 | \r | |
979 | **/\r | |
980 | RETURN_STATUS\r | |
981 | EFIAPI\r | |
982 | AsciiStrHexToUintnS (\r | |
983 | IN CONST CHAR8 *String,\r | |
984 | OUT CHAR8 **EndPointer, OPTIONAL\r | |
985 | OUT UINTN *Data\r | |
986 | );\r | |
987 | \r | |
988 | /**\r | |
989 | Convert a Null-terminated Ascii hexadecimal string to a value of type UINT64.\r | |
990 | \r | |
991 | This function outputs a value of type UINT64 by interpreting the contents of\r | |
992 | the Ascii string specified by String as a hexadecimal number. The format of\r | |
993 | the input Ascii string String is:\r | |
994 | \r | |
995 | [spaces][zeros][x][hexadecimal digits].\r | |
996 | \r | |
997 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
998 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If\r | |
999 | "x" appears in the input string, it must be prefixed with at least one 0. The\r | |
1000 | function will ignore the pad space, which includes spaces or tab characters,\r | |
1001 | before [zeros], [x] or [hexadecimal digits]. The running zero before [x] or\r | |
1002 | [hexadecimal digits] will be ignored. Then, the decoding starts after [x] or\r | |
1003 | the first valid hexadecimal digit. Then, the function stops at the first\r | |
1004 | character that is a not a valid hexadecimal character or Null-terminator,\r | |
1005 | whichever on comes first.\r | |
1006 | \r | |
1007 | If String is NULL, then ASSERT().\r | |
1008 | If Data is NULL, then ASSERT().\r | |
1009 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
1010 | PcdMaximumAsciiStringLength Ascii characters, not including the\r | |
1011 | Null-terminator, then ASSERT().\r | |
1012 | \r | |
1013 | If String has no valid hexadecimal digits in the above format, then 0 is\r | |
1014 | stored at the location pointed to by Data.\r | |
1015 | If the number represented by String exceeds the range defined by UINT64, then\r | |
1016 | MAX_UINT64 is stored at the location pointed to by Data.\r | |
1017 | \r | |
1018 | If EndPointer is not NULL, a pointer to the character that stopped the scan\r | |
1019 | is stored at the location pointed to by EndPointer. If String has no valid\r | |
1020 | hexadecimal digits right after the optional pad spaces, the value of String\r | |
1021 | is stored at the location pointed to by EndPointer.\r | |
1022 | \r | |
1023 | @param String Pointer to a Null-terminated Ascii string.\r | |
1024 | @param EndPointer Pointer to character that stops scan.\r | |
1025 | @param Data Pointer to the converted value.\r | |
1026 | \r | |
1027 | @retval RETURN_SUCCESS Value is translated from String.\r | |
1028 | @retval RETURN_INVALID_PARAMETER If String is NULL.\r | |
1029 | If Data is NULL.\r | |
1030 | If PcdMaximumAsciiStringLength is not zero,\r | |
1031 | and String contains more than\r | |
1032 | PcdMaximumAsciiStringLength Ascii\r | |
1033 | characters, not including the\r | |
1034 | Null-terminator.\r | |
1035 | @retval RETURN_UNSUPPORTED If the number represented by String exceeds\r | |
1036 | the range defined by UINT64.\r | |
1037 | \r | |
1038 | **/\r | |
1039 | RETURN_STATUS\r | |
1040 | EFIAPI\r | |
1041 | AsciiStrHexToUint64S (\r | |
1042 | IN CONST CHAR8 *String,\r | |
1043 | OUT CHAR8 **EndPointer, OPTIONAL\r | |
1044 | OUT UINT64 *Data\r | |
1045 | );\r | |
1046 | \r | |
c058d59f | 1047 | \r |
1bb390f1 ED |
1048 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
1049 | \r | |
ac644614 | 1050 | /**\r |
ae591c14 | 1051 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1052 | \r |
ac644614 | 1053 | Copies one Null-terminated Unicode string to another Null-terminated Unicode\r |
1054 | string and returns the new Unicode string.\r | |
1055 | \r | |
1056 | This function copies the contents of the Unicode string Source to the Unicode\r | |
1057 | string Destination, and returns Destination. If Source and Destination\r | |
1058 | overlap, then the results are undefined.\r | |
1059 | \r | |
1060 | If Destination is NULL, then ASSERT().\r | |
1061 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
1062 | If Source is NULL, then ASSERT().\r | |
1063 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
1064 | If Source and Destination overlap, then ASSERT().\r | |
1065 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
1066 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
1067 | Null-terminator, then ASSERT().\r | |
1068 | \r | |
af2dc6a7 | 1069 | @param Destination The pointer to a Null-terminated Unicode string.\r |
1070 | @param Source The pointer to a Null-terminated Unicode string.\r | |
ac644614 | 1071 | \r |
9aa049d9 | 1072 | @return Destination.\r |
ac644614 | 1073 | \r |
1074 | **/\r | |
1075 | CHAR16 *\r | |
1076 | EFIAPI\r | |
1077 | StrCpy (\r | |
1078 | OUT CHAR16 *Destination,\r | |
1079 | IN CONST CHAR16 *Source\r | |
1080 | );\r | |
1081 | \r | |
1082 | \r | |
1083 | /**\r | |
ae591c14 | 1084 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1085 | \r |
af2dc6a7 | 1086 | Copies up to a specified length from one Null-terminated Unicode string to \r |
17f695ed | 1087 | another Null-terminated Unicode string and returns the new Unicode string.\r |
ac644614 | 1088 | \r |
1089 | This function copies the contents of the Unicode string Source to the Unicode\r | |
1090 | string Destination, and returns Destination. At most, Length Unicode\r | |
1091 | characters are copied from Source to Destination. If Length is 0, then\r | |
1092 | Destination is returned unmodified. If Length is greater that the number of\r | |
1093 | Unicode characters in Source, then Destination is padded with Null Unicode\r | |
1094 | characters. If Source and Destination overlap, then the results are\r | |
1095 | undefined.\r | |
1096 | \r | |
1097 | If Length > 0 and Destination is NULL, then ASSERT().\r | |
1098 | If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
1099 | If Length > 0 and Source is NULL, then ASSERT().\r | |
77f863ee | 1100 | If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 1101 | If Source and Destination overlap, then ASSERT().\r |
50c247fd | 1102 | If PcdMaximumUnicodeStringLength is not zero, and Length is greater than \r |
1103 | PcdMaximumUnicodeStringLength, then ASSERT().\r | |
ac644614 | 1104 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r |
50c247fd | 1105 | PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,\r |
1106 | then ASSERT().\r | |
ac644614 | 1107 | \r |
af2dc6a7 | 1108 | @param Destination The pointer to a Null-terminated Unicode string.\r |
1109 | @param Source The pointer to a Null-terminated Unicode string.\r | |
1110 | @param Length The maximum number of Unicode characters to copy.\r | |
ac644614 | 1111 | \r |
9aa049d9 | 1112 | @return Destination.\r |
ac644614 | 1113 | \r |
1114 | **/\r | |
1115 | CHAR16 *\r | |
1116 | EFIAPI\r | |
1117 | StrnCpy (\r | |
1118 | OUT CHAR16 *Destination,\r | |
1119 | IN CONST CHAR16 *Source,\r | |
1120 | IN UINTN Length\r | |
1121 | );\r | |
1bb390f1 | 1122 | #endif\r |
ac644614 | 1123 | \r |
1124 | /**\r | |
1125 | Returns the length of a Null-terminated Unicode string.\r | |
1126 | \r | |
1127 | This function returns the number of Unicode characters in the Null-terminated\r | |
1128 | Unicode string specified by String.\r | |
1129 | \r | |
1130 | If String is NULL, then ASSERT().\r | |
1131 | If String is not aligned on a 16-bit boundary, then ASSERT().\r | |
1132 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
1133 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
1134 | Null-terminator, then ASSERT().\r | |
1135 | \r | |
1136 | @param String Pointer to a Null-terminated Unicode string.\r | |
1137 | \r | |
1138 | @return The length of String.\r | |
1139 | \r | |
1140 | **/\r | |
1141 | UINTN\r | |
1142 | EFIAPI\r | |
1143 | StrLen (\r | |
1144 | IN CONST CHAR16 *String\r | |
1145 | );\r | |
1146 | \r | |
1147 | \r | |
1148 | /**\r | |
1149 | Returns the size of a Null-terminated Unicode string in bytes, including the\r | |
1150 | Null terminator.\r | |
1151 | \r | |
17f695ed | 1152 | This function returns the size, in bytes, of the Null-terminated Unicode string \r |
1153 | specified by String.\r | |
ac644614 | 1154 | \r |
1155 | If String is NULL, then ASSERT().\r | |
1156 | If String is not aligned on a 16-bit boundary, then ASSERT().\r | |
1157 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
1158 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
1159 | Null-terminator, then ASSERT().\r | |
1160 | \r | |
af2dc6a7 | 1161 | @param String The pointer to a Null-terminated Unicode string.\r |
ac644614 | 1162 | \r |
1163 | @return The size of String.\r | |
1164 | \r | |
1165 | **/\r | |
1166 | UINTN\r | |
1167 | EFIAPI\r | |
1168 | StrSize (\r | |
1169 | IN CONST CHAR16 *String\r | |
1170 | );\r | |
1171 | \r | |
1172 | \r | |
1173 | /**\r | |
1174 | Compares two Null-terminated Unicode strings, and returns the difference\r | |
1175 | between the first mismatched Unicode characters.\r | |
1176 | \r | |
1177 | This function compares the Null-terminated Unicode string FirstString to the\r | |
1178 | Null-terminated Unicode string SecondString. If FirstString is identical to\r | |
1179 | SecondString, then 0 is returned. Otherwise, the value returned is the first\r | |
1180 | mismatched Unicode character in SecondString subtracted from the first\r | |
1181 | mismatched Unicode character in FirstString.\r | |
1182 | \r | |
1183 | If FirstString is NULL, then ASSERT().\r | |
1184 | If FirstString is not aligned on a 16-bit boundary, then ASSERT().\r | |
1185 | If SecondString is NULL, then ASSERT().\r | |
1186 | If SecondString is not aligned on a 16-bit boundary, then ASSERT().\r | |
1187 | If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more\r | |
1188 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
1189 | Null-terminator, then ASSERT().\r | |
1190 | If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more\r | |
af2dc6a7 | 1191 | than PcdMaximumUnicodeStringLength Unicode characters, not including the\r |
ac644614 | 1192 | Null-terminator, then ASSERT().\r |
1193 | \r | |
af2dc6a7 | 1194 | @param FirstString The pointer to a Null-terminated Unicode string.\r |
1195 | @param SecondString The pointer to a Null-terminated Unicode string.\r | |
ac644614 | 1196 | \r |
1106ffe1 | 1197 | @retval 0 FirstString is identical to SecondString.\r |
1198 | @return others FirstString is not identical to SecondString.\r | |
ac644614 | 1199 | \r |
1200 | **/\r | |
1201 | INTN\r | |
1202 | EFIAPI\r | |
1203 | StrCmp (\r | |
1204 | IN CONST CHAR16 *FirstString,\r | |
1205 | IN CONST CHAR16 *SecondString\r | |
1206 | );\r | |
1207 | \r | |
1208 | \r | |
1209 | /**\r | |
17f695ed | 1210 | Compares up to a specified length the contents of two Null-terminated Unicode strings,\r |
1211 | and returns the difference between the first mismatched Unicode characters.\r | |
1212 | \r | |
ac644614 | 1213 | This function compares the Null-terminated Unicode string FirstString to the\r |
1214 | Null-terminated Unicode string SecondString. At most, Length Unicode\r | |
1215 | characters will be compared. If Length is 0, then 0 is returned. If\r | |
1216 | FirstString is identical to SecondString, then 0 is returned. Otherwise, the\r | |
1217 | value returned is the first mismatched Unicode character in SecondString\r | |
1218 | subtracted from the first mismatched Unicode character in FirstString.\r | |
1219 | \r | |
1220 | If Length > 0 and FirstString is NULL, then ASSERT().\r | |
77f863ee | 1221 | If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 1222 | If Length > 0 and SecondString is NULL, then ASSERT().\r |
77f863ee | 1223 | If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT().\r |
50c247fd | 1224 | If PcdMaximumUnicodeStringLength is not zero, and Length is greater than\r |
1225 | PcdMaximumUnicodeStringLength, then ASSERT().\r | |
1226 | If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more than\r | |
1227 | PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,\r | |
1228 | then ASSERT().\r | |
1229 | If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more than\r | |
1230 | PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator,\r | |
1231 | then ASSERT().\r | |
ac644614 | 1232 | \r |
af2dc6a7 | 1233 | @param FirstString The pointer to a Null-terminated Unicode string.\r |
1234 | @param SecondString The pointer to a Null-terminated Unicode string.\r | |
1235 | @param Length The maximum number of Unicode characters to compare.\r | |
ac644614 | 1236 | \r |
1106ffe1 | 1237 | @retval 0 FirstString is identical to SecondString.\r |
1238 | @return others FirstString is not identical to SecondString.\r | |
ac644614 | 1239 | \r |
1240 | **/\r | |
1241 | INTN\r | |
1242 | EFIAPI\r | |
1243 | StrnCmp (\r | |
1244 | IN CONST CHAR16 *FirstString,\r | |
1245 | IN CONST CHAR16 *SecondString,\r | |
1246 | IN UINTN Length\r | |
1247 | );\r | |
1248 | \r | |
1249 | \r | |
1bb390f1 ED |
1250 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
1251 | \r | |
ac644614 | 1252 | /**\r |
ae591c14 | 1253 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1254 | \r |
ac644614 | 1255 | Concatenates one Null-terminated Unicode string to another Null-terminated\r |
1256 | Unicode string, and returns the concatenated Unicode string.\r | |
1257 | \r | |
1258 | This function concatenates two Null-terminated Unicode strings. The contents\r | |
1259 | of Null-terminated Unicode string Source are concatenated to the end of\r | |
1260 | Null-terminated Unicode string Destination. The Null-terminated concatenated\r | |
1261 | Unicode String is returned. If Source and Destination overlap, then the\r | |
1262 | results are undefined.\r | |
1263 | \r | |
1264 | If Destination is NULL, then ASSERT().\r | |
77f863ee | 1265 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 1266 | If Source is NULL, then ASSERT().\r |
77f863ee | 1267 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 1268 | If Source and Destination overlap, then ASSERT().\r |
1269 | If PcdMaximumUnicodeStringLength is not zero, and Destination contains more\r | |
af2dc6a7 | 1270 | than PcdMaximumUnicodeStringLength Unicode characters, not including the\r |
ac644614 | 1271 | Null-terminator, then ASSERT().\r |
1272 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
af2dc6a7 | 1273 | PcdMaximumUnicodeStringLength Unicode characters, not including the\r |
ac644614 | 1274 | Null-terminator, then ASSERT().\r |
1275 | If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination\r | |
1276 | and Source results in a Unicode string with more than\r | |
af2dc6a7 | 1277 | PcdMaximumUnicodeStringLength Unicode characters, not including the\r |
ac644614 | 1278 | Null-terminator, then ASSERT().\r |
1279 | \r | |
af2dc6a7 | 1280 | @param Destination The pointer to a Null-terminated Unicode string.\r |
1281 | @param Source The pointer to a Null-terminated Unicode string.\r | |
ac644614 | 1282 | \r |
9aa049d9 | 1283 | @return Destination.\r |
ac644614 | 1284 | \r |
1285 | **/\r | |
1286 | CHAR16 *\r | |
1287 | EFIAPI\r | |
1288 | StrCat (\r | |
1289 | IN OUT CHAR16 *Destination,\r | |
1290 | IN CONST CHAR16 *Source\r | |
1291 | );\r | |
1292 | \r | |
1293 | \r | |
1294 | /**\r | |
ae591c14 | 1295 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1296 | \r |
17f695ed | 1297 | Concatenates up to a specified length one Null-terminated Unicode to the end \r |
1298 | of another Null-terminated Unicode string, and returns the concatenated \r | |
ac644614 | 1299 | Unicode string.\r |
1300 | \r | |
1301 | This function concatenates two Null-terminated Unicode strings. The contents\r | |
1302 | of Null-terminated Unicode string Source are concatenated to the end of\r | |
1303 | Null-terminated Unicode string Destination, and Destination is returned. At\r | |
1304 | most, Length Unicode characters are concatenated from Source to the end of\r | |
1305 | Destination, and Destination is always Null-terminated. If Length is 0, then\r | |
1306 | Destination is returned unmodified. If Source and Destination overlap, then\r | |
1307 | the results are undefined.\r | |
1308 | \r | |
1309 | If Destination is NULL, then ASSERT().\r | |
1310 | If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
1311 | If Length > 0 and Source is NULL, then ASSERT().\r | |
1312 | If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
1313 | If Source and Destination overlap, then ASSERT().\r | |
50c247fd | 1314 | If PcdMaximumUnicodeStringLength is not zero, and Length is greater than \r |
1315 | PcdMaximumUnicodeStringLength, then ASSERT().\r | |
ac644614 | 1316 | If PcdMaximumUnicodeStringLength is not zero, and Destination contains more\r |
50c247fd | 1317 | than PcdMaximumUnicodeStringLength Unicode characters, not including the\r |
ac644614 | 1318 | Null-terminator, then ASSERT().\r |
1319 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
50c247fd | 1320 | PcdMaximumUnicodeStringLength Unicode characters, not including the\r |
ac644614 | 1321 | Null-terminator, then ASSERT().\r |
1322 | If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination\r | |
50c247fd | 1323 | and Source results in a Unicode string with more than PcdMaximumUnicodeStringLength\r |
1324 | Unicode characters, not including the Null-terminator, then ASSERT().\r | |
ac644614 | 1325 | \r |
af2dc6a7 | 1326 | @param Destination The pointer to a Null-terminated Unicode string.\r |
1327 | @param Source The pointer to a Null-terminated Unicode string.\r | |
1328 | @param Length The maximum number of Unicode characters to concatenate from\r | |
ac644614 | 1329 | Source.\r |
1330 | \r | |
9aa049d9 | 1331 | @return Destination.\r |
ac644614 | 1332 | \r |
1333 | **/\r | |
1334 | CHAR16 *\r | |
1335 | EFIAPI\r | |
1336 | StrnCat (\r | |
1337 | IN OUT CHAR16 *Destination,\r | |
1338 | IN CONST CHAR16 *Source,\r | |
1339 | IN UINTN Length\r | |
1340 | );\r | |
1bb390f1 | 1341 | #endif\r |
ac644614 | 1342 | \r |
1343 | /**\r | |
9aa049d9 | 1344 | Returns the first occurrence of a Null-terminated Unicode sub-string\r |
ac644614 | 1345 | in a Null-terminated Unicode string.\r |
1346 | \r | |
1347 | This function scans the contents of the Null-terminated Unicode string\r | |
1348 | specified by String and returns the first occurrence of SearchString.\r | |
1349 | If SearchString is not found in String, then NULL is returned. If\r | |
af2dc6a7 | 1350 | the length of SearchString is zero, then String is returned.\r |
ac644614 | 1351 | \r |
1352 | If String is NULL, then ASSERT().\r | |
1353 | If String is not aligned on a 16-bit boundary, then ASSERT().\r | |
1354 | If SearchString is NULL, then ASSERT().\r | |
1355 | If SearchString is not aligned on a 16-bit boundary, then ASSERT().\r | |
1356 | \r | |
1357 | If PcdMaximumUnicodeStringLength is not zero, and SearchString\r | |
1358 | or String contains more than PcdMaximumUnicodeStringLength Unicode\r | |
af2dc6a7 | 1359 | characters, not including the Null-terminator, then ASSERT().\r |
ac644614 | 1360 | \r |
af2dc6a7 | 1361 | @param String The pointer to a Null-terminated Unicode string.\r |
1362 | @param SearchString The pointer to a Null-terminated Unicode string to search for.\r | |
ac644614 | 1363 | \r |
1364 | @retval NULL If the SearchString does not appear in String.\r | |
1106ffe1 | 1365 | @return others If there is a match.\r |
ac644614 | 1366 | \r |
1367 | **/\r | |
1368 | CHAR16 *\r | |
1369 | EFIAPI\r | |
1370 | StrStr (\r | |
17f695ed | 1371 | IN CONST CHAR16 *String,\r |
1372 | IN CONST CHAR16 *SearchString\r | |
ac644614 | 1373 | );\r |
1374 | \r | |
1375 | /**\r | |
1376 | Convert a Null-terminated Unicode decimal string to a value of\r | |
1377 | type UINTN.\r | |
1378 | \r | |
1379 | This function returns a value of type UINTN by interpreting the contents\r | |
1380 | of the Unicode string specified by String as a decimal number. The format\r | |
1381 | of the input Unicode string String is:\r | |
1382 | \r | |
1383 | [spaces] [decimal digits].\r | |
1384 | \r | |
1385 | The valid decimal digit character is in the range [0-9]. The\r | |
1386 | function will ignore the pad space, which includes spaces or\r | |
1387 | tab characters, before [decimal digits]. The running zero in the\r | |
1388 | beginning of [decimal digits] will be ignored. Then, the function\r | |
1389 | stops at the first character that is a not a valid decimal character\r | |
1390 | or a Null-terminator, whichever one comes first.\r | |
1391 | \r | |
1392 | If String is NULL, then ASSERT().\r | |
1393 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
1394 | If String has only pad spaces, then 0 is returned.\r | |
1395 | If String has no pad spaces or valid decimal digits,\r | |
1396 | then 0 is returned.\r | |
1397 | If the number represented by String overflows according\r | |
1398 | to the range defined by UINTN, then ASSERT().\r | |
1399 | \r | |
1400 | If PcdMaximumUnicodeStringLength is not zero, and String contains\r | |
1401 | more than PcdMaximumUnicodeStringLength Unicode characters not including\r | |
1402 | the Null-terminator, then ASSERT().\r | |
1403 | \r | |
af2dc6a7 | 1404 | @param String The pointer to a Null-terminated Unicode string.\r |
ac644614 | 1405 | \r |
38bbd3d9 | 1406 | @retval Value translated from String.\r |
ac644614 | 1407 | \r |
1408 | **/\r | |
1409 | UINTN\r | |
1410 | EFIAPI\r | |
1411 | StrDecimalToUintn (\r | |
17f695ed | 1412 | IN CONST CHAR16 *String\r |
ac644614 | 1413 | );\r |
1414 | \r | |
1415 | /**\r | |
1416 | Convert a Null-terminated Unicode decimal string to a value of\r | |
1417 | type UINT64.\r | |
1418 | \r | |
1419 | This function returns a value of type UINT64 by interpreting the contents\r | |
1420 | of the Unicode string specified by String as a decimal number. The format\r | |
1421 | of the input Unicode string String is:\r | |
1422 | \r | |
1423 | [spaces] [decimal digits].\r | |
1424 | \r | |
1425 | The valid decimal digit character is in the range [0-9]. The\r | |
1426 | function will ignore the pad space, which includes spaces or\r | |
1427 | tab characters, before [decimal digits]. The running zero in the\r | |
1428 | beginning of [decimal digits] will be ignored. Then, the function\r | |
1429 | stops at the first character that is a not a valid decimal character\r | |
1430 | or a Null-terminator, whichever one comes first.\r | |
1431 | \r | |
1432 | If String is NULL, then ASSERT().\r | |
1433 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
1434 | If String has only pad spaces, then 0 is returned.\r | |
1435 | If String has no pad spaces or valid decimal digits,\r | |
1436 | then 0 is returned.\r | |
1437 | If the number represented by String overflows according\r | |
1438 | to the range defined by UINT64, then ASSERT().\r | |
1439 | \r | |
1440 | If PcdMaximumUnicodeStringLength is not zero, and String contains\r | |
1441 | more than PcdMaximumUnicodeStringLength Unicode characters not including\r | |
1442 | the Null-terminator, then ASSERT().\r | |
1443 | \r | |
af2dc6a7 | 1444 | @param String The pointer to a Null-terminated Unicode string.\r |
ac644614 | 1445 | \r |
38bbd3d9 | 1446 | @retval Value translated from String.\r |
ac644614 | 1447 | \r |
1448 | **/\r | |
1449 | UINT64\r | |
1450 | EFIAPI\r | |
1451 | StrDecimalToUint64 (\r | |
17f695ed | 1452 | IN CONST CHAR16 *String\r |
ac644614 | 1453 | );\r |
1454 | \r | |
1455 | \r | |
1456 | /**\r | |
1457 | Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.\r | |
1458 | \r | |
1459 | This function returns a value of type UINTN by interpreting the contents\r | |
1460 | of the Unicode string specified by String as a hexadecimal number.\r | |
1461 | The format of the input Unicode string String is:\r | |
1462 | \r | |
1463 | [spaces][zeros][x][hexadecimal digits].\r | |
1464 | \r | |
1465 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
1466 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.\r | |
1467 | If "x" appears in the input string, it must be prefixed with at least one 0.\r | |
1468 | The function will ignore the pad space, which includes spaces or tab characters,\r | |
1469 | before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or\r | |
1470 | [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the\r | |
af2dc6a7 | 1471 | first valid hexadecimal digit. Then, the function stops at the first character \r |
1472 | that is a not a valid hexadecimal character or NULL, whichever one comes first.\r | |
ac644614 | 1473 | \r |
1474 | If String is NULL, then ASSERT().\r | |
1475 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
1476 | If String has only pad spaces, then zero is returned.\r | |
1477 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits,\r | |
1478 | then zero is returned.\r | |
1479 | If the number represented by String overflows according to the range defined by\r | |
1480 | UINTN, then ASSERT().\r | |
1481 | \r | |
1482 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
1483 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,\r | |
1484 | then ASSERT().\r | |
1485 | \r | |
af2dc6a7 | 1486 | @param String The pointer to a Null-terminated Unicode string.\r |
ac644614 | 1487 | \r |
38bbd3d9 | 1488 | @retval Value translated from String.\r |
ac644614 | 1489 | \r |
1490 | **/\r | |
1491 | UINTN\r | |
1492 | EFIAPI\r | |
1493 | StrHexToUintn (\r | |
17f695ed | 1494 | IN CONST CHAR16 *String\r |
ac644614 | 1495 | );\r |
1496 | \r | |
1497 | \r | |
1498 | /**\r | |
1499 | Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.\r | |
1500 | \r | |
1501 | This function returns a value of type UINT64 by interpreting the contents\r | |
1502 | of the Unicode string specified by String as a hexadecimal number.\r | |
1503 | The format of the input Unicode string String is\r | |
1504 | \r | |
1505 | [spaces][zeros][x][hexadecimal digits].\r | |
1506 | \r | |
1507 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
1508 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.\r | |
1509 | If "x" appears in the input string, it must be prefixed with at least one 0.\r | |
1510 | The function will ignore the pad space, which includes spaces or tab characters,\r | |
1511 | before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or\r | |
1512 | [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the\r | |
1513 | first valid hexadecimal digit. Then, the function stops at the first character that is\r | |
1514 | a not a valid hexadecimal character or NULL, whichever one comes first.\r | |
1515 | \r | |
1516 | If String is NULL, then ASSERT().\r | |
1517 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
1518 | If String has only pad spaces, then zero is returned.\r | |
1519 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits,\r | |
1520 | then zero is returned.\r | |
1521 | If the number represented by String overflows according to the range defined by\r | |
1522 | UINT64, then ASSERT().\r | |
1523 | \r | |
1524 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
1525 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,\r | |
1526 | then ASSERT().\r | |
1527 | \r | |
af2dc6a7 | 1528 | @param String The pointer to a Null-terminated Unicode string.\r |
ac644614 | 1529 | \r |
38bbd3d9 | 1530 | @retval Value translated from String.\r |
ac644614 | 1531 | \r |
1532 | **/\r | |
1533 | UINT64\r | |
1534 | EFIAPI\r | |
1535 | StrHexToUint64 (\r | |
17f695ed | 1536 | IN CONST CHAR16 *String\r |
ac644614 | 1537 | );\r |
1538 | \r | |
415aa2f1 SZ |
1539 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
1540 | \r | |
ac644614 | 1541 | /**\r |
415aa2f1 SZ |
1542 | [ATTENTION] This function is deprecated for security reason.\r |
1543 | \r | |
17f695ed | 1544 | Convert a Null-terminated Unicode string to a Null-terminated\r |
ac644614 | 1545 | ASCII string and returns the ASCII string.\r |
1546 | \r | |
1547 | This function converts the content of the Unicode string Source\r | |
1548 | to the ASCII string Destination by copying the lower 8 bits of\r | |
1549 | each Unicode character. It returns Destination.\r | |
1550 | \r | |
d3e0289c | 1551 | The caller is responsible to make sure Destination points to a buffer with size\r |
1552 | equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.\r | |
1553 | \r | |
ac644614 | 1554 | If any Unicode characters in Source contain non-zero value in\r |
1555 | the upper 8 bits, then ASSERT().\r | |
1556 | \r | |
1557 | If Destination is NULL, then ASSERT().\r | |
1558 | If Source is NULL, then ASSERT().\r | |
1559 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
1560 | If Source and Destination overlap, then ASSERT().\r | |
1561 | \r | |
1562 | If PcdMaximumUnicodeStringLength is not zero, and Source contains\r | |
1563 | more than PcdMaximumUnicodeStringLength Unicode characters not including\r | |
1564 | the Null-terminator, then ASSERT().\r | |
1565 | \r | |
1566 | If PcdMaximumAsciiStringLength is not zero, and Source contains more\r | |
1567 | than PcdMaximumAsciiStringLength Unicode characters not including the\r | |
1568 | Null-terminator, then ASSERT().\r | |
1569 | \r | |
af2dc6a7 | 1570 | @param Source The pointer to a Null-terminated Unicode string.\r |
1571 | @param Destination The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1572 | \r |
9aa049d9 | 1573 | @return Destination.\r |
ac644614 | 1574 | \r |
1575 | **/\r | |
1576 | CHAR8 *\r | |
1577 | EFIAPI\r | |
1578 | UnicodeStrToAsciiStr (\r | |
17f695ed | 1579 | IN CONST CHAR16 *Source,\r |
1580 | OUT CHAR8 *Destination\r | |
ac644614 | 1581 | );\r |
1582 | \r | |
415aa2f1 SZ |
1583 | #endif\r |
1584 | \r | |
3ab41b7a JY |
1585 | /**\r |
1586 | Convert a Null-terminated Unicode string to a Null-terminated\r | |
1587 | ASCII string.\r | |
1588 | \r | |
1589 | This function is similar to AsciiStrCpyS.\r | |
1590 | \r | |
1591 | This function converts the content of the Unicode string Source\r | |
1592 | to the ASCII string Destination by copying the lower 8 bits of\r | |
1593 | each Unicode character. The function terminates the ASCII string\r | |
1594 | Destination by appending a Null-terminator character at the end.\r | |
1595 | \r | |
1596 | The caller is responsible to make sure Destination points to a buffer with size\r | |
1597 | equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.\r | |
1598 | \r | |
1599 | If any Unicode characters in Source contain non-zero value in\r | |
1600 | the upper 8 bits, then ASSERT().\r | |
1601 | \r | |
1602 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
1603 | If an error would be returned, then the function will also ASSERT().\r | |
1604 | \r | |
1605 | If an error is returned, then the Destination is unmodified.\r | |
1606 | \r | |
1607 | @param Source The pointer to a Null-terminated Unicode string.\r | |
1608 | @param Destination The pointer to a Null-terminated ASCII string.\r | |
1609 | @param DestMax The maximum number of Destination Ascii\r | |
1610 | char, including terminating null char.\r | |
1611 | \r | |
1612 | @retval RETURN_SUCCESS String is converted.\r | |
1613 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).\r | |
1614 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
1615 | If Source is NULL.\r | |
1616 | If PcdMaximumAsciiStringLength is not zero,\r | |
1617 | and DestMax is greater than\r | |
1618 | PcdMaximumAsciiStringLength.\r | |
1619 | If PcdMaximumUnicodeStringLength is not zero,\r | |
1620 | and DestMax is greater than\r | |
1621 | PcdMaximumUnicodeStringLength.\r | |
1622 | If DestMax is 0.\r | |
1623 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
1624 | \r | |
1625 | **/\r | |
1626 | RETURN_STATUS\r | |
1627 | EFIAPI\r | |
1628 | UnicodeStrToAsciiStrS (\r | |
1629 | IN CONST CHAR16 *Source,\r | |
1630 | OUT CHAR8 *Destination,\r | |
1631 | IN UINTN DestMax\r | |
1632 | );\r | |
ac644614 | 1633 | \r |
1bb390f1 ED |
1634 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
1635 | \r | |
ac644614 | 1636 | /**\r |
ae591c14 | 1637 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1638 | \r |
ac644614 | 1639 | Copies one Null-terminated ASCII string to another Null-terminated ASCII\r |
1640 | string and returns the new ASCII string.\r | |
1641 | \r | |
1642 | This function copies the contents of the ASCII string Source to the ASCII\r | |
1643 | string Destination, and returns Destination. If Source and Destination\r | |
1644 | overlap, then the results are undefined.\r | |
1645 | \r | |
1646 | If Destination is NULL, then ASSERT().\r | |
1647 | If Source is NULL, then ASSERT().\r | |
1648 | If Source and Destination overlap, then ASSERT().\r | |
1649 | If PcdMaximumAsciiStringLength is not zero and Source contains more than\r | |
1650 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1651 | then ASSERT().\r | |
1652 | \r | |
af2dc6a7 | 1653 | @param Destination The pointer to a Null-terminated ASCII string.\r |
1654 | @param Source The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1655 | \r |
1656 | @return Destination\r | |
1657 | \r | |
1658 | **/\r | |
1659 | CHAR8 *\r | |
1660 | EFIAPI\r | |
1661 | AsciiStrCpy (\r | |
1662 | OUT CHAR8 *Destination,\r | |
1663 | IN CONST CHAR8 *Source\r | |
1664 | );\r | |
1665 | \r | |
1666 | \r | |
1667 | /**\r | |
ae591c14 | 1668 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1669 | \r |
17f695ed | 1670 | Copies up to a specified length one Null-terminated ASCII string to another \r |
1671 | Null-terminated ASCII string and returns the new ASCII string.\r | |
ac644614 | 1672 | \r |
1673 | This function copies the contents of the ASCII string Source to the ASCII\r | |
1674 | string Destination, and returns Destination. At most, Length ASCII characters\r | |
1675 | are copied from Source to Destination. If Length is 0, then Destination is\r | |
1676 | returned unmodified. If Length is greater that the number of ASCII characters\r | |
1677 | in Source, then Destination is padded with Null ASCII characters. If Source\r | |
1678 | and Destination overlap, then the results are undefined.\r | |
1679 | \r | |
1680 | If Destination is NULL, then ASSERT().\r | |
1681 | If Source is NULL, then ASSERT().\r | |
1682 | If Source and Destination overlap, then ASSERT().\r | |
50c247fd | 1683 | If PcdMaximumAsciiStringLength is not zero, and Length is greater than \r |
1684 | PcdMaximumAsciiStringLength, then ASSERT().\r | |
ac644614 | 1685 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r |
50c247fd | 1686 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r |
ac644614 | 1687 | then ASSERT().\r |
1688 | \r | |
af2dc6a7 | 1689 | @param Destination The pointer to a Null-terminated ASCII string.\r |
1690 | @param Source The pointer to a Null-terminated ASCII string.\r | |
1691 | @param Length The maximum number of ASCII characters to copy.\r | |
ac644614 | 1692 | \r |
1693 | @return Destination\r | |
1694 | \r | |
1695 | **/\r | |
1696 | CHAR8 *\r | |
1697 | EFIAPI\r | |
1698 | AsciiStrnCpy (\r | |
1699 | OUT CHAR8 *Destination,\r | |
1700 | IN CONST CHAR8 *Source,\r | |
1701 | IN UINTN Length\r | |
1702 | );\r | |
1bb390f1 | 1703 | #endif\r |
ac644614 | 1704 | \r |
1705 | /**\r | |
1706 | Returns the length of a Null-terminated ASCII string.\r | |
1707 | \r | |
1708 | This function returns the number of ASCII characters in the Null-terminated\r | |
1709 | ASCII string specified by String.\r | |
1710 | \r | |
1711 | If Length > 0 and Destination is NULL, then ASSERT().\r | |
1712 | If Length > 0 and Source is NULL, then ASSERT().\r | |
1713 | If PcdMaximumAsciiStringLength is not zero and String contains more than\r | |
1714 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1715 | then ASSERT().\r | |
1716 | \r | |
af2dc6a7 | 1717 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 1718 | \r |
1719 | @return The length of String.\r | |
1720 | \r | |
1721 | **/\r | |
1722 | UINTN\r | |
1723 | EFIAPI\r | |
1724 | AsciiStrLen (\r | |
1725 | IN CONST CHAR8 *String\r | |
1726 | );\r | |
1727 | \r | |
1728 | \r | |
1729 | /**\r | |
1730 | Returns the size of a Null-terminated ASCII string in bytes, including the\r | |
1731 | Null terminator.\r | |
1732 | \r | |
1733 | This function returns the size, in bytes, of the Null-terminated ASCII string\r | |
1734 | specified by String.\r | |
1735 | \r | |
1736 | If String is NULL, then ASSERT().\r | |
1737 | If PcdMaximumAsciiStringLength is not zero and String contains more than\r | |
1738 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1739 | then ASSERT().\r | |
1740 | \r | |
af2dc6a7 | 1741 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 1742 | \r |
1743 | @return The size of String.\r | |
1744 | \r | |
1745 | **/\r | |
1746 | UINTN\r | |
1747 | EFIAPI\r | |
1748 | AsciiStrSize (\r | |
1749 | IN CONST CHAR8 *String\r | |
1750 | );\r | |
1751 | \r | |
1752 | \r | |
1753 | /**\r | |
1754 | Compares two Null-terminated ASCII strings, and returns the difference\r | |
1755 | between the first mismatched ASCII characters.\r | |
1756 | \r | |
1757 | This function compares the Null-terminated ASCII string FirstString to the\r | |
1758 | Null-terminated ASCII string SecondString. If FirstString is identical to\r | |
1759 | SecondString, then 0 is returned. Otherwise, the value returned is the first\r | |
1760 | mismatched ASCII character in SecondString subtracted from the first\r | |
1761 | mismatched ASCII character in FirstString.\r | |
1762 | \r | |
1763 | If FirstString is NULL, then ASSERT().\r | |
1764 | If SecondString is NULL, then ASSERT().\r | |
1765 | If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r | |
1766 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1767 | then ASSERT().\r | |
1768 | If PcdMaximumAsciiStringLength is not zero and SecondString contains more\r | |
1769 | than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
1770 | Null-terminator, then ASSERT().\r | |
1771 | \r | |
af2dc6a7 | 1772 | @param FirstString The pointer to a Null-terminated ASCII string.\r |
1773 | @param SecondString The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1774 | \r |
17f695ed | 1775 | @retval ==0 FirstString is identical to SecondString.\r |
1776 | @retval !=0 FirstString is not identical to SecondString.\r | |
ac644614 | 1777 | \r |
1778 | **/\r | |
1779 | INTN\r | |
1780 | EFIAPI\r | |
1781 | AsciiStrCmp (\r | |
1782 | IN CONST CHAR8 *FirstString,\r | |
1783 | IN CONST CHAR8 *SecondString\r | |
1784 | );\r | |
1785 | \r | |
1786 | \r | |
1787 | /**\r | |
1788 | Performs a case insensitive comparison of two Null-terminated ASCII strings,\r | |
1789 | and returns the difference between the first mismatched ASCII characters.\r | |
1790 | \r | |
1791 | This function performs a case insensitive comparison of the Null-terminated\r | |
1792 | ASCII string FirstString to the Null-terminated ASCII string SecondString. If\r | |
1793 | FirstString is identical to SecondString, then 0 is returned. Otherwise, the\r | |
1794 | value returned is the first mismatched lower case ASCII character in\r | |
1795 | SecondString subtracted from the first mismatched lower case ASCII character\r | |
1796 | in FirstString.\r | |
1797 | \r | |
1798 | If FirstString is NULL, then ASSERT().\r | |
1799 | If SecondString is NULL, then ASSERT().\r | |
1800 | If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r | |
1801 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1802 | then ASSERT().\r | |
1803 | If PcdMaximumAsciiStringLength is not zero and SecondString contains more\r | |
1804 | than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
1805 | Null-terminator, then ASSERT().\r | |
1806 | \r | |
af2dc6a7 | 1807 | @param FirstString The pointer to a Null-terminated ASCII string.\r |
1808 | @param SecondString The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1809 | \r |
17f695ed | 1810 | @retval ==0 FirstString is identical to SecondString using case insensitive\r |
1106ffe1 | 1811 | comparisons.\r |
17f695ed | 1812 | @retval !=0 FirstString is not identical to SecondString using case\r |
1106ffe1 | 1813 | insensitive comparisons.\r |
ac644614 | 1814 | \r |
1815 | **/\r | |
1816 | INTN\r | |
1817 | EFIAPI\r | |
1818 | AsciiStriCmp (\r | |
1819 | IN CONST CHAR8 *FirstString,\r | |
1820 | IN CONST CHAR8 *SecondString\r | |
1821 | );\r | |
1822 | \r | |
1823 | \r | |
1824 | /**\r | |
1825 | Compares two Null-terminated ASCII strings with maximum lengths, and returns\r | |
1826 | the difference between the first mismatched ASCII characters.\r | |
1827 | \r | |
1828 | This function compares the Null-terminated ASCII string FirstString to the\r | |
1829 | Null-terminated ASCII string SecondString. At most, Length ASCII characters\r | |
1830 | will be compared. If Length is 0, then 0 is returned. If FirstString is\r | |
1831 | identical to SecondString, then 0 is returned. Otherwise, the value returned\r | |
1832 | is the first mismatched ASCII character in SecondString subtracted from the\r | |
1833 | first mismatched ASCII character in FirstString.\r | |
1834 | \r | |
1835 | If Length > 0 and FirstString is NULL, then ASSERT().\r | |
1836 | If Length > 0 and SecondString is NULL, then ASSERT().\r | |
50c247fd | 1837 | If PcdMaximumAsciiStringLength is not zero, and Length is greater than \r |
1838 | PcdMaximumAsciiStringLength, then ASSERT().\r | |
1839 | If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than\r | |
1840 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r | |
ac644614 | 1841 | then ASSERT().\r |
50c247fd | 1842 | If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than\r |
1843 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r | |
ac644614 | 1844 | then ASSERT().\r |
1845 | \r | |
af2dc6a7 | 1846 | @param FirstString The pointer to a Null-terminated ASCII string.\r |
1847 | @param SecondString The pointer to a Null-terminated ASCII string.\r | |
1848 | @param Length The maximum number of ASCII characters for compare.\r | |
ac644614 | 1849 | \r |
17f695ed | 1850 | @retval ==0 FirstString is identical to SecondString.\r |
1851 | @retval !=0 FirstString is not identical to SecondString.\r | |
ac644614 | 1852 | \r |
1853 | **/\r | |
1854 | INTN\r | |
1855 | EFIAPI\r | |
1856 | AsciiStrnCmp (\r | |
1857 | IN CONST CHAR8 *FirstString,\r | |
1858 | IN CONST CHAR8 *SecondString,\r | |
1859 | IN UINTN Length\r | |
1860 | );\r | |
1861 | \r | |
1862 | \r | |
1bb390f1 ED |
1863 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
1864 | \r | |
ac644614 | 1865 | /**\r |
ae591c14 | 1866 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1867 | \r |
ac644614 | 1868 | Concatenates one Null-terminated ASCII string to another Null-terminated\r |
1869 | ASCII string, and returns the concatenated ASCII string.\r | |
1870 | \r | |
1871 | This function concatenates two Null-terminated ASCII strings. The contents of\r | |
1872 | Null-terminated ASCII string Source are concatenated to the end of Null-\r | |
1873 | terminated ASCII string Destination. The Null-terminated concatenated ASCII\r | |
1874 | String is returned.\r | |
1875 | \r | |
1876 | If Destination is NULL, then ASSERT().\r | |
1877 | If Source is NULL, then ASSERT().\r | |
1878 | If PcdMaximumAsciiStringLength is not zero and Destination contains more than\r | |
1879 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1880 | then ASSERT().\r | |
1881 | If PcdMaximumAsciiStringLength is not zero and Source contains more than\r | |
1882 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1883 | then ASSERT().\r | |
1884 | If PcdMaximumAsciiStringLength is not zero and concatenating Destination and\r | |
1885 | Source results in a ASCII string with more than PcdMaximumAsciiStringLength\r | |
1886 | ASCII characters, then ASSERT().\r | |
1887 | \r | |
af2dc6a7 | 1888 | @param Destination The pointer to a Null-terminated ASCII string.\r |
1889 | @param Source The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1890 | \r |
1891 | @return Destination\r | |
1892 | \r | |
1893 | **/\r | |
1894 | CHAR8 *\r | |
1895 | EFIAPI\r | |
1896 | AsciiStrCat (\r | |
1897 | IN OUT CHAR8 *Destination,\r | |
1898 | IN CONST CHAR8 *Source\r | |
1899 | );\r | |
1900 | \r | |
1901 | \r | |
1902 | /**\r | |
ae591c14 | 1903 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1904 | \r |
17f695ed | 1905 | Concatenates up to a specified length one Null-terminated ASCII string to \r |
1906 | the end of another Null-terminated ASCII string, and returns the \r | |
1907 | concatenated ASCII string.\r | |
ac644614 | 1908 | \r |
1909 | This function concatenates two Null-terminated ASCII strings. The contents\r | |
1910 | of Null-terminated ASCII string Source are concatenated to the end of Null-\r | |
1911 | terminated ASCII string Destination, and Destination is returned. At most,\r | |
1912 | Length ASCII characters are concatenated from Source to the end of\r | |
1913 | Destination, and Destination is always Null-terminated. If Length is 0, then\r | |
1914 | Destination is returned unmodified. If Source and Destination overlap, then\r | |
1915 | the results are undefined.\r | |
1916 | \r | |
1917 | If Length > 0 and Destination is NULL, then ASSERT().\r | |
1918 | If Length > 0 and Source is NULL, then ASSERT().\r | |
1919 | If Source and Destination overlap, then ASSERT().\r | |
50c247fd | 1920 | If PcdMaximumAsciiStringLength is not zero, and Length is greater than\r |
1921 | PcdMaximumAsciiStringLength, then ASSERT().\r | |
ac644614 | 1922 | If PcdMaximumAsciiStringLength is not zero, and Destination contains more than\r |
50c247fd | 1923 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r |
ac644614 | 1924 | then ASSERT().\r |
1925 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r | |
50c247fd | 1926 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r |
ac644614 | 1927 | then ASSERT().\r |
1928 | If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and\r | |
1929 | Source results in a ASCII string with more than PcdMaximumAsciiStringLength\r | |
50c247fd | 1930 | ASCII characters, not including the Null-terminator, then ASSERT().\r |
ac644614 | 1931 | \r |
af2dc6a7 | 1932 | @param Destination The pointer to a Null-terminated ASCII string.\r |
1933 | @param Source The pointer to a Null-terminated ASCII string.\r | |
1934 | @param Length The maximum number of ASCII characters to concatenate from\r | |
ac644614 | 1935 | Source.\r |
1936 | \r | |
1937 | @return Destination\r | |
1938 | \r | |
1939 | **/\r | |
1940 | CHAR8 *\r | |
1941 | EFIAPI\r | |
1942 | AsciiStrnCat (\r | |
1943 | IN OUT CHAR8 *Destination,\r | |
1944 | IN CONST CHAR8 *Source,\r | |
1945 | IN UINTN Length\r | |
1946 | );\r | |
1bb390f1 | 1947 | #endif\r |
ac644614 | 1948 | \r |
1949 | /**\r | |
9aa049d9 | 1950 | Returns the first occurrence of a Null-terminated ASCII sub-string\r |
ac644614 | 1951 | in a Null-terminated ASCII string.\r |
1952 | \r | |
1953 | This function scans the contents of the ASCII string specified by String\r | |
1954 | and returns the first occurrence of SearchString. If SearchString is not\r | |
1955 | found in String, then NULL is returned. If the length of SearchString is zero,\r | |
1956 | then String is returned.\r | |
1957 | \r | |
1958 | If String is NULL, then ASSERT().\r | |
1959 | If SearchString is NULL, then ASSERT().\r | |
1960 | \r | |
1961 | If PcdMaximumAsciiStringLength is not zero, and SearchString or\r | |
1962 | String contains more than PcdMaximumAsciiStringLength Unicode characters\r | |
1963 | not including the Null-terminator, then ASSERT().\r | |
1964 | \r | |
af2dc6a7 | 1965 | @param String The pointer to a Null-terminated ASCII string.\r |
1966 | @param SearchString The pointer to a Null-terminated ASCII string to search for.\r | |
ac644614 | 1967 | \r |
1968 | @retval NULL If the SearchString does not appear in String.\r | |
17f695ed | 1969 | @retval others If there is a match return the first occurrence of SearchingString.\r |
9aa049d9 | 1970 | If the length of SearchString is zero,return String.\r |
ac644614 | 1971 | \r |
1972 | **/\r | |
1973 | CHAR8 *\r | |
1974 | EFIAPI\r | |
1975 | AsciiStrStr (\r | |
17f695ed | 1976 | IN CONST CHAR8 *String,\r |
1977 | IN CONST CHAR8 *SearchString\r | |
ac644614 | 1978 | );\r |
1979 | \r | |
1980 | \r | |
1981 | /**\r | |
1982 | Convert a Null-terminated ASCII decimal string to a value of type\r | |
1983 | UINTN.\r | |
1984 | \r | |
1985 | This function returns a value of type UINTN by interpreting the contents\r | |
1986 | of the ASCII string String as a decimal number. The format of the input\r | |
1987 | ASCII string String is:\r | |
1988 | \r | |
1989 | [spaces] [decimal digits].\r | |
1990 | \r | |
1991 | The valid decimal digit character is in the range [0-9]. The function will\r | |
1992 | ignore the pad space, which includes spaces or tab characters, before the digits.\r | |
1993 | The running zero in the beginning of [decimal digits] will be ignored. Then, the\r | |
1994 | function stops at the first character that is a not a valid decimal character or\r | |
1995 | Null-terminator, whichever on comes first.\r | |
1996 | \r | |
1997 | If String has only pad spaces, then 0 is returned.\r | |
1998 | If String has no pad spaces or valid decimal digits, then 0 is returned.\r | |
1999 | If the number represented by String overflows according to the range defined by\r | |
2000 | UINTN, then ASSERT().\r | |
2001 | If String is NULL, then ASSERT().\r | |
2002 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
2003 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
2004 | then ASSERT().\r | |
2005 | \r | |
af2dc6a7 | 2006 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 2007 | \r |
af2dc6a7 | 2008 | @retval The value translated from String.\r |
ac644614 | 2009 | \r |
2010 | **/\r | |
2011 | UINTN\r | |
2012 | EFIAPI\r | |
2013 | AsciiStrDecimalToUintn (\r | |
2014 | IN CONST CHAR8 *String\r | |
2015 | );\r | |
2016 | \r | |
2017 | \r | |
2018 | /**\r | |
2019 | Convert a Null-terminated ASCII decimal string to a value of type\r | |
2020 | UINT64.\r | |
2021 | \r | |
2022 | This function returns a value of type UINT64 by interpreting the contents\r | |
2023 | of the ASCII string String as a decimal number. The format of the input\r | |
2024 | ASCII string String is:\r | |
2025 | \r | |
2026 | [spaces] [decimal digits].\r | |
2027 | \r | |
2028 | The valid decimal digit character is in the range [0-9]. The function will\r | |
2029 | ignore the pad space, which includes spaces or tab characters, before the digits.\r | |
2030 | The running zero in the beginning of [decimal digits] will be ignored. Then, the\r | |
2031 | function stops at the first character that is a not a valid decimal character or\r | |
2032 | Null-terminator, whichever on comes first.\r | |
2033 | \r | |
2034 | If String has only pad spaces, then 0 is returned.\r | |
2035 | If String has no pad spaces or valid decimal digits, then 0 is returned.\r | |
2036 | If the number represented by String overflows according to the range defined by\r | |
2037 | UINT64, then ASSERT().\r | |
2038 | If String is NULL, then ASSERT().\r | |
2039 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
2040 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
2041 | then ASSERT().\r | |
2042 | \r | |
af2dc6a7 | 2043 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 2044 | \r |
38bbd3d9 | 2045 | @retval Value translated from String.\r |
ac644614 | 2046 | \r |
2047 | **/\r | |
2048 | UINT64\r | |
2049 | EFIAPI\r | |
2050 | AsciiStrDecimalToUint64 (\r | |
17f695ed | 2051 | IN CONST CHAR8 *String\r |
ac644614 | 2052 | );\r |
2053 | \r | |
2054 | \r | |
2055 | /**\r | |
2056 | Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.\r | |
2057 | \r | |
2058 | This function returns a value of type UINTN by interpreting the contents of\r | |
2059 | the ASCII string String as a hexadecimal number. The format of the input ASCII\r | |
2060 | string String is:\r | |
2061 | \r | |
2062 | [spaces][zeros][x][hexadecimal digits].\r | |
2063 | \r | |
2064 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
2065 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"\r | |
2066 | appears in the input string, it must be prefixed with at least one 0. The function\r | |
2067 | will ignore the pad space, which includes spaces or tab characters, before [zeros],\r | |
2068 | [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]\r | |
2069 | will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal\r | |
2070 | digit. Then, the function stops at the first character that is a not a valid\r | |
2071 | hexadecimal character or Null-terminator, whichever on comes first.\r | |
2072 | \r | |
2073 | If String has only pad spaces, then 0 is returned.\r | |
2074 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then\r | |
2075 | 0 is returned.\r | |
2076 | \r | |
2077 | If the number represented by String overflows according to the range defined by UINTN,\r | |
2078 | then ASSERT().\r | |
2079 | If String is NULL, then ASSERT().\r | |
2080 | If PcdMaximumAsciiStringLength is not zero,\r | |
2081 | and String contains more than PcdMaximumAsciiStringLength ASCII characters not including\r | |
2082 | the Null-terminator, then ASSERT().\r | |
2083 | \r | |
af2dc6a7 | 2084 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 2085 | \r |
38bbd3d9 | 2086 | @retval Value translated from String.\r |
ac644614 | 2087 | \r |
2088 | **/\r | |
2089 | UINTN\r | |
2090 | EFIAPI\r | |
2091 | AsciiStrHexToUintn (\r | |
17f695ed | 2092 | IN CONST CHAR8 *String\r |
ac644614 | 2093 | );\r |
2094 | \r | |
2095 | \r | |
2096 | /**\r | |
2097 | Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.\r | |
2098 | \r | |
2099 | This function returns a value of type UINT64 by interpreting the contents of\r | |
2100 | the ASCII string String as a hexadecimal number. The format of the input ASCII\r | |
2101 | string String is:\r | |
2102 | \r | |
2103 | [spaces][zeros][x][hexadecimal digits].\r | |
2104 | \r | |
2105 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
2106 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"\r | |
2107 | appears in the input string, it must be prefixed with at least one 0. The function\r | |
2108 | will ignore the pad space, which includes spaces or tab characters, before [zeros],\r | |
2109 | [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]\r | |
2110 | will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal\r | |
2111 | digit. Then, the function stops at the first character that is a not a valid\r | |
2112 | hexadecimal character or Null-terminator, whichever on comes first.\r | |
2113 | \r | |
2114 | If String has only pad spaces, then 0 is returned.\r | |
2115 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then\r | |
2116 | 0 is returned.\r | |
2117 | \r | |
2118 | If the number represented by String overflows according to the range defined by UINT64,\r | |
2119 | then ASSERT().\r | |
2120 | If String is NULL, then ASSERT().\r | |
2121 | If PcdMaximumAsciiStringLength is not zero,\r | |
2122 | and String contains more than PcdMaximumAsciiStringLength ASCII characters not including\r | |
2123 | the Null-terminator, then ASSERT().\r | |
2124 | \r | |
af2dc6a7 | 2125 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 2126 | \r |
38bbd3d9 | 2127 | @retval Value translated from String.\r |
ac644614 | 2128 | \r |
2129 | **/\r | |
2130 | UINT64\r | |
2131 | EFIAPI\r | |
2132 | AsciiStrHexToUint64 (\r | |
17f695ed | 2133 | IN CONST CHAR8 *String\r |
ac644614 | 2134 | );\r |
2135 | \r | |
415aa2f1 | 2136 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
ac644614 | 2137 | \r |
2138 | /**\r | |
415aa2f1 SZ |
2139 | [ATTENTION] This function is deprecated for security reason.\r |
2140 | \r | |
ac644614 | 2141 | Convert one Null-terminated ASCII string to a Null-terminated\r |
2142 | Unicode string and returns the Unicode string.\r | |
2143 | \r | |
2144 | This function converts the contents of the ASCII string Source to the Unicode\r | |
2145 | string Destination, and returns Destination. The function terminates the\r | |
2146 | Unicode string Destination by appending a Null-terminator character at the end.\r | |
2147 | The caller is responsible to make sure Destination points to a buffer with size\r | |
2148 | equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.\r | |
2149 | \r | |
2150 | If Destination is NULL, then ASSERT().\r | |
2151 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
2152 | If Source is NULL, then ASSERT().\r | |
2153 | If Source and Destination overlap, then ASSERT().\r | |
2154 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r | |
2155 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
2156 | then ASSERT().\r | |
2157 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
2158 | PcdMaximumUnicodeStringLength ASCII characters not including the\r | |
2159 | Null-terminator, then ASSERT().\r | |
2160 | \r | |
af2dc6a7 | 2161 | @param Source The pointer to a Null-terminated ASCII string.\r |
2162 | @param Destination The pointer to a Null-terminated Unicode string.\r | |
ac644614 | 2163 | \r |
9aa049d9 | 2164 | @return Destination.\r |
ac644614 | 2165 | \r |
2166 | **/\r | |
2167 | CHAR16 *\r | |
2168 | EFIAPI\r | |
2169 | AsciiStrToUnicodeStr (\r | |
17f695ed | 2170 | IN CONST CHAR8 *Source,\r |
2171 | OUT CHAR16 *Destination\r | |
ac644614 | 2172 | );\r |
2173 | \r | |
415aa2f1 SZ |
2174 | #endif\r |
2175 | \r | |
3ab41b7a JY |
2176 | /**\r |
2177 | Convert one Null-terminated ASCII string to a Null-terminated\r | |
2178 | Unicode string.\r | |
2179 | \r | |
2180 | This function is similar to StrCpyS.\r | |
2181 | \r | |
2182 | This function converts the contents of the ASCII string Source to the Unicode\r | |
2183 | string Destination. The function terminates the Unicode string Destination by\r | |
2184 | appending a Null-terminator character at the end.\r | |
2185 | \r | |
2186 | The caller is responsible to make sure Destination points to a buffer with size\r | |
2187 | equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.\r | |
2188 | \r | |
2189 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
2190 | If an error would be returned, then the function will also ASSERT().\r | |
2191 | \r | |
2192 | If an error is returned, then the Destination is unmodified.\r | |
2193 | \r | |
2194 | @param Source The pointer to a Null-terminated ASCII string.\r | |
2195 | @param Destination The pointer to a Null-terminated Unicode string.\r | |
2196 | @param DestMax The maximum number of Destination Unicode\r | |
2197 | char, including terminating null char.\r | |
2198 | \r | |
2199 | @retval RETURN_SUCCESS String is converted.\r | |
2200 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).\r | |
2201 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
2202 | If Source is NULL.\r | |
2203 | If PcdMaximumUnicodeStringLength is not zero,\r | |
2204 | and DestMax is greater than\r | |
2205 | PcdMaximumUnicodeStringLength.\r | |
2206 | If PcdMaximumAsciiStringLength is not zero,\r | |
2207 | and DestMax is greater than\r | |
2208 | PcdMaximumAsciiStringLength.\r | |
2209 | If DestMax is 0.\r | |
2210 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
2211 | \r | |
2212 | **/\r | |
2213 | RETURN_STATUS\r | |
2214 | EFIAPI\r | |
2215 | AsciiStrToUnicodeStrS (\r | |
2216 | IN CONST CHAR8 *Source,\r | |
2217 | OUT CHAR16 *Destination,\r | |
2218 | IN UINTN DestMax\r | |
2219 | );\r | |
ac644614 | 2220 | \r |
2221 | /**\r | |
2222 | Converts an 8-bit value to an 8-bit BCD value.\r | |
2223 | \r | |
2224 | Converts the 8-bit value specified by Value to BCD. The BCD value is\r | |
2225 | returned.\r | |
2226 | \r | |
2227 | If Value >= 100, then ASSERT().\r | |
2228 | \r | |
2229 | @param Value The 8-bit value to convert to BCD. Range 0..99.\r | |
2230 | \r | |
9aa049d9 | 2231 | @return The BCD value.\r |
ac644614 | 2232 | \r |
2233 | **/\r | |
2234 | UINT8\r | |
2235 | EFIAPI\r | |
2236 | DecimalToBcd8 (\r | |
2237 | IN UINT8 Value\r | |
2238 | );\r | |
2239 | \r | |
2240 | \r | |
2241 | /**\r | |
2242 | Converts an 8-bit BCD value to an 8-bit value.\r | |
2243 | \r | |
2244 | Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit\r | |
2245 | value is returned.\r | |
2246 | \r | |
2247 | If Value >= 0xA0, then ASSERT().\r | |
2248 | If (Value & 0x0F) >= 0x0A, then ASSERT().\r | |
2249 | \r | |
2250 | @param Value The 8-bit BCD value to convert to an 8-bit value.\r | |
2251 | \r | |
2252 | @return The 8-bit value is returned.\r | |
2253 | \r | |
2254 | **/\r | |
2255 | UINT8\r | |
2256 | EFIAPI\r | |
2257 | BcdToDecimal8 (\r | |
2258 | IN UINT8 Value\r | |
2259 | );\r | |
2260 | \r | |
ae591c14 DM |
2261 | //\r |
2262 | // File Path Manipulation Functions\r | |
2263 | //\r | |
2264 | \r | |
2265 | /**\r | |
6a623094 | 2266 | Removes the last directory or file entry in a path.\r |
ae591c14 DM |
2267 | \r |
2268 | @param[in, out] Path The pointer to the path to modify.\r | |
2269 | \r | |
2270 | @retval FALSE Nothing was found to remove.\r | |
2271 | @retval TRUE A directory or file was removed.\r | |
2272 | **/\r | |
2273 | BOOLEAN\r | |
2274 | EFIAPI\r | |
2275 | PathRemoveLastItem(\r | |
2276 | IN OUT CHAR16 *Path\r | |
2277 | );\r | |
2278 | \r | |
2279 | /**\r | |
2280 | Function to clean up paths.\r | |
2281 | - Single periods in the path are removed.\r | |
2282 | - Double periods in the path are removed along with a single parent directory.\r | |
2283 | - Forward slashes L'/' are converted to backward slashes L'\'.\r | |
2284 | \r | |
2285 | This will be done inline and the existing buffer may be larger than required\r | |
2286 | upon completion.\r | |
2287 | \r | |
2288 | @param[in] Path The pointer to the string containing the path.\r | |
2289 | \r | |
00b7cc0f | 2290 | @return Returns Path, otherwise returns NULL to indicate that an error has occurred.\r |
ae591c14 DM |
2291 | **/\r |
2292 | CHAR16*\r | |
2293 | EFIAPI\r | |
2294 | PathCleanUpDirectories(\r | |
2295 | IN CHAR16 *Path\r | |
909ac47b | 2296 | );\r |
ac644614 | 2297 | \r |
2298 | //\r | |
2299 | // Linked List Functions and Macros\r | |
2300 | //\r | |
2301 | \r | |
2302 | /**\r | |
2303 | Initializes the head node of a doubly linked list that is declared as a\r | |
2304 | global variable in a module.\r | |
2305 | \r | |
2306 | Initializes the forward and backward links of a new linked list. After\r | |
2307 | initializing a linked list with this macro, the other linked list functions\r | |
2308 | may be used to add and remove nodes from the linked list. This macro results\r | |
2309 | in smaller executables by initializing the linked list in the data section,\r | |
2310 | instead if calling the InitializeListHead() function to perform the\r | |
2311 | equivalent operation.\r | |
2312 | \r | |
77f863ee | 2313 | @param ListHead The head note of a list to initialize.\r |
ac644614 | 2314 | \r |
2315 | **/\r | |
17f695ed | 2316 | #define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)}\r |
ac644614 | 2317 | \r |
2318 | \r | |
2319 | /**\r | |
2320 | Initializes the head node of a doubly linked list, and returns the pointer to\r | |
2321 | the head node of the doubly linked list.\r | |
2322 | \r | |
2323 | Initializes the forward and backward links of a new linked list. After\r | |
2324 | initializing a linked list with this function, the other linked list\r | |
2325 | functions may be used to add and remove nodes from the linked list. It is up\r | |
2326 | to the caller of this function to allocate the memory for ListHead.\r | |
2327 | \r | |
2328 | If ListHead is NULL, then ASSERT().\r | |
2329 | \r | |
2330 | @param ListHead A pointer to the head node of a new doubly linked list.\r | |
2331 | \r | |
2332 | @return ListHead\r | |
2333 | \r | |
2334 | **/\r | |
2335 | LIST_ENTRY *\r | |
2336 | EFIAPI\r | |
2337 | InitializeListHead (\r | |
aa0583c7 | 2338 | IN OUT LIST_ENTRY *ListHead\r |
ac644614 | 2339 | );\r |
2340 | \r | |
2341 | \r | |
2342 | /**\r | |
2343 | Adds a node to the beginning of a doubly linked list, and returns the pointer\r | |
2344 | to the head node of the doubly linked list.\r | |
2345 | \r | |
2346 | Adds the node Entry at the beginning of the doubly linked list denoted by\r | |
2347 | ListHead, and returns ListHead.\r | |
2348 | \r | |
2349 | If ListHead is NULL, then ASSERT().\r | |
2350 | If Entry is NULL, then ASSERT().\r | |
17f695ed | 2351 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or\r |
2352 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2353 | If PcdMaximumLinkedListLength is not zero, and prior to insertion the number\r |
ac644614 | 2354 | of nodes in ListHead, including the ListHead node, is greater than or\r |
2355 | equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
2356 | \r | |
2357 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
2358 | @param Entry A pointer to a node that is to be inserted at the beginning\r | |
2359 | of a doubly linked list.\r | |
2360 | \r | |
2361 | @return ListHead\r | |
2362 | \r | |
2363 | **/\r | |
2364 | LIST_ENTRY *\r | |
2365 | EFIAPI\r | |
2366 | InsertHeadList (\r | |
aa0583c7 | 2367 | IN OUT LIST_ENTRY *ListHead,\r |
2368 | IN OUT LIST_ENTRY *Entry\r | |
ac644614 | 2369 | );\r |
2370 | \r | |
2371 | \r | |
2372 | /**\r | |
2373 | Adds a node to the end of a doubly linked list, and returns the pointer to\r | |
2374 | the head node of the doubly linked list.\r | |
2375 | \r | |
2376 | Adds the node Entry to the end of the doubly linked list denoted by ListHead,\r | |
2377 | and returns ListHead.\r | |
2378 | \r | |
2379 | If ListHead is NULL, then ASSERT().\r | |
2380 | If Entry is NULL, then ASSERT().\r | |
17f695ed | 2381 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
2382 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2383 | If PcdMaximumLinkedListLength is not zero, and prior to insertion the number\r |
ac644614 | 2384 | of nodes in ListHead, including the ListHead node, is greater than or\r |
2385 | equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
2386 | \r | |
2387 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
2388 | @param Entry A pointer to a node that is to be added at the end of the\r | |
2389 | doubly linked list.\r | |
2390 | \r | |
2391 | @return ListHead\r | |
2392 | \r | |
2393 | **/\r | |
2394 | LIST_ENTRY *\r | |
2395 | EFIAPI\r | |
2396 | InsertTailList (\r | |
aa0583c7 | 2397 | IN OUT LIST_ENTRY *ListHead,\r |
2398 | IN OUT LIST_ENTRY *Entry\r | |
ac644614 | 2399 | );\r |
2400 | \r | |
2401 | \r | |
2402 | /**\r | |
2403 | Retrieves the first node of a doubly linked list.\r | |
2404 | \r | |
17f695ed | 2405 | Returns the first node of a doubly linked list. List must have been \r |
2406 | initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r | |
2407 | If List is empty, then List is returned.\r | |
ac644614 | 2408 | \r |
2409 | If List is NULL, then ASSERT().\r | |
17f695ed | 2410 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
2411 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2412 | If PcdMaximumLinkedListLength is not zero, and the number of nodes\r |
ac644614 | 2413 | in List, including the List node, is greater than or equal to\r |
2414 | PcdMaximumLinkedListLength, then ASSERT().\r | |
2415 | \r | |
2416 | @param List A pointer to the head node of a doubly linked list.\r | |
2417 | \r | |
2418 | @return The first node of a doubly linked list.\r | |
e01a125f | 2419 | @retval List The list is empty.\r |
ac644614 | 2420 | \r |
2421 | **/\r | |
2422 | LIST_ENTRY *\r | |
2423 | EFIAPI\r | |
2424 | GetFirstNode (\r | |
2425 | IN CONST LIST_ENTRY *List\r | |
2426 | );\r | |
2427 | \r | |
2428 | \r | |
2429 | /**\r | |
2430 | Retrieves the next node of a doubly linked list.\r | |
2431 | \r | |
17f695ed | 2432 | Returns the node of a doubly linked list that follows Node. \r |
2433 | List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()\r | |
2434 | or InitializeListHead(). If List is empty, then List is returned.\r | |
ac644614 | 2435 | \r |
2436 | If List is NULL, then ASSERT().\r | |
2437 | If Node is NULL, then ASSERT().\r | |
17f695ed | 2438 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
2439 | InitializeListHead(), then ASSERT().\r | |
a71865b1 LG |
2440 | If PcdMaximumLinkedListLength is not zero, and List contains more than\r |
2441 | PcdMaximumLinkedListLength nodes, then ASSERT().\r | |
1081f624 | 2442 | If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r |
ac644614 | 2443 | \r |
2444 | @param List A pointer to the head node of a doubly linked list.\r | |
2445 | @param Node A pointer to a node in the doubly linked list.\r | |
2446 | \r | |
af2dc6a7 | 2447 | @return The pointer to the next node if one exists. Otherwise List is returned.\r |
ac644614 | 2448 | \r |
2449 | **/\r | |
2450 | LIST_ENTRY *\r | |
2451 | EFIAPI\r | |
2452 | GetNextNode (\r | |
2453 | IN CONST LIST_ENTRY *List,\r | |
2454 | IN CONST LIST_ENTRY *Node\r | |
2455 | );\r | |
2456 | \r | |
cbca8de5 | 2457 | \r |
2458 | /**\r | |
2459 | Retrieves the previous node of a doubly linked list.\r | |
2460 | \r | |
2461 | Returns the node of a doubly linked list that precedes Node. \r | |
2462 | List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()\r | |
2463 | or InitializeListHead(). If List is empty, then List is returned.\r | |
2464 | \r | |
2465 | If List is NULL, then ASSERT().\r | |
2466 | If Node is NULL, then ASSERT().\r | |
2467 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r | |
2468 | InitializeListHead(), then ASSERT().\r | |
a71865b1 LG |
2469 | If PcdMaximumLinkedListLength is not zero, and List contains more than\r |
2470 | PcdMaximumLinkedListLength nodes, then ASSERT().\r | |
cbca8de5 | 2471 | If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r |
2472 | \r | |
2473 | @param List A pointer to the head node of a doubly linked list.\r | |
2474 | @param Node A pointer to a node in the doubly linked list.\r | |
2475 | \r | |
af2dc6a7 | 2476 | @return The pointer to the previous node if one exists. Otherwise List is returned.\r |
cbca8de5 | 2477 | \r |
2478 | **/\r | |
2479 | LIST_ENTRY *\r | |
2480 | EFIAPI\r | |
2481 | GetPreviousNode (\r | |
2482 | IN CONST LIST_ENTRY *List,\r | |
2483 | IN CONST LIST_ENTRY *Node\r | |
2484 | );\r | |
ac644614 | 2485 | \r |
cbca8de5 | 2486 | \r |
ac644614 | 2487 | /**\r |
2488 | Checks to see if a doubly linked list is empty or not.\r | |
2489 | \r | |
2490 | Checks to see if the doubly linked list is empty. If the linked list contains\r | |
2491 | zero nodes, this function returns TRUE. Otherwise, it returns FALSE.\r | |
2492 | \r | |
2493 | If ListHead is NULL, then ASSERT().\r | |
17f695ed | 2494 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
2495 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2496 | If PcdMaximumLinkedListLength is not zero, and the number of nodes\r |
ac644614 | 2497 | in List, including the List node, is greater than or equal to\r |
2498 | PcdMaximumLinkedListLength, then ASSERT().\r | |
2499 | \r | |
2500 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
2501 | \r | |
2502 | @retval TRUE The linked list is empty.\r | |
2503 | @retval FALSE The linked list is not empty.\r | |
2504 | \r | |
2505 | **/\r | |
2506 | BOOLEAN\r | |
2507 | EFIAPI\r | |
2508 | IsListEmpty (\r | |
2509 | IN CONST LIST_ENTRY *ListHead\r | |
2510 | );\r | |
2511 | \r | |
2512 | \r | |
2513 | /**\r | |
aa0583c7 | 2514 | Determines if a node in a doubly linked list is the head node of a the same\r |
2515 | doubly linked list. This function is typically used to terminate a loop that\r | |
2516 | traverses all the nodes in a doubly linked list starting with the head node.\r | |
ac644614 | 2517 | \r |
aa0583c7 | 2518 | Returns TRUE if Node is equal to List. Returns FALSE if Node is one of the\r |
2519 | nodes in the doubly linked list specified by List. List must have been\r | |
17f695ed | 2520 | initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r |
ac644614 | 2521 | \r |
2522 | If List is NULL, then ASSERT().\r | |
2523 | If Node is NULL, then ASSERT().\r | |
17f695ed | 2524 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), \r |
2525 | then ASSERT().\r | |
a71865b1 | 2526 | If PcdMaximumLinkedListLength is not zero, and the number of nodes\r |
ac644614 | 2527 | in List, including the List node, is greater than or equal to\r |
2528 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1081f624 | 2529 | If PcdVerifyNodeInList is TRUE and Node is not a node in List the and Node is not equal \r |
2530 | to List, then ASSERT().\r | |
ac644614 | 2531 | \r |
2532 | @param List A pointer to the head node of a doubly linked list.\r | |
2533 | @param Node A pointer to a node in the doubly linked list.\r | |
2534 | \r | |
1955808d LG |
2535 | @retval TRUE Node is the head of the doubly-linked list pointed by List.\r |
2536 | @retval FALSE Node is not the head of the doubly-linked list pointed by List.\r | |
ac644614 | 2537 | \r |
2538 | **/\r | |
2539 | BOOLEAN\r | |
2540 | EFIAPI\r | |
2541 | IsNull (\r | |
2542 | IN CONST LIST_ENTRY *List,\r | |
2543 | IN CONST LIST_ENTRY *Node\r | |
2544 | );\r | |
2545 | \r | |
2546 | \r | |
2547 | /**\r | |
2548 | Determines if a node the last node in a doubly linked list.\r | |
2549 | \r | |
2550 | Returns TRUE if Node is the last node in the doubly linked list specified by\r | |
2551 | List. Otherwise, FALSE is returned. List must have been initialized with\r | |
17f695ed | 2552 | INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r |
ac644614 | 2553 | \r |
2554 | If List is NULL, then ASSERT().\r | |
2555 | If Node is NULL, then ASSERT().\r | |
17f695ed | 2556 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or\r |
2557 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2558 | If PcdMaximumLinkedListLength is not zero, and the number of nodes\r |
ac644614 | 2559 | in List, including the List node, is greater than or equal to\r |
2560 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1081f624 | 2561 | If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r |
ac644614 | 2562 | \r |
2563 | @param List A pointer to the head node of a doubly linked list.\r | |
2564 | @param Node A pointer to a node in the doubly linked list.\r | |
2565 | \r | |
2566 | @retval TRUE Node is the last node in the linked list.\r | |
2567 | @retval FALSE Node is not the last node in the linked list.\r | |
2568 | \r | |
2569 | **/\r | |
2570 | BOOLEAN\r | |
2571 | EFIAPI\r | |
2572 | IsNodeAtEnd (\r | |
2573 | IN CONST LIST_ENTRY *List,\r | |
2574 | IN CONST LIST_ENTRY *Node\r | |
2575 | );\r | |
2576 | \r | |
2577 | \r | |
2578 | /**\r | |
2579 | Swaps the location of two nodes in a doubly linked list, and returns the\r | |
2580 | first node after the swap.\r | |
2581 | \r | |
2582 | If FirstEntry is identical to SecondEntry, then SecondEntry is returned.\r | |
2583 | Otherwise, the location of the FirstEntry node is swapped with the location\r | |
2584 | of the SecondEntry node in a doubly linked list. SecondEntry must be in the\r | |
2585 | same double linked list as FirstEntry and that double linked list must have\r | |
17f695ed | 2586 | been initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(). \r |
2587 | SecondEntry is returned after the nodes are swapped.\r | |
ac644614 | 2588 | \r |
2589 | If FirstEntry is NULL, then ASSERT().\r | |
2590 | If SecondEntry is NULL, then ASSERT().\r | |
1081f624 | 2591 | If PcdVerifyNodeInList is TRUE and SecondEntry and FirstEntry are not in the \r |
2592 | same linked list, then ASSERT().\r | |
ac644614 | 2593 | If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r |
2594 | linked list containing the FirstEntry and SecondEntry nodes, including\r | |
2595 | the FirstEntry and SecondEntry nodes, is greater than or equal to\r | |
2596 | PcdMaximumLinkedListLength, then ASSERT().\r | |
2597 | \r | |
2598 | @param FirstEntry A pointer to a node in a linked list.\r | |
2599 | @param SecondEntry A pointer to another node in the same linked list.\r | |
38bbd3d9 | 2600 | \r |
9aa049d9 | 2601 | @return SecondEntry.\r |
ac644614 | 2602 | \r |
2603 | **/\r | |
2604 | LIST_ENTRY *\r | |
2605 | EFIAPI\r | |
2606 | SwapListEntries (\r | |
aa0583c7 | 2607 | IN OUT LIST_ENTRY *FirstEntry,\r |
2608 | IN OUT LIST_ENTRY *SecondEntry\r | |
ac644614 | 2609 | );\r |
2610 | \r | |
2611 | \r | |
2612 | /**\r | |
2613 | Removes a node from a doubly linked list, and returns the node that follows\r | |
2614 | the removed node.\r | |
2615 | \r | |
2616 | Removes the node Entry from a doubly linked list. It is up to the caller of\r | |
2617 | this function to release the memory used by this node if that is required. On\r | |
2618 | exit, the node following Entry in the doubly linked list is returned. If\r | |
2619 | Entry is the only node in the linked list, then the head node of the linked\r | |
2620 | list is returned.\r | |
2621 | \r | |
2622 | If Entry is NULL, then ASSERT().\r | |
2623 | If Entry is the head node of an empty list, then ASSERT().\r | |
2624 | If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r | |
2625 | linked list containing Entry, including the Entry node, is greater than\r | |
2626 | or equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
2627 | \r | |
9aa049d9 | 2628 | @param Entry A pointer to a node in a linked list.\r |
ac644614 | 2629 | \r |
9aa049d9 | 2630 | @return Entry.\r |
ac644614 | 2631 | \r |
2632 | **/\r | |
2633 | LIST_ENTRY *\r | |
2634 | EFIAPI\r | |
2635 | RemoveEntryList (\r | |
2636 | IN CONST LIST_ENTRY *Entry\r | |
2637 | );\r | |
2638 | \r | |
2639 | //\r | |
2640 | // Math Services\r | |
2641 | //\r | |
2642 | \r | |
2643 | /**\r | |
2644 | Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled\r | |
2645 | with zeros. The shifted value is returned.\r | |
2646 | \r | |
2647 | This function shifts the 64-bit value Operand to the left by Count bits. The\r | |
2648 | low Count bits are set to zero. The shifted value is returned.\r | |
2649 | \r | |
2650 | If Count is greater than 63, then ASSERT().\r | |
2651 | \r | |
2652 | @param Operand The 64-bit operand to shift left.\r | |
2653 | @param Count The number of bits to shift left.\r | |
2654 | \r | |
9aa049d9 | 2655 | @return Operand << Count.\r |
ac644614 | 2656 | \r |
2657 | **/\r | |
2658 | UINT64\r | |
2659 | EFIAPI\r | |
2660 | LShiftU64 (\r | |
2661 | IN UINT64 Operand,\r | |
2662 | IN UINTN Count\r | |
2663 | );\r | |
2664 | \r | |
2665 | \r | |
2666 | /**\r | |
2667 | Shifts a 64-bit integer right between 0 and 63 bits. This high bits are\r | |
2668 | filled with zeros. The shifted value is returned.\r | |
2669 | \r | |
2670 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
2671 | high Count bits are set to zero. The shifted value is returned.\r | |
2672 | \r | |
2673 | If Count is greater than 63, then ASSERT().\r | |
2674 | \r | |
2675 | @param Operand The 64-bit operand to shift right.\r | |
2676 | @param Count The number of bits to shift right.\r | |
2677 | \r | |
2678 | @return Operand >> Count\r | |
2679 | \r | |
2680 | **/\r | |
2681 | UINT64\r | |
2682 | EFIAPI\r | |
2683 | RShiftU64 (\r | |
2684 | IN UINT64 Operand,\r | |
2685 | IN UINTN Count\r | |
2686 | );\r | |
2687 | \r | |
2688 | \r | |
2689 | /**\r | |
2690 | Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled\r | |
2691 | with original integer's bit 63. The shifted value is returned.\r | |
2692 | \r | |
2693 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
2694 | high Count bits are set to bit 63 of Operand. The shifted value is returned.\r | |
2695 | \r | |
2696 | If Count is greater than 63, then ASSERT().\r | |
2697 | \r | |
2698 | @param Operand The 64-bit operand to shift right.\r | |
2699 | @param Count The number of bits to shift right.\r | |
2700 | \r | |
2701 | @return Operand >> Count\r | |
2702 | \r | |
2703 | **/\r | |
2704 | UINT64\r | |
2705 | EFIAPI\r | |
2706 | ARShiftU64 (\r | |
2707 | IN UINT64 Operand,\r | |
2708 | IN UINTN Count\r | |
2709 | );\r | |
2710 | \r | |
2711 | \r | |
2712 | /**\r | |
2713 | Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits\r | |
2714 | with the high bits that were rotated.\r | |
2715 | \r | |
2716 | This function rotates the 32-bit value Operand to the left by Count bits. The\r | |
2717 | low Count bits are fill with the high Count bits of Operand. The rotated\r | |
2718 | value is returned.\r | |
2719 | \r | |
2720 | If Count is greater than 31, then ASSERT().\r | |
2721 | \r | |
2722 | @param Operand The 32-bit operand to rotate left.\r | |
2723 | @param Count The number of bits to rotate left.\r | |
2724 | \r | |
17f695ed | 2725 | @return Operand << Count\r |
ac644614 | 2726 | \r |
2727 | **/\r | |
2728 | UINT32\r | |
2729 | EFIAPI\r | |
2730 | LRotU32 (\r | |
2731 | IN UINT32 Operand,\r | |
2732 | IN UINTN Count\r | |
2733 | );\r | |
2734 | \r | |
2735 | \r | |
2736 | /**\r | |
2737 | Rotates a 32-bit integer right between 0 and 31 bits, filling the high bits\r | |
2738 | with the low bits that were rotated.\r | |
2739 | \r | |
2740 | This function rotates the 32-bit value Operand to the right by Count bits.\r | |
2741 | The high Count bits are fill with the low Count bits of Operand. The rotated\r | |
2742 | value is returned.\r | |
2743 | \r | |
2744 | If Count is greater than 31, then ASSERT().\r | |
2745 | \r | |
2746 | @param Operand The 32-bit operand to rotate right.\r | |
2747 | @param Count The number of bits to rotate right.\r | |
2748 | \r | |
2fe241a2 | 2749 | @return Operand >> Count\r |
ac644614 | 2750 | \r |
2751 | **/\r | |
2752 | UINT32\r | |
2753 | EFIAPI\r | |
2754 | RRotU32 (\r | |
2755 | IN UINT32 Operand,\r | |
2756 | IN UINTN Count\r | |
2757 | );\r | |
2758 | \r | |
2759 | \r | |
2760 | /**\r | |
2761 | Rotates a 64-bit integer left between 0 and 63 bits, filling the low bits\r | |
2762 | with the high bits that were rotated.\r | |
2763 | \r | |
2764 | This function rotates the 64-bit value Operand to the left by Count bits. The\r | |
2765 | low Count bits are fill with the high Count bits of Operand. The rotated\r | |
2766 | value is returned.\r | |
2767 | \r | |
2768 | If Count is greater than 63, then ASSERT().\r | |
2769 | \r | |
2770 | @param Operand The 64-bit operand to rotate left.\r | |
2771 | @param Count The number of bits to rotate left.\r | |
2772 | \r | |
17f695ed | 2773 | @return Operand << Count\r |
ac644614 | 2774 | \r |
2775 | **/\r | |
2776 | UINT64\r | |
2777 | EFIAPI\r | |
2778 | LRotU64 (\r | |
2779 | IN UINT64 Operand,\r | |
2780 | IN UINTN Count\r | |
2781 | );\r | |
2782 | \r | |
2783 | \r | |
2784 | /**\r | |
2785 | Rotates a 64-bit integer right between 0 and 63 bits, filling the high bits\r | |
2786 | with the high low bits that were rotated.\r | |
2787 | \r | |
2788 | This function rotates the 64-bit value Operand to the right by Count bits.\r | |
2789 | The high Count bits are fill with the low Count bits of Operand. The rotated\r | |
2790 | value is returned.\r | |
2791 | \r | |
2792 | If Count is greater than 63, then ASSERT().\r | |
2793 | \r | |
2794 | @param Operand The 64-bit operand to rotate right.\r | |
2795 | @param Count The number of bits to rotate right.\r | |
2796 | \r | |
17f695ed | 2797 | @return Operand >> Count\r |
ac644614 | 2798 | \r |
2799 | **/\r | |
2800 | UINT64\r | |
2801 | EFIAPI\r | |
2802 | RRotU64 (\r | |
2803 | IN UINT64 Operand,\r | |
2804 | IN UINTN Count\r | |
2805 | );\r | |
2806 | \r | |
2807 | \r | |
2808 | /**\r | |
2809 | Returns the bit position of the lowest bit set in a 32-bit value.\r | |
2810 | \r | |
2811 | This function computes the bit position of the lowest bit set in the 32-bit\r | |
2812 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
2813 | Otherwise, a value between 0 and 31 is returned.\r | |
2814 | \r | |
2815 | @param Operand The 32-bit operand to evaluate.\r | |
2816 | \r | |
9aa049d9 | 2817 | @retval 0..31 The lowest bit set in Operand was found.\r |
17f695ed | 2818 | @retval -1 Operand is zero.\r |
ac644614 | 2819 | \r |
2820 | **/\r | |
2821 | INTN\r | |
2822 | EFIAPI\r | |
2823 | LowBitSet32 (\r | |
2824 | IN UINT32 Operand\r | |
2825 | );\r | |
2826 | \r | |
2827 | \r | |
2828 | /**\r | |
2829 | Returns the bit position of the lowest bit set in a 64-bit value.\r | |
2830 | \r | |
2831 | This function computes the bit position of the lowest bit set in the 64-bit\r | |
2832 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
2833 | Otherwise, a value between 0 and 63 is returned.\r | |
2834 | \r | |
2835 | @param Operand The 64-bit operand to evaluate.\r | |
2836 | \r | |
9aa049d9 | 2837 | @retval 0..63 The lowest bit set in Operand was found.\r |
17f695ed | 2838 | @retval -1 Operand is zero.\r |
2839 | \r | |
ac644614 | 2840 | \r |
2841 | **/\r | |
2842 | INTN\r | |
2843 | EFIAPI\r | |
2844 | LowBitSet64 (\r | |
2845 | IN UINT64 Operand\r | |
2846 | );\r | |
2847 | \r | |
2848 | \r | |
2849 | /**\r | |
2850 | Returns the bit position of the highest bit set in a 32-bit value. Equivalent\r | |
2851 | to log2(x).\r | |
2852 | \r | |
2853 | This function computes the bit position of the highest bit set in the 32-bit\r | |
2854 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
2855 | Otherwise, a value between 0 and 31 is returned.\r | |
2856 | \r | |
2857 | @param Operand The 32-bit operand to evaluate.\r | |
2858 | \r | |
9aa049d9 | 2859 | @retval 0..31 Position of the highest bit set in Operand if found.\r |
17f695ed | 2860 | @retval -1 Operand is zero.\r |
ac644614 | 2861 | \r |
2862 | **/\r | |
2863 | INTN\r | |
2864 | EFIAPI\r | |
2865 | HighBitSet32 (\r | |
2866 | IN UINT32 Operand\r | |
2867 | );\r | |
2868 | \r | |
2869 | \r | |
2870 | /**\r | |
2871 | Returns the bit position of the highest bit set in a 64-bit value. Equivalent\r | |
2872 | to log2(x).\r | |
2873 | \r | |
2874 | This function computes the bit position of the highest bit set in the 64-bit\r | |
2875 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
2876 | Otherwise, a value between 0 and 63 is returned.\r | |
2877 | \r | |
2878 | @param Operand The 64-bit operand to evaluate.\r | |
2879 | \r | |
9aa049d9 | 2880 | @retval 0..63 Position of the highest bit set in Operand if found.\r |
17f695ed | 2881 | @retval -1 Operand is zero.\r |
ac644614 | 2882 | \r |
2883 | **/\r | |
2884 | INTN\r | |
2885 | EFIAPI\r | |
2886 | HighBitSet64 (\r | |
2887 | IN UINT64 Operand\r | |
2888 | );\r | |
2889 | \r | |
2890 | \r | |
2891 | /**\r | |
2892 | Returns the value of the highest bit set in a 32-bit value. Equivalent to\r | |
17f695ed | 2893 | 1 << log2(x).\r |
ac644614 | 2894 | \r |
2895 | This function computes the value of the highest bit set in the 32-bit value\r | |
2896 | specified by Operand. If Operand is zero, then zero is returned.\r | |
2897 | \r | |
2898 | @param Operand The 32-bit operand to evaluate.\r | |
2899 | \r | |
2900 | @return 1 << HighBitSet32(Operand)\r | |
2901 | @retval 0 Operand is zero.\r | |
2902 | \r | |
2903 | **/\r | |
2904 | UINT32\r | |
2905 | EFIAPI\r | |
2906 | GetPowerOfTwo32 (\r | |
2907 | IN UINT32 Operand\r | |
2908 | );\r | |
2909 | \r | |
2910 | \r | |
2911 | /**\r | |
2912 | Returns the value of the highest bit set in a 64-bit value. Equivalent to\r | |
17f695ed | 2913 | 1 << log2(x).\r |
ac644614 | 2914 | \r |
2915 | This function computes the value of the highest bit set in the 64-bit value\r | |
2916 | specified by Operand. If Operand is zero, then zero is returned.\r | |
2917 | \r | |
2918 | @param Operand The 64-bit operand to evaluate.\r | |
2919 | \r | |
2920 | @return 1 << HighBitSet64(Operand)\r | |
2921 | @retval 0 Operand is zero.\r | |
2922 | \r | |
2923 | **/\r | |
2924 | UINT64\r | |
2925 | EFIAPI\r | |
2926 | GetPowerOfTwo64 (\r | |
2927 | IN UINT64 Operand\r | |
2928 | );\r | |
2929 | \r | |
2930 | \r | |
2931 | /**\r | |
af2dc6a7 | 2932 | Switches the endianness of a 16-bit integer.\r |
ac644614 | 2933 | \r |
2934 | This function swaps the bytes in a 16-bit unsigned value to switch the value\r | |
2935 | from little endian to big endian or vice versa. The byte swapped value is\r | |
2936 | returned.\r | |
2937 | \r | |
2a53dabf | 2938 | @param Value A 16-bit unsigned value.\r |
ac644614 | 2939 | \r |
efb23117 | 2940 | @return The byte swapped Value.\r |
ac644614 | 2941 | \r |
2942 | **/\r | |
2943 | UINT16\r | |
2944 | EFIAPI\r | |
2945 | SwapBytes16 (\r | |
2946 | IN UINT16 Value\r | |
2947 | );\r | |
2948 | \r | |
2949 | \r | |
2950 | /**\r | |
af2dc6a7 | 2951 | Switches the endianness of a 32-bit integer.\r |
ac644614 | 2952 | \r |
2953 | This function swaps the bytes in a 32-bit unsigned value to switch the value\r | |
2954 | from little endian to big endian or vice versa. The byte swapped value is\r | |
2955 | returned.\r | |
2956 | \r | |
2a53dabf | 2957 | @param Value A 32-bit unsigned value.\r |
ac644614 | 2958 | \r |
efb23117 | 2959 | @return The byte swapped Value.\r |
ac644614 | 2960 | \r |
2961 | **/\r | |
2962 | UINT32\r | |
2963 | EFIAPI\r | |
2964 | SwapBytes32 (\r | |
2965 | IN UINT32 Value\r | |
2966 | );\r | |
2967 | \r | |
2968 | \r | |
2969 | /**\r | |
af2dc6a7 | 2970 | Switches the endianness of a 64-bit integer.\r |
ac644614 | 2971 | \r |
2972 | This function swaps the bytes in a 64-bit unsigned value to switch the value\r | |
2973 | from little endian to big endian or vice versa. The byte swapped value is\r | |
2974 | returned.\r | |
2975 | \r | |
2a53dabf | 2976 | @param Value A 64-bit unsigned value.\r |
ac644614 | 2977 | \r |
efb23117 | 2978 | @return The byte swapped Value.\r |
ac644614 | 2979 | \r |
2980 | **/\r | |
2981 | UINT64\r | |
2982 | EFIAPI\r | |
2983 | SwapBytes64 (\r | |
2984 | IN UINT64 Value\r | |
2985 | );\r | |
2986 | \r | |
2987 | \r | |
2988 | /**\r | |
2989 | Multiples a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
2990 | generates a 64-bit unsigned result.\r | |
2991 | \r | |
2992 | This function multiples the 64-bit unsigned value Multiplicand by the 32-bit\r | |
2993 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
2994 | bit unsigned result is returned.\r | |
2995 | \r | |
ac644614 | 2996 | @param Multiplicand A 64-bit unsigned value.\r |
2997 | @param Multiplier A 32-bit unsigned value.\r | |
2998 | \r | |
2999 | @return Multiplicand * Multiplier\r | |
3000 | \r | |
3001 | **/\r | |
3002 | UINT64\r | |
3003 | EFIAPI\r | |
3004 | MultU64x32 (\r | |
3005 | IN UINT64 Multiplicand,\r | |
3006 | IN UINT32 Multiplier\r | |
3007 | );\r | |
3008 | \r | |
3009 | \r | |
3010 | /**\r | |
3011 | Multiples a 64-bit unsigned integer by a 64-bit unsigned integer and\r | |
3012 | generates a 64-bit unsigned result.\r | |
3013 | \r | |
3014 | This function multiples the 64-bit unsigned value Multiplicand by the 64-bit\r | |
3015 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
3016 | bit unsigned result is returned.\r | |
3017 | \r | |
ac644614 | 3018 | @param Multiplicand A 64-bit unsigned value.\r |
3019 | @param Multiplier A 64-bit unsigned value.\r | |
3020 | \r | |
af2dc6a7 | 3021 | @return Multiplicand * Multiplier.\r |
ac644614 | 3022 | \r |
3023 | **/\r | |
3024 | UINT64\r | |
3025 | EFIAPI\r | |
3026 | MultU64x64 (\r | |
3027 | IN UINT64 Multiplicand,\r | |
3028 | IN UINT64 Multiplier\r | |
3029 | );\r | |
3030 | \r | |
3031 | \r | |
3032 | /**\r | |
3033 | Multiples a 64-bit signed integer by a 64-bit signed integer and generates a\r | |
3034 | 64-bit signed result.\r | |
3035 | \r | |
3036 | This function multiples the 64-bit signed value Multiplicand by the 64-bit\r | |
3037 | signed value Multiplier and generates a 64-bit signed result. This 64-bit\r | |
3038 | signed result is returned.\r | |
3039 | \r | |
ac644614 | 3040 | @param Multiplicand A 64-bit signed value.\r |
3041 | @param Multiplier A 64-bit signed value.\r | |
3042 | \r | |
3043 | @return Multiplicand * Multiplier\r | |
3044 | \r | |
3045 | **/\r | |
3046 | INT64\r | |
3047 | EFIAPI\r | |
3048 | MultS64x64 (\r | |
3049 | IN INT64 Multiplicand,\r | |
3050 | IN INT64 Multiplier\r | |
3051 | );\r | |
3052 | \r | |
3053 | \r | |
3054 | /**\r | |
3055 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
3056 | a 64-bit unsigned result.\r | |
3057 | \r | |
3058 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
3059 | unsigned value Divisor and generates a 64-bit unsigned quotient. This\r | |
3060 | function returns the 64-bit unsigned quotient.\r | |
3061 | \r | |
3062 | If Divisor is 0, then ASSERT().\r | |
3063 | \r | |
3064 | @param Dividend A 64-bit unsigned value.\r | |
3065 | @param Divisor A 32-bit unsigned value.\r | |
3066 | \r | |
af2dc6a7 | 3067 | @return Dividend / Divisor.\r |
ac644614 | 3068 | \r |
3069 | **/\r | |
3070 | UINT64\r | |
3071 | EFIAPI\r | |
3072 | DivU64x32 (\r | |
3073 | IN UINT64 Dividend,\r | |
3074 | IN UINT32 Divisor\r | |
3075 | );\r | |
3076 | \r | |
3077 | \r | |
3078 | /**\r | |
3079 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
3080 | a 32-bit unsigned remainder.\r | |
3081 | \r | |
3082 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
3083 | unsigned value Divisor and generates a 32-bit remainder. This function\r | |
3084 | returns the 32-bit unsigned remainder.\r | |
3085 | \r | |
3086 | If Divisor is 0, then ASSERT().\r | |
3087 | \r | |
3088 | @param Dividend A 64-bit unsigned value.\r | |
3089 | @param Divisor A 32-bit unsigned value.\r | |
3090 | \r | |
af2dc6a7 | 3091 | @return Dividend % Divisor.\r |
ac644614 | 3092 | \r |
3093 | **/\r | |
3094 | UINT32\r | |
3095 | EFIAPI\r | |
3096 | ModU64x32 (\r | |
3097 | IN UINT64 Dividend,\r | |
3098 | IN UINT32 Divisor\r | |
3099 | );\r | |
3100 | \r | |
3101 | \r | |
3102 | /**\r | |
3103 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
3104 | a 64-bit unsigned result and an optional 32-bit unsigned remainder.\r | |
3105 | \r | |
3106 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
3107 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
3108 | is not NULL, then the 32-bit unsigned remainder is returned in Remainder.\r | |
3109 | This function returns the 64-bit unsigned quotient.\r | |
3110 | \r | |
3111 | If Divisor is 0, then ASSERT().\r | |
3112 | \r | |
3113 | @param Dividend A 64-bit unsigned value.\r | |
3114 | @param Divisor A 32-bit unsigned value.\r | |
3115 | @param Remainder A pointer to a 32-bit unsigned value. This parameter is\r | |
3116 | optional and may be NULL.\r | |
3117 | \r | |
af2dc6a7 | 3118 | @return Dividend / Divisor.\r |
ac644614 | 3119 | \r |
3120 | **/\r | |
3121 | UINT64\r | |
3122 | EFIAPI\r | |
3123 | DivU64x32Remainder (\r | |
3124 | IN UINT64 Dividend,\r | |
3125 | IN UINT32 Divisor,\r | |
3126 | OUT UINT32 *Remainder OPTIONAL\r | |
3127 | );\r | |
3128 | \r | |
3129 | \r | |
3130 | /**\r | |
3131 | Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates\r | |
3132 | a 64-bit unsigned result and an optional 64-bit unsigned remainder.\r | |
3133 | \r | |
3134 | This function divides the 64-bit unsigned value Dividend by the 64-bit\r | |
3135 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
3136 | is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r | |
3137 | This function returns the 64-bit unsigned quotient.\r | |
3138 | \r | |
3139 | If Divisor is 0, then ASSERT().\r | |
3140 | \r | |
3141 | @param Dividend A 64-bit unsigned value.\r | |
3142 | @param Divisor A 64-bit unsigned value.\r | |
3143 | @param Remainder A pointer to a 64-bit unsigned value. This parameter is\r | |
3144 | optional and may be NULL.\r | |
3145 | \r | |
af2dc6a7 | 3146 | @return Dividend / Divisor.\r |
ac644614 | 3147 | \r |
3148 | **/\r | |
3149 | UINT64\r | |
3150 | EFIAPI\r | |
3151 | DivU64x64Remainder (\r | |
3152 | IN UINT64 Dividend,\r | |
3153 | IN UINT64 Divisor,\r | |
3154 | OUT UINT64 *Remainder OPTIONAL\r | |
3155 | );\r | |
3156 | \r | |
3157 | \r | |
3158 | /**\r | |
3159 | Divides a 64-bit signed integer by a 64-bit signed integer and generates a\r | |
3160 | 64-bit signed result and a optional 64-bit signed remainder.\r | |
3161 | \r | |
3162 | This function divides the 64-bit signed value Dividend by the 64-bit signed\r | |
3163 | value Divisor and generates a 64-bit signed quotient. If Remainder is not\r | |
3164 | NULL, then the 64-bit signed remainder is returned in Remainder. This\r | |
3165 | function returns the 64-bit signed quotient.\r | |
3166 | \r | |
9aa049d9 | 3167 | It is the caller's responsibility to not call this function with a Divisor of 0.\r |
17f695ed | 3168 | If Divisor is 0, then the quotient and remainder should be assumed to be \r |
3169 | the largest negative integer.\r | |
3170 | \r | |
ac644614 | 3171 | If Divisor is 0, then ASSERT().\r |
3172 | \r | |
3173 | @param Dividend A 64-bit signed value.\r | |
3174 | @param Divisor A 64-bit signed value.\r | |
3175 | @param Remainder A pointer to a 64-bit signed value. This parameter is\r | |
3176 | optional and may be NULL.\r | |
3177 | \r | |
af2dc6a7 | 3178 | @return Dividend / Divisor.\r |
ac644614 | 3179 | \r |
3180 | **/\r | |
3181 | INT64\r | |
3182 | EFIAPI\r | |
3183 | DivS64x64Remainder (\r | |
3184 | IN INT64 Dividend,\r | |
3185 | IN INT64 Divisor,\r | |
3186 | OUT INT64 *Remainder OPTIONAL\r | |
3187 | );\r | |
3188 | \r | |
3189 | \r | |
3190 | /**\r | |
3191 | Reads a 16-bit value from memory that may be unaligned.\r | |
3192 | \r | |
3193 | This function returns the 16-bit value pointed to by Buffer. The function\r | |
3194 | guarantees that the read operation does not produce an alignment fault.\r | |
3195 | \r | |
3196 | If the Buffer is NULL, then ASSERT().\r | |
3197 | \r | |
af2dc6a7 | 3198 | @param Buffer The pointer to a 16-bit value that may be unaligned.\r |
ac644614 | 3199 | \r |
5385a579 | 3200 | @return The 16-bit value read from Buffer.\r |
ac644614 | 3201 | \r |
3202 | **/\r | |
3203 | UINT16\r | |
3204 | EFIAPI\r | |
3205 | ReadUnaligned16 (\r | |
5385a579 | 3206 | IN CONST UINT16 *Buffer\r |
ac644614 | 3207 | );\r |
3208 | \r | |
3209 | \r | |
3210 | /**\r | |
3211 | Writes a 16-bit value to memory that may be unaligned.\r | |
3212 | \r | |
3213 | This function writes the 16-bit value specified by Value to Buffer. Value is\r | |
3214 | returned. The function guarantees that the write operation does not produce\r | |
3215 | an alignment fault.\r | |
3216 | \r | |
3217 | If the Buffer is NULL, then ASSERT().\r | |
3218 | \r | |
af2dc6a7 | 3219 | @param Buffer The pointer to a 16-bit value that may be unaligned.\r |
ac644614 | 3220 | @param Value 16-bit value to write to Buffer.\r |
3221 | \r | |
5385a579 | 3222 | @return The 16-bit value to write to Buffer.\r |
ac644614 | 3223 | \r |
3224 | **/\r | |
3225 | UINT16\r | |
3226 | EFIAPI\r | |
3227 | WriteUnaligned16 (\r | |
5385a579 | 3228 | OUT UINT16 *Buffer,\r |
3229 | IN UINT16 Value\r | |
ac644614 | 3230 | );\r |
3231 | \r | |
3232 | \r | |
3233 | /**\r | |
3234 | Reads a 24-bit value from memory that may be unaligned.\r | |
3235 | \r | |
3236 | This function returns the 24-bit value pointed to by Buffer. The function\r | |
3237 | guarantees that the read operation does not produce an alignment fault.\r | |
3238 | \r | |
3239 | If the Buffer is NULL, then ASSERT().\r | |
3240 | \r | |
af2dc6a7 | 3241 | @param Buffer The pointer to a 24-bit value that may be unaligned.\r |
ac644614 | 3242 | \r |
5385a579 | 3243 | @return The 24-bit value read from Buffer.\r |
ac644614 | 3244 | \r |
3245 | **/\r | |
3246 | UINT32\r | |
3247 | EFIAPI\r | |
3248 | ReadUnaligned24 (\r | |
5385a579 | 3249 | IN CONST UINT32 *Buffer\r |
ac644614 | 3250 | );\r |
3251 | \r | |
3252 | \r | |
3253 | /**\r | |
3254 | Writes a 24-bit value to memory that may be unaligned.\r | |
3255 | \r | |
3256 | This function writes the 24-bit value specified by Value to Buffer. Value is\r | |
3257 | returned. The function guarantees that the write operation does not produce\r | |
3258 | an alignment fault.\r | |
3259 | \r | |
3260 | If the Buffer is NULL, then ASSERT().\r | |
3261 | \r | |
af2dc6a7 | 3262 | @param Buffer The pointer to a 24-bit value that may be unaligned.\r |
ac644614 | 3263 | @param Value 24-bit value to write to Buffer.\r |
3264 | \r | |
5385a579 | 3265 | @return The 24-bit value to write to Buffer.\r |
ac644614 | 3266 | \r |
3267 | **/\r | |
3268 | UINT32\r | |
3269 | EFIAPI\r | |
3270 | WriteUnaligned24 (\r | |
5385a579 | 3271 | OUT UINT32 *Buffer,\r |
3272 | IN UINT32 Value\r | |
ac644614 | 3273 | );\r |
3274 | \r | |
3275 | \r | |
3276 | /**\r | |
3277 | Reads a 32-bit value from memory that may be unaligned.\r | |
3278 | \r | |
3279 | This function returns the 32-bit value pointed to by Buffer. The function\r | |
3280 | guarantees that the read operation does not produce an alignment fault.\r | |
3281 | \r | |
3282 | If the Buffer is NULL, then ASSERT().\r | |
3283 | \r | |
af2dc6a7 | 3284 | @param Buffer The pointer to a 32-bit value that may be unaligned.\r |
ac644614 | 3285 | \r |
5385a579 | 3286 | @return The 32-bit value read from Buffer.\r |
ac644614 | 3287 | \r |
3288 | **/\r | |
3289 | UINT32\r | |
3290 | EFIAPI\r | |
3291 | ReadUnaligned32 (\r | |
5385a579 | 3292 | IN CONST UINT32 *Buffer\r |
ac644614 | 3293 | );\r |
3294 | \r | |
3295 | \r | |
3296 | /**\r | |
3297 | Writes a 32-bit value to memory that may be unaligned.\r | |
3298 | \r | |
3299 | This function writes the 32-bit value specified by Value to Buffer. Value is\r | |
3300 | returned. The function guarantees that the write operation does not produce\r | |
3301 | an alignment fault.\r | |
3302 | \r | |
3303 | If the Buffer is NULL, then ASSERT().\r | |
3304 | \r | |
af2dc6a7 | 3305 | @param Buffer The pointer to a 32-bit value that may be unaligned.\r |
ac644614 | 3306 | @param Value 32-bit value to write to Buffer.\r |
3307 | \r | |
5385a579 | 3308 | @return The 32-bit value to write to Buffer.\r |
ac644614 | 3309 | \r |
3310 | **/\r | |
3311 | UINT32\r | |
3312 | EFIAPI\r | |
3313 | WriteUnaligned32 (\r | |
5385a579 | 3314 | OUT UINT32 *Buffer,\r |
3315 | IN UINT32 Value\r | |
ac644614 | 3316 | );\r |
3317 | \r | |
3318 | \r | |
3319 | /**\r | |
3320 | Reads a 64-bit value from memory that may be unaligned.\r | |
3321 | \r | |
3322 | This function returns the 64-bit value pointed to by Buffer. The function\r | |
3323 | guarantees that the read operation does not produce an alignment fault.\r | |
3324 | \r | |
3325 | If the Buffer is NULL, then ASSERT().\r | |
3326 | \r | |
af2dc6a7 | 3327 | @param Buffer The pointer to a 64-bit value that may be unaligned.\r |
ac644614 | 3328 | \r |
5385a579 | 3329 | @return The 64-bit value read from Buffer.\r |
ac644614 | 3330 | \r |
3331 | **/\r | |
3332 | UINT64\r | |
3333 | EFIAPI\r | |
3334 | ReadUnaligned64 (\r | |
5385a579 | 3335 | IN CONST UINT64 *Buffer\r |
ac644614 | 3336 | );\r |
3337 | \r | |
3338 | \r | |
3339 | /**\r | |
3340 | Writes a 64-bit value to memory that may be unaligned.\r | |
3341 | \r | |
3342 | This function writes the 64-bit value specified by Value to Buffer. Value is\r | |
3343 | returned. The function guarantees that the write operation does not produce\r | |
3344 | an alignment fault.\r | |
3345 | \r | |
3346 | If the Buffer is NULL, then ASSERT().\r | |
3347 | \r | |
af2dc6a7 | 3348 | @param Buffer The pointer to a 64-bit value that may be unaligned.\r |
ac644614 | 3349 | @param Value 64-bit value to write to Buffer.\r |
3350 | \r | |
5385a579 | 3351 | @return The 64-bit value to write to Buffer.\r |
ac644614 | 3352 | \r |
3353 | **/\r | |
3354 | UINT64\r | |
3355 | EFIAPI\r | |
3356 | WriteUnaligned64 (\r | |
5385a579 | 3357 | OUT UINT64 *Buffer,\r |
3358 | IN UINT64 Value\r | |
ac644614 | 3359 | );\r |
3360 | \r | |
3361 | \r | |
3362 | //\r | |
3363 | // Bit Field Functions\r | |
3364 | //\r | |
3365 | \r | |
3366 | /**\r | |
3367 | Returns a bit field from an 8-bit value.\r | |
3368 | \r | |
3369 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
3370 | \r | |
3371 | If 8-bit operations are not supported, then ASSERT().\r | |
3372 | If StartBit is greater than 7, then ASSERT().\r | |
3373 | If EndBit is greater than 7, then ASSERT().\r | |
3374 | If EndBit is less than StartBit, then ASSERT().\r | |
3375 | \r | |
3376 | @param Operand Operand on which to perform the bitfield operation.\r | |
3377 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3378 | Range 0..7.\r | |
3379 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3380 | Range 0..7.\r | |
3381 | \r | |
3382 | @return The bit field read.\r | |
3383 | \r | |
3384 | **/\r | |
3385 | UINT8\r | |
3386 | EFIAPI\r | |
3387 | BitFieldRead8 (\r | |
3388 | IN UINT8 Operand,\r | |
3389 | IN UINTN StartBit,\r | |
3390 | IN UINTN EndBit\r | |
3391 | );\r | |
3392 | \r | |
3393 | \r | |
3394 | /**\r | |
3395 | Writes a bit field to an 8-bit value, and returns the result.\r | |
3396 | \r | |
3397 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
3398 | Operand. All other bits in Operand are preserved. The new 8-bit value is\r | |
3399 | returned.\r | |
3400 | \r | |
3401 | If 8-bit operations are not supported, then ASSERT().\r | |
3402 | If StartBit is greater than 7, then ASSERT().\r | |
3403 | If EndBit is greater than 7, then ASSERT().\r | |
3404 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3405 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3406 | \r |
3407 | @param Operand Operand on which to perform the bitfield operation.\r | |
3408 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3409 | Range 0..7.\r | |
3410 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3411 | Range 0..7.\r | |
3412 | @param Value New value of the bit field.\r | |
3413 | \r | |
3414 | @return The new 8-bit value.\r | |
3415 | \r | |
3416 | **/\r | |
3417 | UINT8\r | |
3418 | EFIAPI\r | |
3419 | BitFieldWrite8 (\r | |
3420 | IN UINT8 Operand,\r | |
3421 | IN UINTN StartBit,\r | |
3422 | IN UINTN EndBit,\r | |
3423 | IN UINT8 Value\r | |
3424 | );\r | |
3425 | \r | |
3426 | \r | |
3427 | /**\r | |
3428 | Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the\r | |
3429 | result.\r | |
3430 | \r | |
62991af2 | 3431 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 3432 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
3433 | Operand are preserved. The new 8-bit value is returned.\r | |
3434 | \r | |
3435 | If 8-bit operations are not supported, then ASSERT().\r | |
3436 | If StartBit is greater than 7, then ASSERT().\r | |
3437 | If EndBit is greater than 7, then ASSERT().\r | |
3438 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3439 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3440 | \r |
3441 | @param Operand Operand on which to perform the bitfield operation.\r | |
3442 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3443 | Range 0..7.\r | |
3444 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3445 | Range 0..7.\r | |
3446 | @param OrData The value to OR with the read value from the value\r | |
3447 | \r | |
3448 | @return The new 8-bit value.\r | |
3449 | \r | |
3450 | **/\r | |
3451 | UINT8\r | |
3452 | EFIAPI\r | |
3453 | BitFieldOr8 (\r | |
3454 | IN UINT8 Operand,\r | |
3455 | IN UINTN StartBit,\r | |
3456 | IN UINTN EndBit,\r | |
3457 | IN UINT8 OrData\r | |
3458 | );\r | |
3459 | \r | |
3460 | \r | |
3461 | /**\r | |
3462 | Reads a bit field from an 8-bit value, performs a bitwise AND, and returns\r | |
3463 | the result.\r | |
3464 | \r | |
3465 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
3466 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
3467 | preserved. The new 8-bit value is returned.\r | |
3468 | \r | |
3469 | If 8-bit operations are not supported, then ASSERT().\r | |
3470 | If StartBit is greater than 7, then ASSERT().\r | |
3471 | If EndBit is greater than 7, then ASSERT().\r | |
3472 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3473 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3474 | \r |
3475 | @param Operand Operand on which to perform the bitfield operation.\r | |
3476 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3477 | Range 0..7.\r | |
3478 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3479 | Range 0..7.\r | |
3480 | @param AndData The value to AND with the read value from the value.\r | |
3481 | \r | |
3482 | @return The new 8-bit value.\r | |
3483 | \r | |
3484 | **/\r | |
3485 | UINT8\r | |
3486 | EFIAPI\r | |
3487 | BitFieldAnd8 (\r | |
3488 | IN UINT8 Operand,\r | |
3489 | IN UINTN StartBit,\r | |
3490 | IN UINTN EndBit,\r | |
3491 | IN UINT8 AndData\r | |
3492 | );\r | |
3493 | \r | |
3494 | \r | |
3495 | /**\r | |
3496 | Reads a bit field from an 8-bit value, performs a bitwise AND followed by a\r | |
3497 | bitwise OR, and returns the result.\r | |
3498 | \r | |
3499 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 3500 | in Operand and the value specified by AndData, followed by a bitwise \r |
3501 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 3502 | preserved. The new 8-bit value is returned.\r |
3503 | \r | |
3504 | If 8-bit operations are not supported, then ASSERT().\r | |
3505 | If StartBit is greater than 7, then ASSERT().\r | |
3506 | If EndBit is greater than 7, then ASSERT().\r | |
3507 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
3508 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
3509 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 3510 | \r |
3511 | @param Operand Operand on which to perform the bitfield operation.\r | |
3512 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3513 | Range 0..7.\r | |
3514 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3515 | Range 0..7.\r | |
3516 | @param AndData The value to AND with the read value from the value.\r | |
3517 | @param OrData The value to OR with the result of the AND operation.\r | |
3518 | \r | |
3519 | @return The new 8-bit value.\r | |
3520 | \r | |
3521 | **/\r | |
3522 | UINT8\r | |
3523 | EFIAPI\r | |
3524 | BitFieldAndThenOr8 (\r | |
3525 | IN UINT8 Operand,\r | |
3526 | IN UINTN StartBit,\r | |
3527 | IN UINTN EndBit,\r | |
3528 | IN UINT8 AndData,\r | |
3529 | IN UINT8 OrData\r | |
3530 | );\r | |
3531 | \r | |
3532 | \r | |
3533 | /**\r | |
3534 | Returns a bit field from a 16-bit value.\r | |
3535 | \r | |
3536 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
3537 | \r | |
3538 | If 16-bit operations are not supported, then ASSERT().\r | |
3539 | If StartBit is greater than 15, then ASSERT().\r | |
3540 | If EndBit is greater than 15, then ASSERT().\r | |
3541 | If EndBit is less than StartBit, then ASSERT().\r | |
3542 | \r | |
3543 | @param Operand Operand on which to perform the bitfield operation.\r | |
3544 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3545 | Range 0..15.\r | |
3546 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3547 | Range 0..15.\r | |
3548 | \r | |
3549 | @return The bit field read.\r | |
3550 | \r | |
3551 | **/\r | |
3552 | UINT16\r | |
3553 | EFIAPI\r | |
3554 | BitFieldRead16 (\r | |
3555 | IN UINT16 Operand,\r | |
3556 | IN UINTN StartBit,\r | |
3557 | IN UINTN EndBit\r | |
3558 | );\r | |
3559 | \r | |
3560 | \r | |
3561 | /**\r | |
3562 | Writes a bit field to a 16-bit value, and returns the result.\r | |
3563 | \r | |
3564 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
3565 | Operand. All other bits in Operand are preserved. The new 16-bit value is\r | |
3566 | returned.\r | |
3567 | \r | |
3568 | If 16-bit operations are not supported, then ASSERT().\r | |
3569 | If StartBit is greater than 15, then ASSERT().\r | |
3570 | If EndBit is greater than 15, then ASSERT().\r | |
3571 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3572 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3573 | \r |
3574 | @param Operand Operand on which to perform the bitfield operation.\r | |
3575 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3576 | Range 0..15.\r | |
3577 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3578 | Range 0..15.\r | |
3579 | @param Value New value of the bit field.\r | |
3580 | \r | |
3581 | @return The new 16-bit value.\r | |
3582 | \r | |
3583 | **/\r | |
3584 | UINT16\r | |
3585 | EFIAPI\r | |
3586 | BitFieldWrite16 (\r | |
3587 | IN UINT16 Operand,\r | |
3588 | IN UINTN StartBit,\r | |
3589 | IN UINTN EndBit,\r | |
3590 | IN UINT16 Value\r | |
3591 | );\r | |
3592 | \r | |
3593 | \r | |
3594 | /**\r | |
3595 | Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the\r | |
3596 | result.\r | |
3597 | \r | |
62991af2 | 3598 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 3599 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
3600 | Operand are preserved. The new 16-bit value is returned.\r | |
3601 | \r | |
3602 | If 16-bit operations are not supported, then ASSERT().\r | |
3603 | If StartBit is greater than 15, then ASSERT().\r | |
3604 | If EndBit is greater than 15, then ASSERT().\r | |
3605 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3606 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3607 | \r |
3608 | @param Operand Operand on which to perform the bitfield operation.\r | |
3609 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3610 | Range 0..15.\r | |
3611 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3612 | Range 0..15.\r | |
3613 | @param OrData The value to OR with the read value from the value\r | |
3614 | \r | |
3615 | @return The new 16-bit value.\r | |
3616 | \r | |
3617 | **/\r | |
3618 | UINT16\r | |
3619 | EFIAPI\r | |
3620 | BitFieldOr16 (\r | |
3621 | IN UINT16 Operand,\r | |
3622 | IN UINTN StartBit,\r | |
3623 | IN UINTN EndBit,\r | |
3624 | IN UINT16 OrData\r | |
3625 | );\r | |
3626 | \r | |
3627 | \r | |
3628 | /**\r | |
3629 | Reads a bit field from a 16-bit value, performs a bitwise AND, and returns\r | |
3630 | the result.\r | |
3631 | \r | |
3632 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
3633 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
3634 | preserved. The new 16-bit value is returned.\r | |
3635 | \r | |
3636 | If 16-bit operations are not supported, then ASSERT().\r | |
3637 | If StartBit is greater than 15, then ASSERT().\r | |
3638 | If EndBit is greater than 15, then ASSERT().\r | |
3639 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3640 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3641 | \r |
3642 | @param Operand Operand on which to perform the bitfield operation.\r | |
3643 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3644 | Range 0..15.\r | |
3645 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3646 | Range 0..15.\r | |
3647 | @param AndData The value to AND with the read value from the value\r | |
3648 | \r | |
3649 | @return The new 16-bit value.\r | |
3650 | \r | |
3651 | **/\r | |
3652 | UINT16\r | |
3653 | EFIAPI\r | |
3654 | BitFieldAnd16 (\r | |
3655 | IN UINT16 Operand,\r | |
3656 | IN UINTN StartBit,\r | |
3657 | IN UINTN EndBit,\r | |
3658 | IN UINT16 AndData\r | |
3659 | );\r | |
3660 | \r | |
3661 | \r | |
3662 | /**\r | |
3663 | Reads a bit field from a 16-bit value, performs a bitwise AND followed by a\r | |
3664 | bitwise OR, and returns the result.\r | |
3665 | \r | |
3666 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 3667 | in Operand and the value specified by AndData, followed by a bitwise \r |
3668 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 3669 | preserved. The new 16-bit value is returned.\r |
3670 | \r | |
3671 | If 16-bit operations are not supported, then ASSERT().\r | |
3672 | If StartBit is greater than 15, then ASSERT().\r | |
3673 | If EndBit is greater than 15, then ASSERT().\r | |
3674 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
3675 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
3676 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 3677 | \r |
3678 | @param Operand Operand on which to perform the bitfield operation.\r | |
3679 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3680 | Range 0..15.\r | |
3681 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3682 | Range 0..15.\r | |
3683 | @param AndData The value to AND with the read value from the value.\r | |
3684 | @param OrData The value to OR with the result of the AND operation.\r | |
3685 | \r | |
3686 | @return The new 16-bit value.\r | |
3687 | \r | |
3688 | **/\r | |
3689 | UINT16\r | |
3690 | EFIAPI\r | |
3691 | BitFieldAndThenOr16 (\r | |
3692 | IN UINT16 Operand,\r | |
3693 | IN UINTN StartBit,\r | |
3694 | IN UINTN EndBit,\r | |
3695 | IN UINT16 AndData,\r | |
3696 | IN UINT16 OrData\r | |
3697 | );\r | |
3698 | \r | |
3699 | \r | |
3700 | /**\r | |
3701 | Returns a bit field from a 32-bit value.\r | |
3702 | \r | |
3703 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
3704 | \r | |
3705 | If 32-bit operations are not supported, then ASSERT().\r | |
3706 | If StartBit is greater than 31, then ASSERT().\r | |
3707 | If EndBit is greater than 31, then ASSERT().\r | |
3708 | If EndBit is less than StartBit, then ASSERT().\r | |
3709 | \r | |
3710 | @param Operand Operand on which to perform the bitfield operation.\r | |
3711 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3712 | Range 0..31.\r | |
3713 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3714 | Range 0..31.\r | |
3715 | \r | |
3716 | @return The bit field read.\r | |
3717 | \r | |
3718 | **/\r | |
3719 | UINT32\r | |
3720 | EFIAPI\r | |
3721 | BitFieldRead32 (\r | |
3722 | IN UINT32 Operand,\r | |
3723 | IN UINTN StartBit,\r | |
3724 | IN UINTN EndBit\r | |
3725 | );\r | |
3726 | \r | |
3727 | \r | |
3728 | /**\r | |
3729 | Writes a bit field to a 32-bit value, and returns the result.\r | |
3730 | \r | |
3731 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
3732 | Operand. All other bits in Operand are preserved. The new 32-bit value is\r | |
3733 | returned.\r | |
3734 | \r | |
3735 | If 32-bit operations are not supported, then ASSERT().\r | |
3736 | If StartBit is greater than 31, then ASSERT().\r | |
3737 | If EndBit is greater than 31, then ASSERT().\r | |
3738 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3739 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3740 | \r |
3741 | @param Operand Operand on which to perform the bitfield operation.\r | |
3742 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3743 | Range 0..31.\r | |
3744 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3745 | Range 0..31.\r | |
3746 | @param Value New value of the bit field.\r | |
3747 | \r | |
3748 | @return The new 32-bit value.\r | |
3749 | \r | |
3750 | **/\r | |
3751 | UINT32\r | |
3752 | EFIAPI\r | |
3753 | BitFieldWrite32 (\r | |
3754 | IN UINT32 Operand,\r | |
3755 | IN UINTN StartBit,\r | |
3756 | IN UINTN EndBit,\r | |
3757 | IN UINT32 Value\r | |
3758 | );\r | |
3759 | \r | |
3760 | \r | |
3761 | /**\r | |
3762 | Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the\r | |
3763 | result.\r | |
3764 | \r | |
62991af2 | 3765 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 3766 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
3767 | Operand are preserved. The new 32-bit value is returned.\r | |
3768 | \r | |
3769 | If 32-bit operations are not supported, then ASSERT().\r | |
3770 | If StartBit is greater than 31, then ASSERT().\r | |
3771 | If EndBit is greater than 31, then ASSERT().\r | |
3772 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3773 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3774 | \r |
3775 | @param Operand Operand on which to perform the bitfield operation.\r | |
3776 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3777 | Range 0..31.\r | |
3778 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3779 | Range 0..31.\r | |
af2dc6a7 | 3780 | @param OrData The value to OR with the read value from the value.\r |
ac644614 | 3781 | \r |
3782 | @return The new 32-bit value.\r | |
3783 | \r | |
3784 | **/\r | |
3785 | UINT32\r | |
3786 | EFIAPI\r | |
3787 | BitFieldOr32 (\r | |
3788 | IN UINT32 Operand,\r | |
3789 | IN UINTN StartBit,\r | |
3790 | IN UINTN EndBit,\r | |
3791 | IN UINT32 OrData\r | |
3792 | );\r | |
3793 | \r | |
3794 | \r | |
3795 | /**\r | |
3796 | Reads a bit field from a 32-bit value, performs a bitwise AND, and returns\r | |
3797 | the result.\r | |
3798 | \r | |
3799 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
3800 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
3801 | preserved. The new 32-bit value is returned.\r | |
3802 | \r | |
3803 | If 32-bit operations are not supported, then ASSERT().\r | |
3804 | If StartBit is greater than 31, then ASSERT().\r | |
3805 | If EndBit is greater than 31, then ASSERT().\r | |
3806 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3807 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3808 | \r |
3809 | @param Operand Operand on which to perform the bitfield operation.\r | |
3810 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3811 | Range 0..31.\r | |
3812 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3813 | Range 0..31.\r | |
3814 | @param AndData The value to AND with the read value from the value\r | |
3815 | \r | |
3816 | @return The new 32-bit value.\r | |
3817 | \r | |
3818 | **/\r | |
3819 | UINT32\r | |
3820 | EFIAPI\r | |
3821 | BitFieldAnd32 (\r | |
3822 | IN UINT32 Operand,\r | |
3823 | IN UINTN StartBit,\r | |
3824 | IN UINTN EndBit,\r | |
3825 | IN UINT32 AndData\r | |
3826 | );\r | |
3827 | \r | |
3828 | \r | |
3829 | /**\r | |
3830 | Reads a bit field from a 32-bit value, performs a bitwise AND followed by a\r | |
3831 | bitwise OR, and returns the result.\r | |
3832 | \r | |
3833 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 3834 | in Operand and the value specified by AndData, followed by a bitwise \r |
3835 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 3836 | preserved. The new 32-bit value is returned.\r |
3837 | \r | |
3838 | If 32-bit operations are not supported, then ASSERT().\r | |
3839 | If StartBit is greater than 31, then ASSERT().\r | |
3840 | If EndBit is greater than 31, then ASSERT().\r | |
3841 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
3842 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
3843 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 3844 | \r |
3845 | @param Operand Operand on which to perform the bitfield operation.\r | |
3846 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3847 | Range 0..31.\r | |
3848 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3849 | Range 0..31.\r | |
3850 | @param AndData The value to AND with the read value from the value.\r | |
3851 | @param OrData The value to OR with the result of the AND operation.\r | |
3852 | \r | |
3853 | @return The new 32-bit value.\r | |
3854 | \r | |
3855 | **/\r | |
3856 | UINT32\r | |
3857 | EFIAPI\r | |
3858 | BitFieldAndThenOr32 (\r | |
3859 | IN UINT32 Operand,\r | |
3860 | IN UINTN StartBit,\r | |
3861 | IN UINTN EndBit,\r | |
3862 | IN UINT32 AndData,\r | |
3863 | IN UINT32 OrData\r | |
3864 | );\r | |
3865 | \r | |
3866 | \r | |
3867 | /**\r | |
3868 | Returns a bit field from a 64-bit value.\r | |
3869 | \r | |
3870 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
3871 | \r | |
3872 | If 64-bit operations are not supported, then ASSERT().\r | |
3873 | If StartBit is greater than 63, then ASSERT().\r | |
3874 | If EndBit is greater than 63, then ASSERT().\r | |
3875 | If EndBit is less than StartBit, then ASSERT().\r | |
3876 | \r | |
3877 | @param Operand Operand on which to perform the bitfield operation.\r | |
3878 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3879 | Range 0..63.\r | |
3880 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3881 | Range 0..63.\r | |
3882 | \r | |
3883 | @return The bit field read.\r | |
3884 | \r | |
3885 | **/\r | |
3886 | UINT64\r | |
3887 | EFIAPI\r | |
3888 | BitFieldRead64 (\r | |
3889 | IN UINT64 Operand,\r | |
3890 | IN UINTN StartBit,\r | |
3891 | IN UINTN EndBit\r | |
3892 | );\r | |
3893 | \r | |
3894 | \r | |
3895 | /**\r | |
3896 | Writes a bit field to a 64-bit value, and returns the result.\r | |
3897 | \r | |
3898 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
3899 | Operand. All other bits in Operand are preserved. The new 64-bit value is\r | |
3900 | returned.\r | |
3901 | \r | |
3902 | If 64-bit operations are not supported, then ASSERT().\r | |
3903 | If StartBit is greater than 63, then ASSERT().\r | |
3904 | If EndBit is greater than 63, then ASSERT().\r | |
3905 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3906 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3907 | \r |
3908 | @param Operand Operand on which to perform the bitfield operation.\r | |
3909 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3910 | Range 0..63.\r | |
3911 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3912 | Range 0..63.\r | |
3913 | @param Value New value of the bit field.\r | |
3914 | \r | |
3915 | @return The new 64-bit value.\r | |
3916 | \r | |
3917 | **/\r | |
3918 | UINT64\r | |
3919 | EFIAPI\r | |
3920 | BitFieldWrite64 (\r | |
3921 | IN UINT64 Operand,\r | |
3922 | IN UINTN StartBit,\r | |
3923 | IN UINTN EndBit,\r | |
3924 | IN UINT64 Value\r | |
3925 | );\r | |
3926 | \r | |
3927 | \r | |
3928 | /**\r | |
3929 | Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the\r | |
3930 | result.\r | |
3931 | \r | |
62991af2 | 3932 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 3933 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
3934 | Operand are preserved. The new 64-bit value is returned.\r | |
3935 | \r | |
3936 | If 64-bit operations are not supported, then ASSERT().\r | |
3937 | If StartBit is greater than 63, then ASSERT().\r | |
3938 | If EndBit is greater than 63, then ASSERT().\r | |
3939 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3940 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3941 | \r |
3942 | @param Operand Operand on which to perform the bitfield operation.\r | |
3943 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3944 | Range 0..63.\r | |
3945 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3946 | Range 0..63.\r | |
3947 | @param OrData The value to OR with the read value from the value\r | |
3948 | \r | |
3949 | @return The new 64-bit value.\r | |
3950 | \r | |
3951 | **/\r | |
3952 | UINT64\r | |
3953 | EFIAPI\r | |
3954 | BitFieldOr64 (\r | |
3955 | IN UINT64 Operand,\r | |
3956 | IN UINTN StartBit,\r | |
3957 | IN UINTN EndBit,\r | |
3958 | IN UINT64 OrData\r | |
3959 | );\r | |
3960 | \r | |
3961 | \r | |
3962 | /**\r | |
3963 | Reads a bit field from a 64-bit value, performs a bitwise AND, and returns\r | |
3964 | the result.\r | |
3965 | \r | |
3966 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
3967 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
3968 | preserved. The new 64-bit value is returned.\r | |
3969 | \r | |
3970 | If 64-bit operations are not supported, then ASSERT().\r | |
3971 | If StartBit is greater than 63, then ASSERT().\r | |
3972 | If EndBit is greater than 63, then ASSERT().\r | |
3973 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3974 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3975 | \r |
3976 | @param Operand Operand on which to perform the bitfield operation.\r | |
3977 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3978 | Range 0..63.\r | |
3979 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3980 | Range 0..63.\r | |
3981 | @param AndData The value to AND with the read value from the value\r | |
3982 | \r | |
3983 | @return The new 64-bit value.\r | |
3984 | \r | |
3985 | **/\r | |
3986 | UINT64\r | |
3987 | EFIAPI\r | |
3988 | BitFieldAnd64 (\r | |
3989 | IN UINT64 Operand,\r | |
3990 | IN UINTN StartBit,\r | |
3991 | IN UINTN EndBit,\r | |
3992 | IN UINT64 AndData\r | |
3993 | );\r | |
3994 | \r | |
3995 | \r | |
3996 | /**\r | |
3997 | Reads a bit field from a 64-bit value, performs a bitwise AND followed by a\r | |
3998 | bitwise OR, and returns the result.\r | |
3999 | \r | |
4000 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 4001 | in Operand and the value specified by AndData, followed by a bitwise \r |
4002 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 4003 | preserved. The new 64-bit value is returned.\r |
4004 | \r | |
4005 | If 64-bit operations are not supported, then ASSERT().\r | |
4006 | If StartBit is greater than 63, then ASSERT().\r | |
4007 | If EndBit is greater than 63, then ASSERT().\r | |
4008 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
4009 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
4010 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 4011 | \r |
4012 | @param Operand Operand on which to perform the bitfield operation.\r | |
4013 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
4014 | Range 0..63.\r | |
4015 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
4016 | Range 0..63.\r | |
4017 | @param AndData The value to AND with the read value from the value.\r | |
4018 | @param OrData The value to OR with the result of the AND operation.\r | |
4019 | \r | |
4020 | @return The new 64-bit value.\r | |
4021 | \r | |
4022 | **/\r | |
4023 | UINT64\r | |
4024 | EFIAPI\r | |
4025 | BitFieldAndThenOr64 (\r | |
4026 | IN UINT64 Operand,\r | |
4027 | IN UINTN StartBit,\r | |
4028 | IN UINTN EndBit,\r | |
4029 | IN UINT64 AndData,\r | |
4030 | IN UINT64 OrData\r | |
4031 | );\r | |
4032 | \r | |
ac644614 | 4033 | //\r |
4034 | // Base Library Checksum Functions\r | |
4035 | //\r | |
4036 | \r | |
4037 | /**\r | |
17f695ed | 4038 | Returns the sum of all elements in a buffer in unit of UINT8.\r |
ac644614 | 4039 | During calculation, the carry bits are dropped.\r |
4040 | \r | |
4041 | This function calculates the sum of all elements in a buffer\r | |
4042 | in unit of UINT8. The carry bits in result of addition are dropped.\r | |
4043 | The result is returned as UINT8. If Length is Zero, then Zero is\r | |
4044 | returned.\r | |
4045 | \r | |
4046 | If Buffer is NULL, then ASSERT().\r | |
4047 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4048 | \r | |
af2dc6a7 | 4049 | @param Buffer The pointer to the buffer to carry out the sum operation.\r |
17f695ed | 4050 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4051 | \r |
4052 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
4053 | \r | |
4054 | **/\r | |
4055 | UINT8\r | |
4056 | EFIAPI\r | |
4057 | CalculateSum8 (\r | |
ee6c452c | 4058 | IN CONST UINT8 *Buffer,\r |
4059 | IN UINTN Length\r | |
ac644614 | 4060 | );\r |
4061 | \r | |
4062 | \r | |
4063 | /**\r | |
4064 | Returns the two's complement checksum of all elements in a buffer\r | |
4065 | of 8-bit values.\r | |
4066 | \r | |
4067 | This function first calculates the sum of the 8-bit values in the\r | |
4068 | buffer specified by Buffer and Length. The carry bits in the result\r | |
4069 | of addition are dropped. Then, the two's complement of the sum is\r | |
4070 | returned. If Length is 0, then 0 is returned.\r | |
4071 | \r | |
4072 | If Buffer is NULL, then ASSERT().\r | |
4073 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4074 | \r | |
af2dc6a7 | 4075 | @param Buffer The pointer to the buffer to carry out the checksum operation.\r |
1106ffe1 | 4076 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4077 | \r |
af2dc6a7 | 4078 | @return Checksum The two's complement checksum of Buffer.\r |
ac644614 | 4079 | \r |
4080 | **/\r | |
4081 | UINT8\r | |
4082 | EFIAPI\r | |
4083 | CalculateCheckSum8 (\r | |
ee6c452c | 4084 | IN CONST UINT8 *Buffer,\r |
4085 | IN UINTN Length\r | |
ac644614 | 4086 | );\r |
4087 | \r | |
4088 | \r | |
4089 | /**\r | |
4090 | Returns the sum of all elements in a buffer of 16-bit values. During\r | |
4091 | calculation, the carry bits are dropped.\r | |
4092 | \r | |
4093 | This function calculates the sum of the 16-bit values in the buffer\r | |
4094 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
4095 | The 16-bit result is returned. If Length is 0, then 0 is returned.\r | |
4096 | \r | |
4097 | If Buffer is NULL, then ASSERT().\r | |
4098 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
4099 | If Length is not aligned on a 16-bit boundary, then ASSERT().\r | |
4100 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4101 | \r | |
af2dc6a7 | 4102 | @param Buffer The pointer to the buffer to carry out the sum operation.\r |
1106ffe1 | 4103 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4104 | \r |
4105 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
4106 | \r | |
4107 | **/\r | |
4108 | UINT16\r | |
4109 | EFIAPI\r | |
4110 | CalculateSum16 (\r | |
ee6c452c | 4111 | IN CONST UINT16 *Buffer,\r |
4112 | IN UINTN Length\r | |
ac644614 | 4113 | );\r |
4114 | \r | |
4115 | \r | |
4116 | /**\r | |
4117 | Returns the two's complement checksum of all elements in a buffer of\r | |
4118 | 16-bit values.\r | |
4119 | \r | |
4120 | This function first calculates the sum of the 16-bit values in the buffer\r | |
4121 | specified by Buffer and Length. The carry bits in the result of addition\r | |
4122 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
4123 | is 0, then 0 is returned.\r | |
4124 | \r | |
4125 | If Buffer is NULL, then ASSERT().\r | |
4126 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
4127 | If Length is not aligned on a 16-bit boundary, then ASSERT().\r | |
4128 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4129 | \r | |
af2dc6a7 | 4130 | @param Buffer The pointer to the buffer to carry out the checksum operation.\r |
1106ffe1 | 4131 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4132 | \r |
af2dc6a7 | 4133 | @return Checksum The two's complement checksum of Buffer.\r |
ac644614 | 4134 | \r |
4135 | **/\r | |
4136 | UINT16\r | |
4137 | EFIAPI\r | |
4138 | CalculateCheckSum16 (\r | |
ee6c452c | 4139 | IN CONST UINT16 *Buffer,\r |
4140 | IN UINTN Length\r | |
ac644614 | 4141 | );\r |
4142 | \r | |
4143 | \r | |
4144 | /**\r | |
17f695ed | 4145 | Returns the sum of all elements in a buffer of 32-bit values. During\r |
ac644614 | 4146 | calculation, the carry bits are dropped.\r |
4147 | \r | |
4148 | This function calculates the sum of the 32-bit values in the buffer\r | |
4149 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
17f695ed | 4150 | The 32-bit result is returned. If Length is 0, then 0 is returned.\r |
ac644614 | 4151 | \r |
4152 | If Buffer is NULL, then ASSERT().\r | |
4153 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
4154 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
4155 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4156 | \r | |
af2dc6a7 | 4157 | @param Buffer The pointer to the buffer to carry out the sum operation.\r |
1106ffe1 | 4158 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4159 | \r |
4160 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
4161 | \r | |
4162 | **/\r | |
4163 | UINT32\r | |
4164 | EFIAPI\r | |
4165 | CalculateSum32 (\r | |
ee6c452c | 4166 | IN CONST UINT32 *Buffer,\r |
4167 | IN UINTN Length\r | |
ac644614 | 4168 | );\r |
4169 | \r | |
4170 | \r | |
4171 | /**\r | |
4172 | Returns the two's complement checksum of all elements in a buffer of\r | |
4173 | 32-bit values.\r | |
4174 | \r | |
4175 | This function first calculates the sum of the 32-bit values in the buffer\r | |
4176 | specified by Buffer and Length. The carry bits in the result of addition\r | |
4177 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
4178 | is 0, then 0 is returned.\r | |
4179 | \r | |
4180 | If Buffer is NULL, then ASSERT().\r | |
4181 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
4182 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
4183 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4184 | \r | |
af2dc6a7 | 4185 | @param Buffer The pointer to the buffer to carry out the checksum operation.\r |
1106ffe1 | 4186 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4187 | \r |
af2dc6a7 | 4188 | @return Checksum The two's complement checksum of Buffer.\r |
ac644614 | 4189 | \r |
4190 | **/\r | |
4191 | UINT32\r | |
4192 | EFIAPI\r | |
4193 | CalculateCheckSum32 (\r | |
ee6c452c | 4194 | IN CONST UINT32 *Buffer,\r |
4195 | IN UINTN Length\r | |
ac644614 | 4196 | );\r |
4197 | \r | |
4198 | \r | |
4199 | /**\r | |
4200 | Returns the sum of all elements in a buffer of 64-bit values. During\r | |
4201 | calculation, the carry bits are dropped.\r | |
4202 | \r | |
4203 | This function calculates the sum of the 64-bit values in the buffer\r | |
4204 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
4205 | The 64-bit result is returned. If Length is 0, then 0 is returned.\r | |
4206 | \r | |
4207 | If Buffer is NULL, then ASSERT().\r | |
4208 | If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r | |
4209 | If Length is not aligned on a 64-bit boundary, then ASSERT().\r | |
4210 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4211 | \r | |
af2dc6a7 | 4212 | @param Buffer The pointer to the buffer to carry out the sum operation.\r |
1106ffe1 | 4213 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4214 | \r |
4215 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
4216 | \r | |
4217 | **/\r | |
4218 | UINT64\r | |
4219 | EFIAPI\r | |
4220 | CalculateSum64 (\r | |
ee6c452c | 4221 | IN CONST UINT64 *Buffer,\r |
4222 | IN UINTN Length\r | |
ac644614 | 4223 | );\r |
4224 | \r | |
4225 | \r | |
4226 | /**\r | |
4227 | Returns the two's complement checksum of all elements in a buffer of\r | |
4228 | 64-bit values.\r | |
4229 | \r | |
4230 | This function first calculates the sum of the 64-bit values in the buffer\r | |
4231 | specified by Buffer and Length. The carry bits in the result of addition\r | |
4232 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
4233 | is 0, then 0 is returned.\r | |
4234 | \r | |
4235 | If Buffer is NULL, then ASSERT().\r | |
4236 | If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r | |
4237 | If Length is not aligned on a 64-bit boundary, then ASSERT().\r | |
4238 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4239 | \r | |
af2dc6a7 | 4240 | @param Buffer The pointer to the buffer to carry out the checksum operation.\r |
1106ffe1 | 4241 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4242 | \r |
af2dc6a7 | 4243 | @return Checksum The two's complement checksum of Buffer.\r |
ac644614 | 4244 | \r |
4245 | **/\r | |
4246 | UINT64\r | |
4247 | EFIAPI\r | |
4248 | CalculateCheckSum64 (\r | |
ee6c452c | 4249 | IN CONST UINT64 *Buffer,\r |
4250 | IN UINTN Length\r | |
ac644614 | 4251 | );\r |
4252 | \r | |
4253 | \r | |
d75f9fc2 | 4254 | //\r |
4255 | // Base Library CPU Functions\r | |
4256 | //\r | |
4257 | \r | |
4258 | /**\r | |
4259 | Function entry point used when a stack switch is requested with SwitchStack()\r | |
4260 | \r | |
4261 | @param Context1 Context1 parameter passed into SwitchStack().\r | |
4262 | @param Context2 Context2 parameter passed into SwitchStack().\r | |
4263 | \r | |
4264 | **/\r | |
ac644614 | 4265 | typedef\r |
4266 | VOID\r | |
9810cdd8 | 4267 | (EFIAPI *SWITCH_STACK_ENTRY_POINT)(\r |
ac644614 | 4268 | IN VOID *Context1, OPTIONAL\r |
4269 | IN VOID *Context2 OPTIONAL\r | |
4270 | );\r | |
4271 | \r | |
4272 | \r | |
4273 | /**\r | |
4274 | Used to serialize load and store operations.\r | |
4275 | \r | |
4276 | All loads and stores that proceed calls to this function are guaranteed to be\r | |
4277 | globally visible when this function returns.\r | |
4278 | \r | |
4279 | **/\r | |
4280 | VOID\r | |
4281 | EFIAPI\r | |
4282 | MemoryFence (\r | |
4283 | VOID\r | |
4284 | );\r | |
4285 | \r | |
4286 | \r | |
4287 | /**\r | |
4288 | Saves the current CPU context that can be restored with a call to LongJump()\r | |
4289 | and returns 0.\r | |
4290 | \r | |
4291 | Saves the current CPU context in the buffer specified by JumpBuffer and\r | |
4292 | returns 0. The initial call to SetJump() must always return 0. Subsequent\r | |
4293 | calls to LongJump() cause a non-zero value to be returned by SetJump().\r | |
4294 | \r | |
4295 | If JumpBuffer is NULL, then ASSERT().\r | |
1a2f870c | 4296 | For Itanium processors, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r |
17f695ed | 4297 | \r |
4298 | NOTE: The structure BASE_LIBRARY_JUMP_BUFFER is CPU architecture specific.\r | |
4299 | The same structure must never be used for more than one CPU architecture context.\r | |
4300 | For example, a BASE_LIBRARY_JUMP_BUFFER allocated by an IA-32 module must never be used from an x64 module. \r | |
4301 | SetJump()/LongJump() is not currently supported for the EBC processor type. \r | |
ac644614 | 4302 | \r |
4303 | @param JumpBuffer A pointer to CPU context buffer.\r | |
4304 | \r | |
4305 | @retval 0 Indicates a return from SetJump().\r | |
4306 | \r | |
4307 | **/\r | |
4308 | UINTN\r | |
4309 | EFIAPI\r | |
4310 | SetJump (\r | |
4311 | OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r | |
4312 | );\r | |
4313 | \r | |
4314 | \r | |
4315 | /**\r | |
4316 | Restores the CPU context that was saved with SetJump().\r | |
4317 | \r | |
4318 | Restores the CPU context from the buffer specified by JumpBuffer. This\r | |
4319 | function never returns to the caller. Instead is resumes execution based on\r | |
4320 | the state of JumpBuffer.\r | |
4321 | \r | |
4322 | If JumpBuffer is NULL, then ASSERT().\r | |
1a2f870c | 4323 | For Itanium processors, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r |
ac644614 | 4324 | If Value is 0, then ASSERT().\r |
4325 | \r | |
4326 | @param JumpBuffer A pointer to CPU context buffer.\r | |
4327 | @param Value The value to return when the SetJump() context is\r | |
4328 | restored and must be non-zero.\r | |
4329 | \r | |
4330 | **/\r | |
4331 | VOID\r | |
4332 | EFIAPI\r | |
4333 | LongJump (\r | |
4334 | IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,\r | |
4335 | IN UINTN Value\r | |
4336 | );\r | |
4337 | \r | |
4338 | \r | |
4339 | /**\r | |
4340 | Enables CPU interrupts.\r | |
4341 | \r | |
ac644614 | 4342 | **/\r |
4343 | VOID\r | |
4344 | EFIAPI\r | |
4345 | EnableInterrupts (\r | |
4346 | VOID\r | |
4347 | );\r | |
4348 | \r | |
4349 | \r | |
4350 | /**\r | |
4351 | Disables CPU interrupts.\r | |
4352 | \r | |
ac644614 | 4353 | **/\r |
4354 | VOID\r | |
4355 | EFIAPI\r | |
4356 | DisableInterrupts (\r | |
4357 | VOID\r | |
4358 | );\r | |
4359 | \r | |
4360 | \r | |
4361 | /**\r | |
4362 | Disables CPU interrupts and returns the interrupt state prior to the disable\r | |
4363 | operation.\r | |
4364 | \r | |
ac644614 | 4365 | @retval TRUE CPU interrupts were enabled on entry to this call.\r |
4366 | @retval FALSE CPU interrupts were disabled on entry to this call.\r | |
4367 | \r | |
4368 | **/\r | |
4369 | BOOLEAN\r | |
4370 | EFIAPI\r | |
4371 | SaveAndDisableInterrupts (\r | |
4372 | VOID\r | |
4373 | );\r | |
4374 | \r | |
4375 | \r | |
4376 | /**\r | |
4377 | Enables CPU interrupts for the smallest window required to capture any\r | |
4378 | pending interrupts.\r | |
4379 | \r | |
ac644614 | 4380 | **/\r |
4381 | VOID\r | |
4382 | EFIAPI\r | |
4383 | EnableDisableInterrupts (\r | |
4384 | VOID\r | |
4385 | );\r | |
4386 | \r | |
4387 | \r | |
4388 | /**\r | |
4389 | Retrieves the current CPU interrupt state.\r | |
4390 | \r | |
af2dc6a7 | 4391 | Returns TRUE if interrupts are currently enabled. Otherwise\r |
38bbd3d9 | 4392 | returns FALSE.\r |
ac644614 | 4393 | \r |
4394 | @retval TRUE CPU interrupts are enabled.\r | |
4395 | @retval FALSE CPU interrupts are disabled.\r | |
4396 | \r | |
4397 | **/\r | |
4398 | BOOLEAN\r | |
4399 | EFIAPI\r | |
4400 | GetInterruptState (\r | |
4401 | VOID\r | |
4402 | );\r | |
4403 | \r | |
4404 | \r | |
4405 | /**\r | |
4406 | Set the current CPU interrupt state.\r | |
4407 | \r | |
4408 | Sets the current CPU interrupt state to the state specified by\r | |
4409 | InterruptState. If InterruptState is TRUE, then interrupts are enabled. If\r | |
4410 | InterruptState is FALSE, then interrupts are disabled. InterruptState is\r | |
4411 | returned.\r | |
4412 | \r | |
4413 | @param InterruptState TRUE if interrupts should enabled. FALSE if\r | |
4414 | interrupts should be disabled.\r | |
4415 | \r | |
4416 | @return InterruptState\r | |
4417 | \r | |
4418 | **/\r | |
4419 | BOOLEAN\r | |
4420 | EFIAPI\r | |
4421 | SetInterruptState (\r | |
4422 | IN BOOLEAN InterruptState\r | |
4423 | );\r | |
4424 | \r | |
4425 | \r | |
4426 | /**\r | |
4427 | Requests CPU to pause for a short period of time.\r | |
4428 | \r | |
4429 | Requests CPU to pause for a short period of time. Typically used in MP\r | |
4430 | systems to prevent memory starvation while waiting for a spin lock.\r | |
4431 | \r | |
4432 | **/\r | |
4433 | VOID\r | |
4434 | EFIAPI\r | |
4435 | CpuPause (\r | |
4436 | VOID\r | |
4437 | );\r | |
4438 | \r | |
4439 | \r | |
4440 | /**\r | |
4441 | Transfers control to a function starting with a new stack.\r | |
4442 | \r | |
4443 | Transfers control to the function specified by EntryPoint using the\r | |
4444 | new stack specified by NewStack and passing in the parameters specified\r | |
4445 | by Context1 and Context2. Context1 and Context2 are optional and may\r | |
4446 | be NULL. The function EntryPoint must never return. This function\r | |
4447 | supports a variable number of arguments following the NewStack parameter.\r | |
1a2f870c | 4448 | These additional arguments are ignored on IA-32, x64, and EBC architectures.\r |
4449 | Itanium processors expect one additional parameter of type VOID * that specifies\r | |
ac644614 | 4450 | the new backing store pointer.\r |
4451 | \r | |
4452 | If EntryPoint is NULL, then ASSERT().\r | |
4453 | If NewStack is NULL, then ASSERT().\r | |
4454 | \r | |
4455 | @param EntryPoint A pointer to function to call with the new stack.\r | |
4456 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
4457 | function.\r | |
4458 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
4459 | function.\r | |
4460 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
4461 | function.\r | |
af2dc6a7 | 4462 | @param ... This variable argument list is ignored for IA-32, x64, and \r |
4463 | EBC architectures. For Itanium processors, this variable \r | |
4464 | argument list is expected to contain a single parameter of \r | |
4465 | type VOID * that specifies the new backing store pointer.\r | |
42eedea9 | 4466 | \r |
ac644614 | 4467 | \r |
4468 | **/\r | |
4469 | VOID\r | |
4470 | EFIAPI\r | |
4471 | SwitchStack (\r | |
4472 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
4473 | IN VOID *Context1, OPTIONAL\r | |
4474 | IN VOID *Context2, OPTIONAL\r | |
4475 | IN VOID *NewStack,\r | |
4476 | ...\r | |
4477 | );\r | |
4478 | \r | |
4479 | \r | |
4480 | /**\r | |
4481 | Generates a breakpoint on the CPU.\r | |
4482 | \r | |
4483 | Generates a breakpoint on the CPU. The breakpoint must be implemented such\r | |
4484 | that code can resume normal execution after the breakpoint.\r | |
4485 | \r | |
4486 | **/\r | |
4487 | VOID\r | |
4488 | EFIAPI\r | |
4489 | CpuBreakpoint (\r | |
4490 | VOID\r | |
4491 | );\r | |
4492 | \r | |
4493 | \r | |
4494 | /**\r | |
4495 | Executes an infinite loop.\r | |
4496 | \r | |
4497 | Forces the CPU to execute an infinite loop. A debugger may be used to skip\r | |
4498 | past the loop and the code that follows the loop must execute properly. This\r | |
4499 | implies that the infinite loop must not cause the code that follow it to be\r | |
4500 | optimized away.\r | |
4501 | \r | |
4502 | **/\r | |
4503 | VOID\r | |
4504 | EFIAPI\r | |
4505 | CpuDeadLoop (\r | |
4506 | VOID\r | |
4507 | );\r | |
2fe241a2 | 4508 | \r |
ac644614 | 4509 | #if defined (MDE_CPU_IPF)\r |
4510 | \r | |
4511 | /**\r | |
4512 | Flush a range of cache lines in the cache coherency domain of the calling\r | |
4513 | CPU.\r | |
4514 | \r | |
cc39b88b | 4515 | Flushes the cache lines specified by Address and Length. If Address is not aligned \r |
4516 | on a cache line boundary, then entire cache line containing Address is flushed. \r | |
4517 | If Address + Length is not aligned on a cache line boundary, then the entire cache \r | |
4518 | line containing Address + Length - 1 is flushed. This function may choose to flush \r | |
4519 | the entire cache if that is more efficient than flushing the specified range. If \r | |
4520 | Length is 0, the no cache lines are flushed. Address is returned. \r | |
1a2f870c | 4521 | This function is only available on Itanium processors.\r |
ac644614 | 4522 | \r |
4523 | If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r | |
4524 | \r | |
4525 | @param Address The base address of the instruction lines to invalidate. If\r | |
4526 | the CPU is in a physical addressing mode, then Address is a\r | |
4527 | physical address. If the CPU is in a virtual addressing mode,\r | |
4528 | then Address is a virtual address.\r | |
4529 | \r | |
4530 | @param Length The number of bytes to invalidate from the instruction cache.\r | |
4531 | \r | |
cc39b88b | 4532 | @return Address.\r |
ac644614 | 4533 | \r |
4534 | **/\r | |
4535 | VOID *\r | |
4536 | EFIAPI\r | |
cc39b88b | 4537 | AsmFlushCacheRange (\r |
ac644614 | 4538 | IN VOID *Address,\r |
4539 | IN UINTN Length\r | |
4540 | );\r | |
4541 | \r | |
4542 | \r | |
4543 | /**\r | |
af2dc6a7 | 4544 | Executes an FC instruction.\r |
4545 | Executes an FC instruction on the cache line specified by Address.\r | |
ac644614 | 4546 | The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).\r |
1a2f870c | 4547 | An implementation may flush a larger region. This function is only available on Itanium processors.\r |
ac644614 | 4548 | \r |
ee6c452c | 4549 | @param Address The Address of cache line to be flushed.\r |
ac644614 | 4550 | \r |
4551 | @return The address of FC instruction executed.\r | |
4552 | \r | |
4553 | **/\r | |
4554 | UINT64\r | |
4555 | EFIAPI\r | |
4556 | AsmFc (\r | |
4557 | IN UINT64 Address\r | |
4558 | );\r | |
4559 | \r | |
4560 | \r | |
4561 | /**\r | |
af2dc6a7 | 4562 | Executes an FC.I instruction.\r |
4563 | Executes an FC.I instruction on the cache line specified by Address.\r | |
ac644614 | 4564 | The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).\r |
1a2f870c | 4565 | An implementation may flush a larger region. This function is only available on Itanium processors.\r |
ac644614 | 4566 | \r |
ee6c452c | 4567 | @param Address The Address of cache line to be flushed.\r |
ac644614 | 4568 | \r |
af2dc6a7 | 4569 | @return The address of the FC.I instruction executed.\r |
ac644614 | 4570 | \r |
4571 | **/\r | |
4572 | UINT64\r | |
4573 | EFIAPI\r | |
4574 | AsmFci (\r | |
4575 | IN UINT64 Address\r | |
4576 | );\r | |
4577 | \r | |
4578 | \r | |
4579 | /**\r | |
4580 | Reads the current value of a Processor Identifier Register (CPUID).\r | |
17f695ed | 4581 | \r |
4582 | Reads and returns the current value of Processor Identifier Register specified by Index. \r | |
ac644614 | 4583 | The Index of largest implemented CPUID (One less than the number of implemented CPUID\r |
4584 | registers) is determined by CPUID [3] bits {7:0}.\r | |
4585 | No parameter checking is performed on Index. If the Index value is beyond the\r | |
4586 | implemented CPUID register range, a Reserved Register/Field fault may occur. The caller\r | |
4587 | must either guarantee that Index is valid, or the caller must set up fault handlers to\r | |
1a2f870c | 4588 | catch the faults. This function is only available on Itanium processors.\r |
ac644614 | 4589 | \r |
ee6c452c | 4590 | @param Index The 8-bit Processor Identifier Register index to read.\r |
ac644614 | 4591 | \r |
4592 | @return The current value of Processor Identifier Register specified by Index.\r | |
4593 | \r | |
4594 | **/\r | |
4595 | UINT64\r | |
4596 | EFIAPI\r | |
4597 | AsmReadCpuid (\r | |
4598 | IN UINT8 Index\r | |
4599 | );\r | |
4600 | \r | |
4601 | \r | |
4602 | /**\r | |
4603 | Reads the current value of 64-bit Processor Status Register (PSR).\r | |
1a2f870c | 4604 | This function is only available on Itanium processors.\r |
ac644614 | 4605 | \r |
4606 | @return The current value of PSR.\r | |
4607 | \r | |
4608 | **/\r | |
4609 | UINT64\r | |
4610 | EFIAPI\r | |
4611 | AsmReadPsr (\r | |
4612 | VOID\r | |
4613 | );\r | |
4614 | \r | |
4615 | \r | |
4616 | /**\r | |
4617 | Writes the current value of 64-bit Processor Status Register (PSR).\r | |
22388319 | 4618 | \r |
ac644614 | 4619 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
22388319 | 4620 | reserved fields of PSR must be 0 or a Reserved Register/Field fault may occur.\r |
4621 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
1a2f870c | 4622 | fault handlers to catch the faults. This function is only available on Itanium processors.\r |
ac644614 | 4623 | \r |
ee6c452c | 4624 | @param Value The 64-bit value to write to PSR.\r |
ac644614 | 4625 | \r |
4626 | @return The 64-bit value written to the PSR.\r | |
4627 | \r | |
4628 | **/\r | |
4629 | UINT64\r | |
4630 | EFIAPI\r | |
4631 | AsmWritePsr (\r | |
4632 | IN UINT64 Value\r | |
4633 | );\r | |
4634 | \r | |
4635 | \r | |
4636 | /**\r | |
4637 | Reads the current value of 64-bit Kernel Register #0 (KR0).\r | |
2fe241a2 | 4638 | \r |
4639 | Reads and returns the current value of KR0. \r | |
1a2f870c | 4640 | This function is only available on Itanium processors.\r |
ac644614 | 4641 | \r |
4642 | @return The current value of KR0.\r | |
4643 | \r | |
4644 | **/\r | |
4645 | UINT64\r | |
4646 | EFIAPI\r | |
4647 | AsmReadKr0 (\r | |
4648 | VOID\r | |
4649 | );\r | |
4650 | \r | |
4651 | \r | |
4652 | /**\r | |
4653 | Reads the current value of 64-bit Kernel Register #1 (KR1).\r | |
2fe241a2 | 4654 | \r |
4655 | Reads and returns the current value of KR1. \r | |
1a2f870c | 4656 | This function is only available on Itanium processors.\r |
ac644614 | 4657 | \r |
4658 | @return The current value of KR1.\r | |
4659 | \r | |
4660 | **/\r | |
4661 | UINT64\r | |
4662 | EFIAPI\r | |
4663 | AsmReadKr1 (\r | |
4664 | VOID\r | |
4665 | );\r | |
4666 | \r | |
4667 | \r | |
4668 | /**\r | |
4669 | Reads the current value of 64-bit Kernel Register #2 (KR2).\r | |
2fe241a2 | 4670 | \r |
4671 | Reads and returns the current value of KR2. \r | |
1a2f870c | 4672 | This function is only available on Itanium processors.\r |
ac644614 | 4673 | \r |
4674 | @return The current value of KR2.\r | |
4675 | \r | |
4676 | **/\r | |
4677 | UINT64\r | |
4678 | EFIAPI\r | |
4679 | AsmReadKr2 (\r | |
4680 | VOID\r | |
4681 | );\r | |
4682 | \r | |
4683 | \r | |
4684 | /**\r | |
4685 | Reads the current value of 64-bit Kernel Register #3 (KR3).\r | |
2fe241a2 | 4686 | \r |
4687 | Reads and returns the current value of KR3. \r | |
1a2f870c | 4688 | This function is only available on Itanium processors.\r |
ac644614 | 4689 | \r |
4690 | @return The current value of KR3.\r | |
4691 | \r | |
4692 | **/\r | |
4693 | UINT64\r | |
4694 | EFIAPI\r | |
4695 | AsmReadKr3 (\r | |
4696 | VOID\r | |
4697 | );\r | |
4698 | \r | |
4699 | \r | |
4700 | /**\r | |
4701 | Reads the current value of 64-bit Kernel Register #4 (KR4).\r | |
ac644614 | 4702 | \r |
2fe241a2 | 4703 | Reads and returns the current value of KR4. \r |
1a2f870c | 4704 | This function is only available on Itanium processors.\r |
2fe241a2 | 4705 | \r |
ac644614 | 4706 | @return The current value of KR4.\r |
4707 | \r | |
4708 | **/\r | |
4709 | UINT64\r | |
4710 | EFIAPI\r | |
4711 | AsmReadKr4 (\r | |
4712 | VOID\r | |
4713 | );\r | |
4714 | \r | |
4715 | \r | |
4716 | /**\r | |
4717 | Reads the current value of 64-bit Kernel Register #5 (KR5).\r | |
2fe241a2 | 4718 | \r |
4719 | Reads and returns the current value of KR5. \r | |
1a2f870c | 4720 | This function is only available on Itanium processors.\r |
ac644614 | 4721 | \r |
4722 | @return The current value of KR5.\r | |
4723 | \r | |
4724 | **/\r | |
4725 | UINT64\r | |
4726 | EFIAPI\r | |
4727 | AsmReadKr5 (\r | |
4728 | VOID\r | |
4729 | );\r | |
4730 | \r | |
4731 | \r | |
4732 | /**\r | |
4733 | Reads the current value of 64-bit Kernel Register #6 (KR6).\r | |
2fe241a2 | 4734 | \r |
4735 | Reads and returns the current value of KR6. \r | |
1a2f870c | 4736 | This function is only available on Itanium processors.\r |
ac644614 | 4737 | \r |
4738 | @return The current value of KR6.\r | |
4739 | \r | |
4740 | **/\r | |
4741 | UINT64\r | |
4742 | EFIAPI\r | |
4743 | AsmReadKr6 (\r | |
4744 | VOID\r | |
4745 | );\r | |
4746 | \r | |
4747 | \r | |
4748 | /**\r | |
4749 | Reads the current value of 64-bit Kernel Register #7 (KR7).\r | |
2fe241a2 | 4750 | \r |
4751 | Reads and returns the current value of KR7. \r | |
1a2f870c | 4752 | This function is only available on Itanium processors.\r |
ac644614 | 4753 | \r |
4754 | @return The current value of KR7.\r | |
4755 | \r | |
4756 | **/\r | |
4757 | UINT64\r | |
4758 | EFIAPI\r | |
4759 | AsmReadKr7 (\r | |
4760 | VOID\r | |
4761 | );\r | |
4762 | \r | |
4763 | \r | |
4764 | /**\r | |
4765 | Write the current value of 64-bit Kernel Register #0 (KR0).\r | |
2fe241a2 | 4766 | \r |
4767 | Writes the current value of KR0. The 64-bit value written to \r | |
1a2f870c | 4768 | the KR0 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4769 | \r |
ee6c452c | 4770 | @param Value The 64-bit value to write to KR0.\r |
ac644614 | 4771 | \r |
4772 | @return The 64-bit value written to the KR0.\r | |
4773 | \r | |
4774 | **/\r | |
4775 | UINT64\r | |
4776 | EFIAPI\r | |
4777 | AsmWriteKr0 (\r | |
4778 | IN UINT64 Value\r | |
4779 | );\r | |
4780 | \r | |
4781 | \r | |
4782 | /**\r | |
4783 | Write the current value of 64-bit Kernel Register #1 (KR1).\r | |
2fe241a2 | 4784 | \r |
4785 | Writes the current value of KR1. The 64-bit value written to \r | |
1a2f870c | 4786 | the KR1 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4787 | \r |
ee6c452c | 4788 | @param Value The 64-bit value to write to KR1.\r |
ac644614 | 4789 | \r |
4790 | @return The 64-bit value written to the KR1.\r | |
4791 | \r | |
4792 | **/\r | |
4793 | UINT64\r | |
4794 | EFIAPI\r | |
4795 | AsmWriteKr1 (\r | |
4796 | IN UINT64 Value\r | |
4797 | );\r | |
4798 | \r | |
4799 | \r | |
4800 | /**\r | |
4801 | Write the current value of 64-bit Kernel Register #2 (KR2).\r | |
2fe241a2 | 4802 | \r |
4803 | Writes the current value of KR2. The 64-bit value written to \r | |
1a2f870c | 4804 | the KR2 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4805 | \r |
ee6c452c | 4806 | @param Value The 64-bit value to write to KR2.\r |
ac644614 | 4807 | \r |
4808 | @return The 64-bit value written to the KR2.\r | |
4809 | \r | |
4810 | **/\r | |
4811 | UINT64\r | |
4812 | EFIAPI\r | |
4813 | AsmWriteKr2 (\r | |
4814 | IN UINT64 Value\r | |
4815 | );\r | |
4816 | \r | |
4817 | \r | |
4818 | /**\r | |
4819 | Write the current value of 64-bit Kernel Register #3 (KR3).\r | |
2fe241a2 | 4820 | \r |
4821 | Writes the current value of KR3. The 64-bit value written to \r | |
1a2f870c | 4822 | the KR3 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4823 | \r |
ee6c452c | 4824 | @param Value The 64-bit value to write to KR3.\r |
ac644614 | 4825 | \r |
4826 | @return The 64-bit value written to the KR3.\r | |
4827 | \r | |
4828 | **/\r | |
4829 | UINT64\r | |
4830 | EFIAPI\r | |
4831 | AsmWriteKr3 (\r | |
4832 | IN UINT64 Value\r | |
4833 | );\r | |
4834 | \r | |
4835 | \r | |
4836 | /**\r | |
4837 | Write the current value of 64-bit Kernel Register #4 (KR4).\r | |
2fe241a2 | 4838 | \r |
4839 | Writes the current value of KR4. The 64-bit value written to \r | |
1a2f870c | 4840 | the KR4 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4841 | \r |
ee6c452c | 4842 | @param Value The 64-bit value to write to KR4.\r |
ac644614 | 4843 | \r |
4844 | @return The 64-bit value written to the KR4.\r | |
4845 | \r | |
4846 | **/\r | |
4847 | UINT64\r | |
4848 | EFIAPI\r | |
4849 | AsmWriteKr4 (\r | |
4850 | IN UINT64 Value\r | |
4851 | );\r | |
4852 | \r | |
4853 | \r | |
4854 | /**\r | |
4855 | Write the current value of 64-bit Kernel Register #5 (KR5).\r | |
2fe241a2 | 4856 | \r |
4857 | Writes the current value of KR5. The 64-bit value written to \r | |
1a2f870c | 4858 | the KR5 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4859 | \r |
ee6c452c | 4860 | @param Value The 64-bit value to write to KR5.\r |
ac644614 | 4861 | \r |
4862 | @return The 64-bit value written to the KR5.\r | |
4863 | \r | |
4864 | **/\r | |
4865 | UINT64\r | |
4866 | EFIAPI\r | |
4867 | AsmWriteKr5 (\r | |
4868 | IN UINT64 Value\r | |
4869 | );\r | |
4870 | \r | |
4871 | \r | |
4872 | /**\r | |
4873 | Write the current value of 64-bit Kernel Register #6 (KR6).\r | |
2fe241a2 | 4874 | \r |
4875 | Writes the current value of KR6. The 64-bit value written to \r | |
1a2f870c | 4876 | the KR6 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4877 | \r |
ee6c452c | 4878 | @param Value The 64-bit value to write to KR6.\r |
ac644614 | 4879 | \r |
4880 | @return The 64-bit value written to the KR6.\r | |
4881 | \r | |
4882 | **/\r | |
4883 | UINT64\r | |
4884 | EFIAPI\r | |
4885 | AsmWriteKr6 (\r | |
4886 | IN UINT64 Value\r | |
4887 | );\r | |
4888 | \r | |
4889 | \r | |
4890 | /**\r | |
4891 | Write the current value of 64-bit Kernel Register #7 (KR7).\r | |
2fe241a2 | 4892 | \r |
4893 | Writes the current value of KR7. The 64-bit value written to \r | |
1a2f870c | 4894 | the KR7 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4895 | \r |
ee6c452c | 4896 | @param Value The 64-bit value to write to KR7.\r |
ac644614 | 4897 | \r |
4898 | @return The 64-bit value written to the KR7.\r | |
4899 | \r | |
4900 | **/\r | |
4901 | UINT64\r | |
4902 | EFIAPI\r | |
4903 | AsmWriteKr7 (\r | |
4904 | IN UINT64 Value\r | |
4905 | );\r | |
4906 | \r | |
4907 | \r | |
4908 | /**\r | |
4909 | Reads the current value of Interval Timer Counter Register (ITC).\r | |
2fe241a2 | 4910 | \r |
4911 | Reads and returns the current value of ITC.\r | |
1a2f870c | 4912 | This function is only available on Itanium processors.\r |
ac644614 | 4913 | \r |
4914 | @return The current value of ITC.\r | |
4915 | \r | |
4916 | **/\r | |
4917 | UINT64\r | |
4918 | EFIAPI\r | |
4919 | AsmReadItc (\r | |
4920 | VOID\r | |
4921 | );\r | |
4922 | \r | |
4923 | \r | |
4924 | /**\r | |
4925 | Reads the current value of Interval Timer Vector Register (ITV).\r | |
2fe241a2 | 4926 | \r |
4927 | Reads and returns the current value of ITV. \r | |
1a2f870c | 4928 | This function is only available on Itanium processors.\r |
ac644614 | 4929 | \r |
4930 | @return The current value of ITV.\r | |
4931 | \r | |
4932 | **/\r | |
4933 | UINT64\r | |
4934 | EFIAPI\r | |
4935 | AsmReadItv (\r | |
4936 | VOID\r | |
4937 | );\r | |
4938 | \r | |
4939 | \r | |
4940 | /**\r | |
4941 | Reads the current value of Interval Timer Match Register (ITM).\r | |
2fe241a2 | 4942 | \r |
4943 | Reads and returns the current value of ITM.\r | |
1a2f870c | 4944 | This function is only available on Itanium processors.\r |
ac644614 | 4945 | \r |
4946 | @return The current value of ITM.\r | |
4947 | **/\r | |
4948 | UINT64\r | |
4949 | EFIAPI\r | |
4950 | AsmReadItm (\r | |
4951 | VOID\r | |
4952 | );\r | |
4953 | \r | |
4954 | \r | |
4955 | /**\r | |
4956 | Writes the current value of 64-bit Interval Timer Counter Register (ITC).\r | |
2fe241a2 | 4957 | \r |
4958 | Writes the current value of ITC. The 64-bit value written to the ITC is returned. \r | |
1a2f870c | 4959 | This function is only available on Itanium processors.\r |
ac644614 | 4960 | \r |
ee6c452c | 4961 | @param Value The 64-bit value to write to ITC.\r |
ac644614 | 4962 | \r |
4963 | @return The 64-bit value written to the ITC.\r | |
4964 | \r | |
4965 | **/\r | |
4966 | UINT64\r | |
4967 | EFIAPI\r | |
4968 | AsmWriteItc (\r | |
4969 | IN UINT64 Value\r | |
4970 | );\r | |
4971 | \r | |
4972 | \r | |
4973 | /**\r | |
4974 | Writes the current value of 64-bit Interval Timer Match Register (ITM).\r | |
2fe241a2 | 4975 | \r |
4976 | Writes the current value of ITM. The 64-bit value written to the ITM is returned. \r | |
1a2f870c | 4977 | This function is only available on Itanium processors.\r |
ac644614 | 4978 | \r |
ee6c452c | 4979 | @param Value The 64-bit value to write to ITM.\r |
ac644614 | 4980 | \r |
4981 | @return The 64-bit value written to the ITM.\r | |
4982 | \r | |
4983 | **/\r | |
4984 | UINT64\r | |
4985 | EFIAPI\r | |
4986 | AsmWriteItm (\r | |
4987 | IN UINT64 Value\r | |
4988 | );\r | |
4989 | \r | |
4990 | \r | |
4991 | /**\r | |
4992 | Writes the current value of 64-bit Interval Timer Vector Register (ITV).\r | |
2fe241a2 | 4993 | \r |
4994 | Writes the current value of ITV. The 64-bit value written to the ITV is returned. \r | |
ac644614 | 4995 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
4996 | reserved fields of ITV must be 0 or a Reserved Register/Field fault may occur.\r | |
4997 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
4998 | fault handlers to catch the faults.\r | |
1a2f870c | 4999 | This function is only available on Itanium processors.\r |
ac644614 | 5000 | \r |
ee6c452c | 5001 | @param Value The 64-bit value to write to ITV.\r |
ac644614 | 5002 | \r |
5003 | @return The 64-bit value written to the ITV.\r | |
5004 | \r | |
5005 | **/\r | |
5006 | UINT64\r | |
5007 | EFIAPI\r | |
5008 | AsmWriteItv (\r | |
5009 | IN UINT64 Value\r | |
5010 | );\r | |
5011 | \r | |
5012 | \r | |
5013 | /**\r | |
5014 | Reads the current value of Default Control Register (DCR).\r | |
2fe241a2 | 5015 | \r |
1a2f870c | 5016 | Reads and returns the current value of DCR. This function is only available on Itanium processors.\r |
ac644614 | 5017 | \r |
5018 | @return The current value of DCR.\r | |
5019 | \r | |
5020 | **/\r | |
5021 | UINT64\r | |
5022 | EFIAPI\r | |
5023 | AsmReadDcr (\r | |
5024 | VOID\r | |
5025 | );\r | |
5026 | \r | |
5027 | \r | |
5028 | /**\r | |
5029 | Reads the current value of Interruption Vector Address Register (IVA).\r | |
2fe241a2 | 5030 | \r |
1a2f870c | 5031 | Reads and returns the current value of IVA. This function is only available on Itanium processors.\r |
ac644614 | 5032 | \r |
5033 | @return The current value of IVA.\r | |
5034 | **/\r | |
5035 | UINT64\r | |
5036 | EFIAPI\r | |
5037 | AsmReadIva (\r | |
5038 | VOID\r | |
5039 | );\r | |
5040 | \r | |
5041 | \r | |
5042 | /**\r | |
5043 | Reads the current value of Page Table Address Register (PTA).\r | |
2fe241a2 | 5044 | \r |
1a2f870c | 5045 | Reads and returns the current value of PTA. This function is only available on Itanium processors.\r |
ac644614 | 5046 | \r |
5047 | @return The current value of PTA.\r | |
5048 | \r | |
5049 | **/\r | |
5050 | UINT64\r | |
5051 | EFIAPI\r | |
5052 | AsmReadPta (\r | |
5053 | VOID\r | |
5054 | );\r | |
5055 | \r | |
5056 | \r | |
5057 | /**\r | |
5058 | Writes the current value of 64-bit Default Control Register (DCR).\r | |
2fe241a2 | 5059 | \r |
5060 | Writes the current value of DCR. The 64-bit value written to the DCR is returned. \r | |
ac644614 | 5061 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5062 | reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.\r | |
5063 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5064 | fault handlers to catch the faults.\r | |
1a2f870c | 5065 | This function is only available on Itanium processors.\r |
ac644614 | 5066 | \r |
ee6c452c | 5067 | @param Value The 64-bit value to write to DCR.\r |
ac644614 | 5068 | \r |
5069 | @return The 64-bit value written to the DCR.\r | |
5070 | \r | |
5071 | **/\r | |
5072 | UINT64\r | |
5073 | EFIAPI\r | |
5074 | AsmWriteDcr (\r | |
5075 | IN UINT64 Value\r | |
5076 | );\r | |
5077 | \r | |
5078 | \r | |
5079 | /**\r | |
5080 | Writes the current value of 64-bit Interruption Vector Address Register (IVA).\r | |
2fe241a2 | 5081 | \r |
5082 | Writes the current value of IVA. The 64-bit value written to the IVA is returned. \r | |
ac644614 | 5083 | The size of vector table is 32 K bytes and is 32 K bytes aligned\r |
5084 | the low 15 bits of Value is ignored when written.\r | |
1a2f870c | 5085 | This function is only available on Itanium processors.\r |
ac644614 | 5086 | \r |
ee6c452c | 5087 | @param Value The 64-bit value to write to IVA.\r |
ac644614 | 5088 | \r |
5089 | @return The 64-bit value written to the IVA.\r | |
5090 | \r | |
5091 | **/\r | |
5092 | UINT64\r | |
5093 | EFIAPI\r | |
5094 | AsmWriteIva (\r | |
5095 | IN UINT64 Value\r | |
5096 | );\r | |
5097 | \r | |
5098 | \r | |
5099 | /**\r | |
5100 | Writes the current value of 64-bit Page Table Address Register (PTA).\r | |
2fe241a2 | 5101 | \r |
5102 | Writes the current value of PTA. The 64-bit value written to the PTA is returned. \r | |
ac644614 | 5103 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5104 | reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.\r | |
5105 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5106 | fault handlers to catch the faults.\r | |
1a2f870c | 5107 | This function is only available on Itanium processors.\r |
ac644614 | 5108 | \r |
ee6c452c | 5109 | @param Value The 64-bit value to write to PTA.\r |
ac644614 | 5110 | \r |
5111 | @return The 64-bit value written to the PTA.\r | |
5112 | **/\r | |
5113 | UINT64\r | |
5114 | EFIAPI\r | |
5115 | AsmWritePta (\r | |
5116 | IN UINT64 Value\r | |
5117 | );\r | |
5118 | \r | |
5119 | \r | |
5120 | /**\r | |
5121 | Reads the current value of Local Interrupt ID Register (LID).\r | |
2fe241a2 | 5122 | \r |
1a2f870c | 5123 | Reads and returns the current value of LID. This function is only available on Itanium processors.\r |
ac644614 | 5124 | \r |
5125 | @return The current value of LID.\r | |
5126 | \r | |
5127 | **/\r | |
5128 | UINT64\r | |
5129 | EFIAPI\r | |
5130 | AsmReadLid (\r | |
5131 | VOID\r | |
5132 | );\r | |
5133 | \r | |
5134 | \r | |
5135 | /**\r | |
5136 | Reads the current value of External Interrupt Vector Register (IVR).\r | |
2fe241a2 | 5137 | \r |
1a2f870c | 5138 | Reads and returns the current value of IVR. This function is only available on Itanium processors. \r |
ac644614 | 5139 | \r |
5140 | @return The current value of IVR.\r | |
5141 | \r | |
5142 | **/\r | |
5143 | UINT64\r | |
5144 | EFIAPI\r | |
5145 | AsmReadIvr (\r | |
5146 | VOID\r | |
5147 | );\r | |
5148 | \r | |
5149 | \r | |
5150 | /**\r | |
5151 | Reads the current value of Task Priority Register (TPR).\r | |
2fe241a2 | 5152 | \r |
1a2f870c | 5153 | Reads and returns the current value of TPR. This function is only available on Itanium processors. \r |
ac644614 | 5154 | \r |
5155 | @return The current value of TPR.\r | |
5156 | \r | |
5157 | **/\r | |
5158 | UINT64\r | |
5159 | EFIAPI\r | |
5160 | AsmReadTpr (\r | |
5161 | VOID\r | |
5162 | );\r | |
5163 | \r | |
5164 | \r | |
5165 | /**\r | |
5166 | Reads the current value of External Interrupt Request Register #0 (IRR0).\r | |
2fe241a2 | 5167 | \r |
1a2f870c | 5168 | Reads and returns the current value of IRR0. This function is only available on Itanium processors. \r |
ac644614 | 5169 | \r |
5170 | @return The current value of IRR0.\r | |
5171 | \r | |
5172 | **/\r | |
5173 | UINT64\r | |
5174 | EFIAPI\r | |
5175 | AsmReadIrr0 (\r | |
5176 | VOID\r | |
5177 | );\r | |
5178 | \r | |
5179 | \r | |
5180 | /**\r | |
5181 | Reads the current value of External Interrupt Request Register #1 (IRR1).\r | |
2fe241a2 | 5182 | \r |
1a2f870c | 5183 | Reads and returns the current value of IRR1. This function is only available on Itanium processors. \r |
ac644614 | 5184 | \r |
5185 | @return The current value of IRR1.\r | |
5186 | \r | |
5187 | **/\r | |
5188 | UINT64\r | |
5189 | EFIAPI\r | |
5190 | AsmReadIrr1 (\r | |
5191 | VOID\r | |
5192 | );\r | |
5193 | \r | |
5194 | \r | |
5195 | /**\r | |
5196 | Reads the current value of External Interrupt Request Register #2 (IRR2).\r | |
2fe241a2 | 5197 | \r |
1a2f870c | 5198 | Reads and returns the current value of IRR2. This function is only available on Itanium processors.\r |
ac644614 | 5199 | \r |
5200 | @return The current value of IRR2.\r | |
5201 | \r | |
5202 | **/\r | |
5203 | UINT64\r | |
5204 | EFIAPI\r | |
5205 | AsmReadIrr2 (\r | |
5206 | VOID\r | |
5207 | );\r | |
5208 | \r | |
5209 | \r | |
5210 | /**\r | |
5211 | Reads the current value of External Interrupt Request Register #3 (IRR3).\r | |
2fe241a2 | 5212 | \r |
1a2f870c | 5213 | Reads and returns the current value of IRR3. This function is only available on Itanium processors. \r |
ac644614 | 5214 | \r |
5215 | @return The current value of IRR3.\r | |
5216 | \r | |
5217 | **/\r | |
5218 | UINT64\r | |
5219 | EFIAPI\r | |
5220 | AsmReadIrr3 (\r | |
5221 | VOID\r | |
5222 | );\r | |
5223 | \r | |
5224 | \r | |
5225 | /**\r | |
5226 | Reads the current value of Performance Monitor Vector Register (PMV).\r | |
2fe241a2 | 5227 | \r |
1a2f870c | 5228 | Reads and returns the current value of PMV. This function is only available on Itanium processors. \r |
ac644614 | 5229 | \r |
5230 | @return The current value of PMV.\r | |
5231 | \r | |
5232 | **/\r | |
5233 | UINT64\r | |
5234 | EFIAPI\r | |
5235 | AsmReadPmv (\r | |
5236 | VOID\r | |
5237 | );\r | |
5238 | \r | |
5239 | \r | |
5240 | /**\r | |
5241 | Reads the current value of Corrected Machine Check Vector Register (CMCV).\r | |
2fe241a2 | 5242 | \r |
1a2f870c | 5243 | Reads and returns the current value of CMCV. This function is only available on Itanium processors.\r |
ac644614 | 5244 | \r |
5245 | @return The current value of CMCV.\r | |
5246 | \r | |
5247 | **/\r | |
5248 | UINT64\r | |
5249 | EFIAPI\r | |
5250 | AsmReadCmcv (\r | |
5251 | VOID\r | |
5252 | );\r | |
5253 | \r | |
5254 | \r | |
5255 | /**\r | |
5256 | Reads the current value of Local Redirection Register #0 (LRR0).\r | |
2fe241a2 | 5257 | \r |
1a2f870c | 5258 | Reads and returns the current value of LRR0. This function is only available on Itanium processors. \r |
ac644614 | 5259 | \r |
5260 | @return The current value of LRR0.\r | |
5261 | \r | |
5262 | **/\r | |
5263 | UINT64\r | |
5264 | EFIAPI\r | |
5265 | AsmReadLrr0 (\r | |
5266 | VOID\r | |
5267 | );\r | |
5268 | \r | |
5269 | \r | |
5270 | /**\r | |
5271 | Reads the current value of Local Redirection Register #1 (LRR1).\r | |
2fe241a2 | 5272 | \r |
1a2f870c | 5273 | Reads and returns the current value of LRR1. This function is only available on Itanium processors.\r |
ac644614 | 5274 | \r |
5275 | @return The current value of LRR1.\r | |
5276 | \r | |
5277 | **/\r | |
5278 | UINT64\r | |
5279 | EFIAPI\r | |
5280 | AsmReadLrr1 (\r | |
5281 | VOID\r | |
5282 | );\r | |
5283 | \r | |
5284 | \r | |
5285 | /**\r | |
5286 | Writes the current value of 64-bit Page Local Interrupt ID Register (LID).\r | |
2fe241a2 | 5287 | \r |
5288 | Writes the current value of LID. The 64-bit value written to the LID is returned. \r | |
ac644614 | 5289 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5290 | reserved fields of LID must be 0 or a Reserved Register/Field fault may occur.\r | |
5291 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5292 | fault handlers to catch the faults.\r | |
1a2f870c | 5293 | This function is only available on Itanium processors.\r |
ac644614 | 5294 | \r |
ee6c452c | 5295 | @param Value The 64-bit value to write to LID.\r |
ac644614 | 5296 | \r |
5297 | @return The 64-bit value written to the LID.\r | |
5298 | \r | |
5299 | **/\r | |
5300 | UINT64\r | |
5301 | EFIAPI\r | |
5302 | AsmWriteLid (\r | |
5303 | IN UINT64 Value\r | |
5304 | );\r | |
5305 | \r | |
5306 | \r | |
5307 | /**\r | |
5308 | Writes the current value of 64-bit Task Priority Register (TPR).\r | |
2fe241a2 | 5309 | \r |
5310 | Writes the current value of TPR. The 64-bit value written to the TPR is returned. \r | |
ac644614 | 5311 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5312 | reserved fields of TPR must be 0 or a Reserved Register/Field fault may occur.\r | |
5313 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5314 | fault handlers to catch the faults.\r | |
1a2f870c | 5315 | This function is only available on Itanium processors.\r |
ac644614 | 5316 | \r |
ee6c452c | 5317 | @param Value The 64-bit value to write to TPR.\r |
ac644614 | 5318 | \r |
5319 | @return The 64-bit value written to the TPR.\r | |
5320 | \r | |
5321 | **/\r | |
5322 | UINT64\r | |
5323 | EFIAPI\r | |
5324 | AsmWriteTpr (\r | |
5325 | IN UINT64 Value\r | |
5326 | );\r | |
5327 | \r | |
5328 | \r | |
5329 | /**\r | |
5330 | Performs a write operation on End OF External Interrupt Register (EOI).\r | |
2fe241a2 | 5331 | \r |
1a2f870c | 5332 | Writes a value of 0 to the EOI Register. This function is only available on Itanium processors.\r |
ac644614 | 5333 | \r |
5334 | **/\r | |
5335 | VOID\r | |
5336 | EFIAPI\r | |
5337 | AsmWriteEoi (\r | |
5338 | VOID\r | |
5339 | );\r | |
5340 | \r | |
5341 | \r | |
5342 | /**\r | |
5343 | Writes the current value of 64-bit Performance Monitor Vector Register (PMV).\r | |
2fe241a2 | 5344 | \r |
5345 | Writes the current value of PMV. The 64-bit value written to the PMV is returned. \r | |
ac644614 | 5346 | No parameter checking is performed on Value. All bits of Value corresponding\r |
5347 | to reserved fields of PMV must be 0 or a Reserved Register/Field fault may occur.\r | |
5348 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5349 | fault handlers to catch the faults.\r | |
1a2f870c | 5350 | This function is only available on Itanium processors.\r |
ac644614 | 5351 | \r |
ee6c452c | 5352 | @param Value The 64-bit value to write to PMV.\r |
ac644614 | 5353 | \r |
5354 | @return The 64-bit value written to the PMV.\r | |
5355 | \r | |
5356 | **/\r | |
5357 | UINT64\r | |
5358 | EFIAPI\r | |
5359 | AsmWritePmv (\r | |
5360 | IN UINT64 Value\r | |
5361 | );\r | |
5362 | \r | |
5363 | \r | |
5364 | /**\r | |
5365 | Writes the current value of 64-bit Corrected Machine Check Vector Register (CMCV).\r | |
2fe241a2 | 5366 | \r |
5367 | Writes the current value of CMCV. The 64-bit value written to the CMCV is returned. \r | |
ac644614 | 5368 | No parameter checking is performed on Value. All bits of Value corresponding\r |
5369 | to reserved fields of CMCV must be 0 or a Reserved Register/Field fault may occur.\r | |
5370 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5371 | fault handlers to catch the faults.\r | |
1a2f870c | 5372 | This function is only available on Itanium processors.\r |
ac644614 | 5373 | \r |
ee6c452c | 5374 | @param Value The 64-bit value to write to CMCV.\r |
ac644614 | 5375 | \r |
5376 | @return The 64-bit value written to the CMCV.\r | |
5377 | \r | |
5378 | **/\r | |
5379 | UINT64\r | |
5380 | EFIAPI\r | |
5381 | AsmWriteCmcv (\r | |
5382 | IN UINT64 Value\r | |
5383 | );\r | |
5384 | \r | |
5385 | \r | |
5386 | /**\r | |
5387 | Writes the current value of 64-bit Local Redirection Register #0 (LRR0).\r | |
2fe241a2 | 5388 | \r |
5389 | Writes the current value of LRR0. The 64-bit value written to the LRR0 is returned. \r | |
ac644614 | 5390 | No parameter checking is performed on Value. All bits of Value corresponding\r |
5391 | to reserved fields of LRR0 must be 0 or a Reserved Register/Field fault may occur.\r | |
5392 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5393 | fault handlers to catch the faults.\r | |
1a2f870c | 5394 | This function is only available on Itanium processors.\r |
ac644614 | 5395 | \r |
ee6c452c | 5396 | @param Value The 64-bit value to write to LRR0.\r |
ac644614 | 5397 | \r |
5398 | @return The 64-bit value written to the LRR0.\r | |
5399 | \r | |
5400 | **/\r | |
5401 | UINT64\r | |
5402 | EFIAPI\r | |
5403 | AsmWriteLrr0 (\r | |
5404 | IN UINT64 Value\r | |
5405 | );\r | |
5406 | \r | |
5407 | \r | |
5408 | /**\r | |
5409 | Writes the current value of 64-bit Local Redirection Register #1 (LRR1).\r | |
2fe241a2 | 5410 | \r |
5411 | Writes the current value of LRR1. The 64-bit value written to the LRR1 is returned. \r | |
ac644614 | 5412 | No parameter checking is performed on Value. All bits of Value corresponding\r |
5413 | to reserved fields of LRR1 must be 0 or a Reserved Register/Field fault may occur.\r | |
5414 | The caller must either guarantee that Value is valid, or the caller must\r | |
5415 | set up fault handlers to catch the faults.\r | |
1a2f870c | 5416 | This function is only available on Itanium processors.\r |
ac644614 | 5417 | \r |
ee6c452c | 5418 | @param Value The 64-bit value to write to LRR1.\r |
ac644614 | 5419 | \r |
5420 | @return The 64-bit value written to the LRR1.\r | |
5421 | \r | |
5422 | **/\r | |
5423 | UINT64\r | |
5424 | EFIAPI\r | |
5425 | AsmWriteLrr1 (\r | |
5426 | IN UINT64 Value\r | |
5427 | );\r | |
5428 | \r | |
5429 | \r | |
5430 | /**\r | |
5431 | Reads the current value of Instruction Breakpoint Register (IBR).\r | |
5432 | \r | |
5433 | The Instruction Breakpoint Registers are used in pairs. The even numbered\r | |
5434 | registers contain breakpoint addresses, and the odd numbered registers contain\r | |
af2dc6a7 | 5435 | breakpoint mask conditions. At least four instruction registers pairs are implemented\r |
ac644614 | 5436 | on all processor models. Implemented registers are contiguous starting with\r |
5437 | register 0. No parameter checking is performed on Index, and if the Index value\r | |
5438 | is beyond the implemented IBR register range, a Reserved Register/Field fault may\r | |
5439 | occur. The caller must either guarantee that Index is valid, or the caller must\r | |
5440 | set up fault handlers to catch the faults.\r | |
1a2f870c | 5441 | This function is only available on Itanium processors.\r |
ac644614 | 5442 | \r |
ee6c452c | 5443 | @param Index The 8-bit Instruction Breakpoint Register index to read.\r |
ac644614 | 5444 | \r |
5445 | @return The current value of Instruction Breakpoint Register specified by Index.\r | |
5446 | \r | |
5447 | **/\r | |
5448 | UINT64\r | |
5449 | EFIAPI\r | |
5450 | AsmReadIbr (\r | |
5451 | IN UINT8 Index\r | |
5452 | );\r | |
5453 | \r | |
5454 | \r | |
5455 | /**\r | |
5456 | Reads the current value of Data Breakpoint Register (DBR).\r | |
5457 | \r | |
5458 | The Data Breakpoint Registers are used in pairs. The even numbered registers\r | |
5459 | contain breakpoint addresses, and odd numbered registers contain breakpoint\r | |
af2dc6a7 | 5460 | mask conditions. At least four data registers pairs are implemented on all processor\r |
ac644614 | 5461 | models. Implemented registers are contiguous starting with register 0.\r |
5462 | No parameter checking is performed on Index. If the Index value is beyond\r | |
5463 | the implemented DBR register range, a Reserved Register/Field fault may occur.\r | |
5464 | The caller must either guarantee that Index is valid, or the caller must set up\r | |
5465 | fault handlers to catch the faults.\r | |
1a2f870c | 5466 | This function is only available on Itanium processors.\r |
ac644614 | 5467 | \r |
ee6c452c | 5468 | @param Index The 8-bit Data Breakpoint Register index to read.\r |
ac644614 | 5469 | \r |
5470 | @return The current value of Data Breakpoint Register specified by Index.\r | |
5471 | \r | |
5472 | **/\r | |
5473 | UINT64\r | |
5474 | EFIAPI\r | |
5475 | AsmReadDbr (\r | |
5476 | IN UINT8 Index\r | |
5477 | );\r | |
5478 | \r | |
5479 | \r | |
5480 | /**\r | |
5481 | Reads the current value of Performance Monitor Configuration Register (PMC).\r | |
5482 | \r | |
af2dc6a7 | 5483 | All processor implementations provide at least four performance counters\r |
5484 | (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow\r | |
ac644614 | 5485 | status registers (PMC [0]... PMC [3]). Processor implementations may provide\r |
5486 | additional implementation-dependent PMC and PMD to increase the number of\r | |
5487 | 'generic' performance counters (PMC/PMD pairs). The remainder of PMC and PMD\r | |
5488 | register set is implementation dependent. No parameter checking is performed\r | |
5489 | on Index. If the Index value is beyond the implemented PMC register range,\r | |
5490 | zero value will be returned.\r | |
1a2f870c | 5491 | This function is only available on Itanium processors.\r |
ac644614 | 5492 | \r |
ee6c452c | 5493 | @param Index The 8-bit Performance Monitor Configuration Register index to read.\r |
ac644614 | 5494 | \r |
2fe241a2 | 5495 | @return The current value of Performance Monitor Configuration Register\r |
5496 | specified by Index.\r | |
ac644614 | 5497 | \r |
5498 | **/\r | |
5499 | UINT64\r | |
5500 | EFIAPI\r | |
5501 | AsmReadPmc (\r | |
5502 | IN UINT8 Index\r | |
5503 | );\r | |
5504 | \r | |
5505 | \r | |
5506 | /**\r | |
5507 | Reads the current value of Performance Monitor Data Register (PMD).\r | |
5508 | \r | |
5509 | All processor implementations provide at least 4 performance counters\r | |
5510 | (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter\r | |
5511 | overflow status registers (PMC [0]... PMC [3]). Processor implementations may\r | |
5512 | provide additional implementation-dependent PMC and PMD to increase the number\r | |
5513 | of 'generic' performance counters (PMC/PMD pairs). The remainder of PMC and PMD\r | |
5514 | register set is implementation dependent. No parameter checking is performed\r | |
5515 | on Index. If the Index value is beyond the implemented PMD register range,\r | |
5516 | zero value will be returned.\r | |
1a2f870c | 5517 | This function is only available on Itanium processors.\r |
ac644614 | 5518 | \r |
ee6c452c | 5519 | @param Index The 8-bit Performance Monitor Data Register index to read.\r |
ac644614 | 5520 | \r |
5521 | @return The current value of Performance Monitor Data Register specified by Index.\r | |
5522 | \r | |
5523 | **/\r | |
5524 | UINT64\r | |
5525 | EFIAPI\r | |
5526 | AsmReadPmd (\r | |
5527 | IN UINT8 Index\r | |
5528 | );\r | |
5529 | \r | |
5530 | \r | |
5531 | /**\r | |
5532 | Writes the current value of 64-bit Instruction Breakpoint Register (IBR).\r | |
5533 | \r | |
5534 | Writes current value of Instruction Breakpoint Register specified by Index.\r | |
5535 | The Instruction Breakpoint Registers are used in pairs. The even numbered\r | |
5536 | registers contain breakpoint addresses, and odd numbered registers contain\r | |
af2dc6a7 | 5537 | breakpoint mask conditions. At least four instruction registers pairs are implemented\r |
ac644614 | 5538 | on all processor models. Implemented registers are contiguous starting with\r |
5539 | register 0. No parameter checking is performed on Index. If the Index value\r | |
5540 | is beyond the implemented IBR register range, a Reserved Register/Field fault may\r | |
5541 | occur. The caller must either guarantee that Index is valid, or the caller must\r | |
5542 | set up fault handlers to catch the faults.\r | |
1a2f870c | 5543 | This function is only available on Itanium processors.\r |
ac644614 | 5544 | \r |
ee6c452c | 5545 | @param Index The 8-bit Instruction Breakpoint Register index to write.\r |
5546 | @param Value The 64-bit value to write to IBR.\r | |
ac644614 | 5547 | \r |
5548 | @return The 64-bit value written to the IBR.\r | |
5549 | \r | |
5550 | **/\r | |
5551 | UINT64\r | |
5552 | EFIAPI\r | |
5553 | AsmWriteIbr (\r | |
5554 | IN UINT8 Index,\r | |
5555 | IN UINT64 Value\r | |
5556 | );\r | |
5557 | \r | |
5558 | \r | |
5559 | /**\r | |
5560 | Writes the current value of 64-bit Data Breakpoint Register (DBR).\r | |
5561 | \r | |
5562 | Writes current value of Data Breakpoint Register specified by Index.\r | |
5563 | The Data Breakpoint Registers are used in pairs. The even numbered registers\r | |
5564 | contain breakpoint addresses, and odd numbered registers contain breakpoint\r | |
af2dc6a7 | 5565 | mask conditions. At least four data registers pairs are implemented on all processor\r |
ac644614 | 5566 | models. Implemented registers are contiguous starting with register 0. No parameter\r |
5567 | checking is performed on Index. If the Index value is beyond the implemented\r | |
5568 | DBR register range, a Reserved Register/Field fault may occur. The caller must\r | |
5569 | either guarantee that Index is valid, or the caller must set up fault handlers to\r | |
5570 | catch the faults.\r | |
1a2f870c | 5571 | This function is only available on Itanium processors.\r |
ac644614 | 5572 | \r |
ee6c452c | 5573 | @param Index The 8-bit Data Breakpoint Register index to write.\r |
5574 | @param Value The 64-bit value to write to DBR.\r | |
ac644614 | 5575 | \r |
5576 | @return The 64-bit value written to the DBR.\r | |
5577 | \r | |
5578 | **/\r | |
5579 | UINT64\r | |
5580 | EFIAPI\r | |
5581 | AsmWriteDbr (\r | |
5582 | IN UINT8 Index,\r | |
5583 | IN UINT64 Value\r | |
5584 | );\r | |
5585 | \r | |
5586 | \r | |
5587 | /**\r | |
5588 | Writes the current value of 64-bit Performance Monitor Configuration Register (PMC).\r | |
5589 | \r | |
5590 | Writes current value of Performance Monitor Configuration Register specified by Index.\r | |
af2dc6a7 | 5591 | All processor implementations provide at least four performance counters\r |
5592 | (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow status\r | |
ac644614 | 5593 | registers (PMC [0]... PMC [3]). Processor implementations may provide additional\r |
5594 | implementation-dependent PMC and PMD to increase the number of 'generic' performance\r | |
5595 | counters (PMC/PMD pairs). The remainder of PMC and PMD register set is implementation\r | |
5596 | dependent. No parameter checking is performed on Index. If the Index value is\r | |
5597 | beyond the implemented PMC register range, the write is ignored.\r | |
1a2f870c | 5598 | This function is only available on Itanium processors.\r |
ac644614 | 5599 | \r |
ee6c452c | 5600 | @param Index The 8-bit Performance Monitor Configuration Register index to write.\r |
5601 | @param Value The 64-bit value to write to PMC.\r | |
ac644614 | 5602 | \r |
5603 | @return The 64-bit value written to the PMC.\r | |
5604 | \r | |
5605 | **/\r | |
5606 | UINT64\r | |
5607 | EFIAPI\r | |
5608 | AsmWritePmc (\r | |
5609 | IN UINT8 Index,\r | |
5610 | IN UINT64 Value\r | |
5611 | );\r | |
5612 | \r | |
5613 | \r | |
5614 | /**\r | |
5615 | Writes the current value of 64-bit Performance Monitor Data Register (PMD).\r | |
5616 | \r | |
5617 | Writes current value of Performance Monitor Data Register specified by Index.\r | |
af2dc6a7 | 5618 | All processor implementations provide at least four performance counters\r |
5619 | (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow\r | |
ac644614 | 5620 | status registers (PMC [0]... PMC [3]). Processor implementations may provide\r |
5621 | additional implementation-dependent PMC and PMD to increase the number of 'generic'\r | |
5622 | performance counters (PMC/PMD pairs). The remainder of PMC and PMD register set\r | |
5623 | is implementation dependent. No parameter checking is performed on Index. If the\r | |
5624 | Index value is beyond the implemented PMD register range, the write is ignored.\r | |
1a2f870c | 5625 | This function is only available on Itanium processors.\r |
ac644614 | 5626 | \r |
ee6c452c | 5627 | @param Index The 8-bit Performance Monitor Data Register index to write.\r |
5628 | @param Value The 64-bit value to write to PMD.\r | |
ac644614 | 5629 | \r |
5630 | @return The 64-bit value written to the PMD.\r | |
5631 | \r | |
5632 | **/\r | |
5633 | UINT64\r | |
5634 | EFIAPI\r | |
5635 | AsmWritePmd (\r | |
5636 | IN UINT8 Index,\r | |
5637 | IN UINT64 Value\r | |
5638 | );\r | |
5639 | \r | |
5640 | \r | |
5641 | /**\r | |
5642 | Reads the current value of 64-bit Global Pointer (GP).\r | |
5643 | \r | |
5644 | Reads and returns the current value of GP.\r | |
1a2f870c | 5645 | This function is only available on Itanium processors.\r |
ac644614 | 5646 | \r |
5647 | @return The current value of GP.\r | |
5648 | \r | |
5649 | **/\r | |
5650 | UINT64\r | |
5651 | EFIAPI\r | |
5652 | AsmReadGp (\r | |
5653 | VOID\r | |
5654 | );\r | |
5655 | \r | |
5656 | \r | |
5657 | /**\r | |
5658 | Write the current value of 64-bit Global Pointer (GP).\r | |
5659 | \r | |
5660 | Writes the current value of GP. The 64-bit value written to the GP is returned.\r | |
5661 | No parameter checking is performed on Value.\r | |
1a2f870c | 5662 | This function is only available on Itanium processors.\r |
ac644614 | 5663 | \r |
5664 | @param Value The 64-bit value to write to GP.\r | |
5665 | \r | |
5666 | @return The 64-bit value written to the GP.\r | |
5667 | \r | |
5668 | **/\r | |
5669 | UINT64\r | |
5670 | EFIAPI\r | |
5671 | AsmWriteGp (\r | |
5672 | IN UINT64 Value\r | |
5673 | );\r | |
5674 | \r | |
5675 | \r | |
5676 | /**\r | |
5677 | Reads the current value of 64-bit Stack Pointer (SP).\r | |
5678 | \r | |
5679 | Reads and returns the current value of SP.\r | |
1a2f870c | 5680 | This function is only available on Itanium processors.\r |
ac644614 | 5681 | \r |
5682 | @return The current value of SP.\r | |
5683 | \r | |
5684 | **/\r | |
5685 | UINT64\r | |
5686 | EFIAPI\r | |
5687 | AsmReadSp (\r | |
5688 | VOID\r | |
5689 | );\r | |
5690 | \r | |
5691 | \r | |
aad6137d | 5692 | ///\r |
af2dc6a7 | 5693 | /// Valid Index value for AsmReadControlRegister().\r |
aad6137d | 5694 | ///\r |
5695 | #define IPF_CONTROL_REGISTER_DCR 0\r | |
5696 | #define IPF_CONTROL_REGISTER_ITM 1\r | |
5697 | #define IPF_CONTROL_REGISTER_IVA 2\r | |
5698 | #define IPF_CONTROL_REGISTER_PTA 8\r | |
5699 | #define IPF_CONTROL_REGISTER_IPSR 16\r | |
5700 | #define IPF_CONTROL_REGISTER_ISR 17\r | |
5701 | #define IPF_CONTROL_REGISTER_IIP 19\r | |
5702 | #define IPF_CONTROL_REGISTER_IFA 20\r | |
5703 | #define IPF_CONTROL_REGISTER_ITIR 21\r | |
5704 | #define IPF_CONTROL_REGISTER_IIPA 22\r | |
5705 | #define IPF_CONTROL_REGISTER_IFS 23\r | |
5706 | #define IPF_CONTROL_REGISTER_IIM 24\r | |
5707 | #define IPF_CONTROL_REGISTER_IHA 25\r | |
5708 | #define IPF_CONTROL_REGISTER_LID 64\r | |
5709 | #define IPF_CONTROL_REGISTER_IVR 65\r | |
5710 | #define IPF_CONTROL_REGISTER_TPR 66\r | |
5711 | #define IPF_CONTROL_REGISTER_EOI 67\r | |
5712 | #define IPF_CONTROL_REGISTER_IRR0 68\r | |
5713 | #define IPF_CONTROL_REGISTER_IRR1 69\r | |
5714 | #define IPF_CONTROL_REGISTER_IRR2 70\r | |
5715 | #define IPF_CONTROL_REGISTER_IRR3 71\r | |
5716 | #define IPF_CONTROL_REGISTER_ITV 72\r | |
5717 | #define IPF_CONTROL_REGISTER_PMV 73\r | |
5718 | #define IPF_CONTROL_REGISTER_CMCV 74\r | |
5719 | #define IPF_CONTROL_REGISTER_LRR0 80\r | |
5720 | #define IPF_CONTROL_REGISTER_LRR1 81\r | |
5721 | \r | |
5722 | /**\r | |
5723 | Reads a 64-bit control register.\r | |
5724 | \r | |
af2dc6a7 | 5725 | Reads and returns the control register specified by Index. The valid Index valued \r |
5726 | are defined above in "Related Definitions".\r | |
5727 | If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only \r | |
5728 | available on Itanium processors.\r | |
aad6137d | 5729 | \r |
5730 | @param Index The index of the control register to read.\r | |
5731 | \r | |
5732 | @return The control register specified by Index.\r | |
5733 | \r | |
5734 | **/\r | |
5735 | UINT64\r | |
5736 | EFIAPI\r | |
5737 | AsmReadControlRegister (\r | |
5738 | IN UINT64 Index\r | |
5739 | );\r | |
5740 | \r | |
5741 | \r | |
5742 | ///\r | |
af2dc6a7 | 5743 | /// Valid Index value for AsmReadApplicationRegister().\r |
aad6137d | 5744 | ///\r |
5745 | #define IPF_APPLICATION_REGISTER_K0 0\r | |
5746 | #define IPF_APPLICATION_REGISTER_K1 1\r | |
5747 | #define IPF_APPLICATION_REGISTER_K2 2\r | |
5748 | #define IPF_APPLICATION_REGISTER_K3 3\r | |
5749 | #define IPF_APPLICATION_REGISTER_K4 4\r | |
5750 | #define IPF_APPLICATION_REGISTER_K5 5\r | |
5751 | #define IPF_APPLICATION_REGISTER_K6 6\r | |
5752 | #define IPF_APPLICATION_REGISTER_K7 7\r | |
5753 | #define IPF_APPLICATION_REGISTER_RSC 16\r | |
5754 | #define IPF_APPLICATION_REGISTER_BSP 17\r | |
5755 | #define IPF_APPLICATION_REGISTER_BSPSTORE 18\r | |
5756 | #define IPF_APPLICATION_REGISTER_RNAT 19\r | |
5757 | #define IPF_APPLICATION_REGISTER_FCR 21\r | |
5758 | #define IPF_APPLICATION_REGISTER_EFLAG 24\r | |
5759 | #define IPF_APPLICATION_REGISTER_CSD 25\r | |
5760 | #define IPF_APPLICATION_REGISTER_SSD 26\r | |
5761 | #define IPF_APPLICATION_REGISTER_CFLG 27\r | |
5762 | #define IPF_APPLICATION_REGISTER_FSR 28\r | |
5763 | #define IPF_APPLICATION_REGISTER_FIR 29\r | |
5764 | #define IPF_APPLICATION_REGISTER_FDR 30\r | |
5765 | #define IPF_APPLICATION_REGISTER_CCV 32\r | |
5766 | #define IPF_APPLICATION_REGISTER_UNAT 36\r | |
5767 | #define IPF_APPLICATION_REGISTER_FPSR 40\r | |
5768 | #define IPF_APPLICATION_REGISTER_ITC 44\r | |
5769 | #define IPF_APPLICATION_REGISTER_PFS 64\r | |
5770 | #define IPF_APPLICATION_REGISTER_LC 65\r | |
5771 | #define IPF_APPLICATION_REGISTER_EC 66\r | |
5772 | \r | |
5773 | /**\r | |
5774 | Reads a 64-bit application register.\r | |
5775 | \r | |
af2dc6a7 | 5776 | Reads and returns the application register specified by Index. The valid Index \r |
5777 | valued are defined above in "Related Definitions".\r | |
5778 | If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only \r | |
5779 | available on Itanium processors.\r | |
aad6137d | 5780 | \r |
5781 | @param Index The index of the application register to read.\r | |
5782 | \r | |
5783 | @return The application register specified by Index.\r | |
5784 | \r | |
5785 | **/\r | |
5786 | UINT64\r | |
5787 | EFIAPI\r | |
5788 | AsmReadApplicationRegister (\r | |
5789 | IN UINT64 Index\r | |
5790 | );\r | |
5791 | \r | |
5792 | \r | |
59e0bb0c | 5793 | /**\r |
5794 | Reads the current value of a Machine Specific Register (MSR).\r | |
5795 | \r | |
5796 | Reads and returns the current value of the Machine Specific Register specified by Index. No\r | |
5797 | parameter checking is performed on Index, and if the Index value is beyond the implemented MSR\r | |
5798 | register range, a Reserved Register/Field fault may occur. The caller must either guarantee that\r | |
5799 | Index is valid, or the caller must set up fault handlers to catch the faults. This function is\r | |
1a2f870c | 5800 | only available on Itanium processors.\r |
59e0bb0c | 5801 | \r |
5802 | @param Index The 8-bit Machine Specific Register index to read.\r | |
5803 | \r | |
5804 | @return The current value of the Machine Specific Register specified by Index. \r | |
5805 | \r | |
5806 | **/\r | |
5807 | UINT64\r | |
5808 | EFIAPI\r | |
5809 | AsmReadMsr (\r | |
5810 | IN UINT8 Index \r | |
5811 | );\r | |
5812 | \r | |
5813 | \r | |
5814 | /**\r | |
5815 | Writes the current value of a Machine Specific Register (MSR).\r | |
5816 | \r | |
5817 | Writes Value to the Machine Specific Register specified by Index. Value is returned. No\r | |
5818 | parameter checking is performed on Index, and if the Index value is beyond the implemented MSR\r | |
5819 | register range, a Reserved Register/Field fault may occur. The caller must either guarantee that\r | |
5820 | Index is valid, or the caller must set up fault handlers to catch the faults. This function is\r | |
1a2f870c | 5821 | only available on Itanium processors.\r |
59e0bb0c | 5822 | \r |
5823 | @param Index The 8-bit Machine Specific Register index to write.\r | |
5824 | @param Value The 64-bit value to write to the Machine Specific Register.\r | |
5825 | \r | |
5826 | @return The 64-bit value to write to the Machine Specific Register. \r | |
5827 | \r | |
5828 | **/\r | |
5829 | UINT64\r | |
5830 | EFIAPI\r | |
5831 | AsmWriteMsr (\r | |
5832 | IN UINT8 Index, \r | |
5833 | IN UINT64 Value \r | |
5834 | );\r | |
5835 | \r | |
5836 | \r | |
ac644614 | 5837 | /**\r |
5838 | Determines if the CPU is currently executing in virtual, physical, or mixed mode.\r | |
5839 | \r | |
5840 | Determines the current execution mode of the CPU.\r | |
5841 | If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.\r | |
5842 | If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.\r | |
5843 | If the CPU is not in physical mode or virtual mode, then it is in mixed mode,\r | |
5844 | and -1 is returned.\r | |
1a2f870c | 5845 | This function is only available on Itanium processors.\r |
ac644614 | 5846 | \r |
17f695ed | 5847 | @retval 1 The CPU is in virtual mode.\r |
5848 | @retval 0 The CPU is in physical mode.\r | |
5849 | @retval -1 The CPU is in mixed mode.\r | |
ac644614 | 5850 | \r |
5851 | **/\r | |
5852 | INT64\r | |
5853 | EFIAPI\r | |
5854 | AsmCpuVirtual (\r | |
5855 | VOID\r | |
5856 | );\r | |
5857 | \r | |
5858 | \r | |
5859 | /**\r | |
5860 | Makes a PAL procedure call.\r | |
5861 | \r | |
5862 | This is a wrapper function to make a PAL procedure call. Based on the Index\r | |
5863 | value this API will make static or stacked PAL call. The following table\r | |
5864 | describes the usage of PAL Procedure Index Assignment. Architected procedures\r | |
5865 | may be designated as required or optional. If a PAL procedure is specified\r | |
5866 | as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the\r | |
5867 | Status field of the PAL_CALL_RETURN structure.\r | |
5868 | This indicates that the procedure is not present in this PAL implementation.\r | |
5869 | It is the caller's responsibility to check for this return code after calling\r | |
5870 | any optional PAL procedure.\r | |
5871 | No parameter checking is performed on the 5 input parameters, but there are\r | |
5872 | some common rules that the caller should follow when making a PAL call. Any\r | |
5873 | address passed to PAL as buffers for return parameters must be 8-byte aligned.\r | |
5874 | Unaligned addresses may cause undefined results. For those parameters defined\r | |
5875 | as reserved or some fields defined as reserved must be zero filled or the invalid\r | |
5876 | argument return value may be returned or undefined result may occur during the\r | |
5877 | execution of the procedure. If the PalEntryPoint does not point to a valid\r | |
5878 | PAL entry point then the system behavior is undefined. This function is only\r | |
1a2f870c | 5879 | available on Itanium processors.\r |
ac644614 | 5880 | \r |
ee6c452c | 5881 | @param PalEntryPoint The PAL procedure calls entry point.\r |
5882 | @param Index The PAL procedure Index number.\r | |
5883 | @param Arg2 The 2nd parameter for PAL procedure calls.\r | |
5884 | @param Arg3 The 3rd parameter for PAL procedure calls.\r | |
5885 | @param Arg4 The 4th parameter for PAL procedure calls.\r | |
ac644614 | 5886 | \r |
5887 | @return structure returned from the PAL Call procedure, including the status and return value.\r | |
5888 | \r | |
5889 | **/\r | |
5890 | PAL_CALL_RETURN\r | |
5891 | EFIAPI\r | |
5892 | AsmPalCall (\r | |
5893 | IN UINT64 PalEntryPoint,\r | |
5894 | IN UINT64 Index,\r | |
5895 | IN UINT64 Arg2,\r | |
5896 | IN UINT64 Arg3,\r | |
5897 | IN UINT64 Arg4\r | |
5898 | );\r | |
fd163050 | 5899 | #endif\r |
ac644614 | 5900 | \r |
fd163050 | 5901 | #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)\r |
1106ffe1 | 5902 | ///\r |
af2dc6a7 | 5903 | /// IA32 and x64 Specific Functions.\r |
5904 | /// Byte packed structure for 16-bit Real Mode EFLAGS.\r | |
1106ffe1 | 5905 | ///\r |
ac644614 | 5906 | typedef union {\r |
5907 | struct {\r | |
af2dc6a7 | 5908 | UINT32 CF:1; ///< Carry Flag.\r |
5909 | UINT32 Reserved_0:1; ///< Reserved.\r | |
5910 | UINT32 PF:1; ///< Parity Flag.\r | |
5911 | UINT32 Reserved_1:1; ///< Reserved.\r | |
5912 | UINT32 AF:1; ///< Auxiliary Carry Flag.\r | |
5913 | UINT32 Reserved_2:1; ///< Reserved.\r | |
5914 | UINT32 ZF:1; ///< Zero Flag.\r | |
5915 | UINT32 SF:1; ///< Sign Flag.\r | |
5916 | UINT32 TF:1; ///< Trap Flag.\r | |
5917 | UINT32 IF:1; ///< Interrupt Enable Flag.\r | |
5918 | UINT32 DF:1; ///< Direction Flag.\r | |
5919 | UINT32 OF:1; ///< Overflow Flag.\r | |
5920 | UINT32 IOPL:2; ///< I/O Privilege Level.\r | |
5921 | UINT32 NT:1; ///< Nested Task.\r | |
5922 | UINT32 Reserved_3:1; ///< Reserved.\r | |
ac644614 | 5923 | } Bits;\r |
5924 | UINT16 Uint16;\r | |
5925 | } IA32_FLAGS16;\r | |
5926 | \r | |
1106ffe1 | 5927 | ///\r |
af2dc6a7 | 5928 | /// Byte packed structure for EFLAGS/RFLAGS.\r |
5929 | /// 32-bits on IA-32.\r | |
5930 | /// 64-bits on x64. The upper 32-bits on x64 are reserved.\r | |
1106ffe1 | 5931 | ///\r |
ac644614 | 5932 | typedef union {\r |
5933 | struct {\r | |
af2dc6a7 | 5934 | UINT32 CF:1; ///< Carry Flag.\r |
5935 | UINT32 Reserved_0:1; ///< Reserved.\r | |
5936 | UINT32 PF:1; ///< Parity Flag.\r | |
5937 | UINT32 Reserved_1:1; ///< Reserved.\r | |
5938 | UINT32 AF:1; ///< Auxiliary Carry Flag.\r | |
5939 | UINT32 Reserved_2:1; ///< Reserved.\r | |
5940 | UINT32 ZF:1; ///< Zero Flag.\r | |
5941 | UINT32 SF:1; ///< Sign Flag.\r | |
5942 | UINT32 TF:1; ///< Trap Flag.\r | |
5943 | UINT32 IF:1; ///< Interrupt Enable Flag.\r | |
5944 | UINT32 DF:1; ///< Direction Flag.\r | |
5945 | UINT32 OF:1; ///< Overflow Flag.\r | |
5946 | UINT32 IOPL:2; ///< I/O Privilege Level.\r | |
5947 | UINT32 NT:1; ///< Nested Task.\r | |
5948 | UINT32 Reserved_3:1; ///< Reserved.\r | |
5949 | UINT32 RF:1; ///< Resume Flag.\r | |
5950 | UINT32 VM:1; ///< Virtual 8086 Mode.\r | |
5951 | UINT32 AC:1; ///< Alignment Check.\r | |
5952 | UINT32 VIF:1; ///< Virtual Interrupt Flag.\r | |
5953 | UINT32 VIP:1; ///< Virtual Interrupt Pending.\r | |
5954 | UINT32 ID:1; ///< ID Flag.\r | |
5955 | UINT32 Reserved_4:10; ///< Reserved.\r | |
ac644614 | 5956 | } Bits;\r |
5957 | UINTN UintN;\r | |
5958 | } IA32_EFLAGS32;\r | |
5959 | \r | |
1106ffe1 | 5960 | ///\r |
af2dc6a7 | 5961 | /// Byte packed structure for Control Register 0 (CR0).\r |
5962 | /// 32-bits on IA-32.\r | |
5963 | /// 64-bits on x64. The upper 32-bits on x64 are reserved.\r | |
1106ffe1 | 5964 | ///\r |
ac644614 | 5965 | typedef union {\r |
5966 | struct {\r | |
af2dc6a7 | 5967 | UINT32 PE:1; ///< Protection Enable.\r |
5968 | UINT32 MP:1; ///< Monitor Coprocessor.\r | |
5969 | UINT32 EM:1; ///< Emulation.\r | |
5970 | UINT32 TS:1; ///< Task Switched.\r | |
5971 | UINT32 ET:1; ///< Extension Type.\r | |
5972 | UINT32 NE:1; ///< Numeric Error.\r | |
5973 | UINT32 Reserved_0:10; ///< Reserved.\r | |
5974 | UINT32 WP:1; ///< Write Protect.\r | |
5975 | UINT32 Reserved_1:1; ///< Reserved.\r | |
5976 | UINT32 AM:1; ///< Alignment Mask.\r | |
5977 | UINT32 Reserved_2:10; ///< Reserved.\r | |
5978 | UINT32 NW:1; ///< Mot Write-through.\r | |
5979 | UINT32 CD:1; ///< Cache Disable.\r | |
5980 | UINT32 PG:1; ///< Paging.\r | |
ac644614 | 5981 | } Bits;\r |
5982 | UINTN UintN;\r | |
5983 | } IA32_CR0;\r | |
5984 | \r | |
1106ffe1 | 5985 | ///\r |
af2dc6a7 | 5986 | /// Byte packed structure for Control Register 4 (CR4).\r |
5987 | /// 32-bits on IA-32.\r | |
5988 | /// 64-bits on x64. The upper 32-bits on x64 are reserved.\r | |
1106ffe1 | 5989 | ///\r |
ac644614 | 5990 | typedef union {\r |
5991 | struct {\r | |
af2dc6a7 | 5992 | UINT32 VME:1; ///< Virtual-8086 Mode Extensions.\r |
5993 | UINT32 PVI:1; ///< Protected-Mode Virtual Interrupts.\r | |
5994 | UINT32 TSD:1; ///< Time Stamp Disable.\r | |
5995 | UINT32 DE:1; ///< Debugging Extensions.\r | |
5996 | UINT32 PSE:1; ///< Page Size Extensions.\r | |
5997 | UINT32 PAE:1; ///< Physical Address Extension.\r | |
5998 | UINT32 MCE:1; ///< Machine Check Enable.\r | |
5999 | UINT32 PGE:1; ///< Page Global Enable.\r | |
2a53dabf | 6000 | UINT32 PCE:1; ///< Performance Monitoring Counter\r |
af2dc6a7 | 6001 | ///< Enable.\r |
2a53dabf LG |
6002 | UINT32 OSFXSR:1; ///< Operating System Support for\r |
6003 | ///< FXSAVE and FXRSTOR instructions\r | |
6004 | UINT32 OSXMMEXCPT:1; ///< Operating System Support for\r | |
6005 | ///< Unmasked SIMD Floating Point\r | |
af2dc6a7 | 6006 | ///< Exceptions.\r |
6007 | UINT32 Reserved_0:2; ///< Reserved.\r | |
2a53dabf | 6008 | UINT32 VMXE:1; ///< VMX Enable\r |
af2dc6a7 | 6009 | UINT32 Reserved_1:18; ///< Reserved.\r |
ac644614 | 6010 | } Bits;\r |
6011 | UINTN UintN;\r | |
6012 | } IA32_CR4;\r | |
6013 | \r | |
6088db38 | 6014 | ///\r |
6015 | /// Byte packed structure for a segment descriptor in a GDT/LDT.\r | |
6016 | ///\r | |
6017 | typedef union {\r | |
6018 | struct {\r | |
6019 | UINT32 LimitLow:16;\r | |
6020 | UINT32 BaseLow:16;\r | |
6021 | UINT32 BaseMid:8;\r | |
6022 | UINT32 Type:4;\r | |
6023 | UINT32 S:1;\r | |
6024 | UINT32 DPL:2;\r | |
6025 | UINT32 P:1;\r | |
6026 | UINT32 LimitHigh:4;\r | |
6027 | UINT32 AVL:1;\r | |
6028 | UINT32 L:1;\r | |
6029 | UINT32 DB:1;\r | |
6030 | UINT32 G:1;\r | |
6031 | UINT32 BaseHigh:8;\r | |
6032 | } Bits;\r | |
6033 | UINT64 Uint64;\r | |
6034 | } IA32_SEGMENT_DESCRIPTOR;\r | |
6035 | \r | |
1106ffe1 | 6036 | ///\r |
af2dc6a7 | 6037 | /// Byte packed structure for an IDTR, GDTR, LDTR descriptor.\r |
1106ffe1 | 6038 | ///\r |
ac644614 | 6039 | #pragma pack (1)\r |
6040 | typedef struct {\r | |
6041 | UINT16 Limit;\r | |
6042 | UINTN Base;\r | |
6043 | } IA32_DESCRIPTOR;\r | |
6044 | #pragma pack ()\r | |
6045 | \r | |
6046 | #define IA32_IDT_GATE_TYPE_TASK 0x85\r | |
6047 | #define IA32_IDT_GATE_TYPE_INTERRUPT_16 0x86\r | |
6048 | #define IA32_IDT_GATE_TYPE_TRAP_16 0x87\r | |
6049 | #define IA32_IDT_GATE_TYPE_INTERRUPT_32 0x8E\r | |
6050 | #define IA32_IDT_GATE_TYPE_TRAP_32 0x8F\r | |
6051 | \r | |
6f4aad3b | 6052 | \r |
6053 | #if defined (MDE_CPU_IA32)\r | |
1106ffe1 | 6054 | ///\r |
af2dc6a7 | 6055 | /// Byte packed structure for an IA-32 Interrupt Gate Descriptor.\r |
1106ffe1 | 6056 | ///\r |
dc317713 | 6057 | typedef union {\r |
6058 | struct {\r | |
af2dc6a7 | 6059 | UINT32 OffsetLow:16; ///< Offset bits 15..0.\r |
6060 | UINT32 Selector:16; ///< Selector.\r | |
6061 | UINT32 Reserved_0:8; ///< Reserved.\r | |
6062 | UINT32 GateType:8; ///< Gate Type. See #defines above.\r | |
6063 | UINT32 OffsetHigh:16; ///< Offset bits 31..16.\r | |
dc317713 | 6064 | } Bits;\r |
6065 | UINT64 Uint64;\r | |
6066 | } IA32_IDT_GATE_DESCRIPTOR;\r | |
6067 | \r | |
6068 | #endif\r | |
6069 | \r | |
6070 | #if defined (MDE_CPU_X64)\r | |
6f4aad3b | 6071 | ///\r |
af2dc6a7 | 6072 | /// Byte packed structure for an x64 Interrupt Gate Descriptor.\r |
6f4aad3b | 6073 | ///\r |
ac644614 | 6074 | typedef union {\r |
6075 | struct {\r | |
af2dc6a7 | 6076 | UINT32 OffsetLow:16; ///< Offset bits 15..0.\r |
6077 | UINT32 Selector:16; ///< Selector.\r | |
6078 | UINT32 Reserved_0:8; ///< Reserved.\r | |
6079 | UINT32 GateType:8; ///< Gate Type. See #defines above.\r | |
6080 | UINT32 OffsetHigh:16; ///< Offset bits 31..16.\r | |
6081 | UINT32 OffsetUpper:32; ///< Offset bits 63..32.\r | |
6082 | UINT32 Reserved_1:32; ///< Reserved.\r | |
ac644614 | 6083 | } Bits;\r |
6f4aad3b | 6084 | struct {\r |
6085 | UINT64 Uint64;\r | |
6086 | UINT64 Uint64_1;\r | |
6087 | } Uint128; \r | |
ac644614 | 6088 | } IA32_IDT_GATE_DESCRIPTOR;\r |
6089 | \r | |
dc317713 | 6090 | #endif\r |
6091 | \r | |
1106ffe1 | 6092 | ///\r |
af2dc6a7 | 6093 | /// Byte packed structure for an FP/SSE/SSE2 context.\r |
1106ffe1 | 6094 | ///\r |
ac644614 | 6095 | typedef struct {\r |
6096 | UINT8 Buffer[512];\r | |
6097 | } IA32_FX_BUFFER;\r | |
6098 | \r | |
1106ffe1 | 6099 | ///\r |
af2dc6a7 | 6100 | /// Structures for the 16-bit real mode thunks.\r |
1106ffe1 | 6101 | ///\r |
ac644614 | 6102 | typedef struct {\r |
6103 | UINT32 Reserved1;\r | |
6104 | UINT32 Reserved2;\r | |
6105 | UINT32 Reserved3;\r | |
6106 | UINT32 Reserved4;\r | |
6107 | UINT8 BL;\r | |
6108 | UINT8 BH;\r | |
6109 | UINT16 Reserved5;\r | |
6110 | UINT8 DL;\r | |
6111 | UINT8 DH;\r | |
6112 | UINT16 Reserved6;\r | |
6113 | UINT8 CL;\r | |
6114 | UINT8 CH;\r | |
6115 | UINT16 Reserved7;\r | |
6116 | UINT8 AL;\r | |
6117 | UINT8 AH;\r | |
6118 | UINT16 Reserved8;\r | |
6119 | } IA32_BYTE_REGS;\r | |
6120 | \r | |
6121 | typedef struct {\r | |
6122 | UINT16 DI;\r | |
6123 | UINT16 Reserved1;\r | |
6124 | UINT16 SI;\r | |
6125 | UINT16 Reserved2;\r | |
6126 | UINT16 BP;\r | |
6127 | UINT16 Reserved3;\r | |
6128 | UINT16 SP;\r | |
6129 | UINT16 Reserved4;\r | |
6130 | UINT16 BX;\r | |
6131 | UINT16 Reserved5;\r | |
6132 | UINT16 DX;\r | |
6133 | UINT16 Reserved6;\r | |
6134 | UINT16 CX;\r | |
6135 | UINT16 Reserved7;\r | |
6136 | UINT16 AX;\r | |
6137 | UINT16 Reserved8;\r | |
6138 | } IA32_WORD_REGS;\r | |
6139 | \r | |
6140 | typedef struct {\r | |
6141 | UINT32 EDI;\r | |
6142 | UINT32 ESI;\r | |
6143 | UINT32 EBP;\r | |
6144 | UINT32 ESP;\r | |
6145 | UINT32 EBX;\r | |
6146 | UINT32 EDX;\r | |
6147 | UINT32 ECX;\r | |
6148 | UINT32 EAX;\r | |
6149 | UINT16 DS;\r | |
6150 | UINT16 ES;\r | |
6151 | UINT16 FS;\r | |
6152 | UINT16 GS;\r | |
6153 | IA32_EFLAGS32 EFLAGS;\r | |
6154 | UINT32 Eip;\r | |
6155 | UINT16 CS;\r | |
6156 | UINT16 SS;\r | |
6157 | } IA32_DWORD_REGS;\r | |
6158 | \r | |
6159 | typedef union {\r | |
6160 | IA32_DWORD_REGS E;\r | |
6161 | IA32_WORD_REGS X;\r | |
6162 | IA32_BYTE_REGS H;\r | |
6163 | } IA32_REGISTER_SET;\r | |
6164 | \r | |
1106ffe1 | 6165 | ///\r |
af2dc6a7 | 6166 | /// Byte packed structure for an 16-bit real mode thunks.\r |
1106ffe1 | 6167 | ///\r |
ac644614 | 6168 | typedef struct {\r |
6169 | IA32_REGISTER_SET *RealModeState;\r | |
6170 | VOID *RealModeBuffer;\r | |
6171 | UINT32 RealModeBufferSize;\r | |
6172 | UINT32 ThunkAttributes;\r | |
6173 | } THUNK_CONTEXT;\r | |
6174 | \r | |
6175 | #define THUNK_ATTRIBUTE_BIG_REAL_MODE 0x00000001\r | |
6176 | #define THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 0x00000002\r | |
6177 | #define THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL 0x00000004\r | |
6178 | \r | |
6179 | /**\r | |
6180 | Retrieves CPUID information.\r | |
6181 | \r | |
6182 | Executes the CPUID instruction with EAX set to the value specified by Index.\r | |
6183 | This function always returns Index.\r | |
6184 | If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.\r | |
6185 | If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.\r | |
6186 | If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.\r | |
6187 | If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.\r | |
030cd1a2 | 6188 | This function is only available on IA-32 and x64.\r |
ac644614 | 6189 | \r |
6190 | @param Index The 32-bit value to load into EAX prior to invoking the CPUID\r | |
6191 | instruction.\r | |
af2dc6a7 | 6192 | @param Eax The pointer to the 32-bit EAX value returned by the CPUID\r |
ac644614 | 6193 | instruction. This is an optional parameter that may be NULL.\r |
af2dc6a7 | 6194 | @param Ebx The pointer to the 32-bit EBX value returned by the CPUID\r |
ac644614 | 6195 | instruction. This is an optional parameter that may be NULL.\r |
af2dc6a7 | 6196 | @param Ecx The pointer to the 32-bit ECX value returned by the CPUID\r |
ac644614 | 6197 | instruction. This is an optional parameter that may be NULL.\r |
af2dc6a7 | 6198 | @param Edx The pointer to the 32-bit EDX value returned by the CPUID\r |
ac644614 | 6199 | instruction. This is an optional parameter that may be NULL.\r |
6200 | \r | |
2fe241a2 | 6201 | @return Index.\r |
ac644614 | 6202 | \r |
6203 | **/\r | |
6204 | UINT32\r | |
6205 | EFIAPI\r | |
6206 | AsmCpuid (\r | |
6207 | IN UINT32 Index,\r | |
6208 | OUT UINT32 *Eax, OPTIONAL\r | |
6209 | OUT UINT32 *Ebx, OPTIONAL\r | |
6210 | OUT UINT32 *Ecx, OPTIONAL\r | |
6211 | OUT UINT32 *Edx OPTIONAL\r | |
6212 | );\r | |
6213 | \r | |
6214 | \r | |
6215 | /**\r | |
6216 | Retrieves CPUID information using an extended leaf identifier.\r | |
6217 | \r | |
6218 | Executes the CPUID instruction with EAX set to the value specified by Index\r | |
6219 | and ECX set to the value specified by SubIndex. This function always returns\r | |
6220 | Index. This function is only available on IA-32 and x64.\r | |
6221 | \r | |
6222 | If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.\r | |
6223 | If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.\r | |
6224 | If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.\r | |
6225 | If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.\r | |
6226 | \r | |
6227 | @param Index The 32-bit value to load into EAX prior to invoking the\r | |
6228 | CPUID instruction.\r | |
6229 | @param SubIndex The 32-bit value to load into ECX prior to invoking the\r | |
6230 | CPUID instruction.\r | |
af2dc6a7 | 6231 | @param Eax The pointer to the 32-bit EAX value returned by the CPUID\r |
ac644614 | 6232 | instruction. This is an optional parameter that may be\r |
6233 | NULL.\r | |
af2dc6a7 | 6234 | @param Ebx The pointer to the 32-bit EBX value returned by the CPUID\r |
ac644614 | 6235 | instruction. This is an optional parameter that may be\r |
6236 | NULL.\r | |
af2dc6a7 | 6237 | @param Ecx The pointer to the 32-bit ECX value returned by the CPUID\r |
ac644614 | 6238 | instruction. This is an optional parameter that may be\r |
6239 | NULL.\r | |
af2dc6a7 | 6240 | @param Edx The pointer to the 32-bit EDX value returned by the CPUID\r |
ac644614 | 6241 | instruction. This is an optional parameter that may be\r |
6242 | NULL.\r | |
6243 | \r | |
2fe241a2 | 6244 | @return Index.\r |
ac644614 | 6245 | \r |
6246 | **/\r | |
6247 | UINT32\r | |
6248 | EFIAPI\r | |
6249 | AsmCpuidEx (\r | |
6250 | IN UINT32 Index,\r | |
6251 | IN UINT32 SubIndex,\r | |
6252 | OUT UINT32 *Eax, OPTIONAL\r | |
6253 | OUT UINT32 *Ebx, OPTIONAL\r | |
6254 | OUT UINT32 *Ecx, OPTIONAL\r | |
6255 | OUT UINT32 *Edx OPTIONAL\r | |
6256 | );\r | |
6257 | \r | |
6258 | \r | |
be5f1614 | 6259 | /**\r |
6260 | Set CD bit and clear NW bit of CR0 followed by a WBINVD.\r | |
6261 | \r | |
6262 | Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0,\r | |
6263 | and executing a WBINVD instruction. This function is only available on IA-32 and x64.\r | |
6264 | \r | |
6265 | **/\r | |
6266 | VOID\r | |
6267 | EFIAPI\r | |
6268 | AsmDisableCache (\r | |
6269 | VOID\r | |
6270 | );\r | |
6271 | \r | |
6272 | \r | |
6273 | /**\r | |
6274 | Perform a WBINVD and clear both the CD and NW bits of CR0.\r | |
6275 | \r | |
6276 | Enables the caches by executing a WBINVD instruction and then clear both the CD and NW\r | |
6277 | bits of CR0 to 0. This function is only available on IA-32 and x64.\r | |
6278 | \r | |
6279 | **/\r | |
6280 | VOID\r | |
6281 | EFIAPI\r | |
6282 | AsmEnableCache (\r | |
6283 | VOID\r | |
6284 | );\r | |
6285 | \r | |
6286 | \r | |
ac644614 | 6287 | /**\r |
6288 | Returns the lower 32-bits of a Machine Specific Register(MSR).\r | |
6289 | \r | |
6290 | Reads and returns the lower 32-bits of the MSR specified by Index.\r | |
6291 | No parameter checking is performed on Index, and some Index values may cause\r | |
6292 | CPU exceptions. The caller must either guarantee that Index is valid, or the\r | |
6293 | caller must set up exception handlers to catch the exceptions. This function\r | |
030cd1a2 | 6294 | is only available on IA-32 and x64.\r |
ac644614 | 6295 | \r |
6296 | @param Index The 32-bit MSR index to read.\r | |
6297 | \r | |
6298 | @return The lower 32 bits of the MSR identified by Index.\r | |
6299 | \r | |
6300 | **/\r | |
6301 | UINT32\r | |
6302 | EFIAPI\r | |
6303 | AsmReadMsr32 (\r | |
6304 | IN UINT32 Index\r | |
6305 | );\r | |
6306 | \r | |
6307 | \r | |
6308 | /**\r | |
17f695ed | 6309 | Writes a 32-bit value to a Machine Specific Register(MSR), and returns the value.\r |
6310 | The upper 32-bits of the MSR are set to zero.\r | |
ac644614 | 6311 | \r |
6312 | Writes the 32-bit value specified by Value to the MSR specified by Index. The\r | |
6313 | upper 32-bits of the MSR write are set to zero. The 32-bit value written to\r | |
6314 | the MSR is returned. No parameter checking is performed on Index or Value,\r | |
6315 | and some of these may cause CPU exceptions. The caller must either guarantee\r | |
6316 | that Index and Value are valid, or the caller must establish proper exception\r | |
030cd1a2 | 6317 | handlers. This function is only available on IA-32 and x64.\r |
ac644614 | 6318 | \r |
6319 | @param Index The 32-bit MSR index to write.\r | |
6320 | @param Value The 32-bit value to write to the MSR.\r | |
6321 | \r | |
6322 | @return Value\r | |
6323 | \r | |
6324 | **/\r | |
6325 | UINT32\r | |
6326 | EFIAPI\r | |
6327 | AsmWriteMsr32 (\r | |
6328 | IN UINT32 Index,\r | |
6329 | IN UINT32 Value\r | |
6330 | );\r | |
6331 | \r | |
6332 | \r | |
6333 | /**\r | |
62991af2 | 6334 | Reads a 64-bit MSR, performs a bitwise OR on the lower 32-bits, and\r |
ac644614 | 6335 | writes the result back to the 64-bit MSR.\r |
6336 | \r | |
62991af2 | 6337 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 6338 | between the lower 32-bits of the read result and the value specified by\r |
6339 | OrData, and writes the result to the 64-bit MSR specified by Index. The lower\r | |
6340 | 32-bits of the value written to the MSR is returned. No parameter checking is\r | |
6341 | performed on Index or OrData, and some of these may cause CPU exceptions. The\r | |
6342 | caller must either guarantee that Index and OrData are valid, or the caller\r | |
6343 | must establish proper exception handlers. This function is only available on\r | |
030cd1a2 | 6344 | IA-32 and x64.\r |
ac644614 | 6345 | \r |
6346 | @param Index The 32-bit MSR index to write.\r | |
6347 | @param OrData The value to OR with the read value from the MSR.\r | |
6348 | \r | |
6349 | @return The lower 32-bit value written to the MSR.\r | |
6350 | \r | |
6351 | **/\r | |
6352 | UINT32\r | |
6353 | EFIAPI\r | |
6354 | AsmMsrOr32 (\r | |
6355 | IN UINT32 Index,\r | |
6356 | IN UINT32 OrData\r | |
6357 | );\r | |
6358 | \r | |
6359 | \r | |
6360 | /**\r | |
6361 | Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes\r | |
6362 | the result back to the 64-bit MSR.\r | |
6363 | \r | |
6364 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6365 | lower 32-bits of the read result and the value specified by AndData, and\r | |
6366 | writes the result to the 64-bit MSR specified by Index. The lower 32-bits of\r | |
6367 | the value written to the MSR is returned. No parameter checking is performed\r | |
6368 | on Index or AndData, and some of these may cause CPU exceptions. The caller\r | |
6369 | must either guarantee that Index and AndData are valid, or the caller must\r | |
6370 | establish proper exception handlers. This function is only available on IA-32\r | |
030cd1a2 | 6371 | and x64.\r |
ac644614 | 6372 | \r |
6373 | @param Index The 32-bit MSR index to write.\r | |
6374 | @param AndData The value to AND with the read value from the MSR.\r | |
6375 | \r | |
6376 | @return The lower 32-bit value written to the MSR.\r | |
6377 | \r | |
6378 | **/\r | |
6379 | UINT32\r | |
6380 | EFIAPI\r | |
6381 | AsmMsrAnd32 (\r | |
6382 | IN UINT32 Index,\r | |
6383 | IN UINT32 AndData\r | |
6384 | );\r | |
6385 | \r | |
6386 | \r | |
6387 | /**\r | |
62991af2 | 6388 | Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise OR\r |
ac644614 | 6389 | on the lower 32-bits, and writes the result back to the 64-bit MSR.\r |
6390 | \r | |
6391 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6392 | lower 32-bits of the read result and the value specified by AndData\r | |
62991af2 | 6393 | preserving the upper 32-bits, performs a bitwise OR between the\r |
ac644614 | 6394 | result of the AND operation and the value specified by OrData, and writes the\r |
6395 | result to the 64-bit MSR specified by Address. The lower 32-bits of the value\r | |
6396 | written to the MSR is returned. No parameter checking is performed on Index,\r | |
6397 | AndData, or OrData, and some of these may cause CPU exceptions. The caller\r | |
6398 | must either guarantee that Index, AndData, and OrData are valid, or the\r | |
6399 | caller must establish proper exception handlers. This function is only\r | |
030cd1a2 | 6400 | available on IA-32 and x64.\r |
ac644614 | 6401 | \r |
6402 | @param Index The 32-bit MSR index to write.\r | |
6403 | @param AndData The value to AND with the read value from the MSR.\r | |
6404 | @param OrData The value to OR with the result of the AND operation.\r | |
6405 | \r | |
6406 | @return The lower 32-bit value written to the MSR.\r | |
6407 | \r | |
6408 | **/\r | |
6409 | UINT32\r | |
6410 | EFIAPI\r | |
6411 | AsmMsrAndThenOr32 (\r | |
6412 | IN UINT32 Index,\r | |
6413 | IN UINT32 AndData,\r | |
6414 | IN UINT32 OrData\r | |
6415 | );\r | |
6416 | \r | |
6417 | \r | |
6418 | /**\r | |
6419 | Reads a bit field of an MSR.\r | |
6420 | \r | |
6421 | Reads the bit field in the lower 32-bits of a 64-bit MSR. The bit field is\r | |
6422 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
6423 | returned. The caller must either guarantee that Index is valid, or the caller\r | |
6424 | must set up exception handlers to catch the exceptions. This function is only\r | |
030cd1a2 | 6425 | available on IA-32 and x64.\r |
ac644614 | 6426 | \r |
6427 | If StartBit is greater than 31, then ASSERT().\r | |
6428 | If EndBit is greater than 31, then ASSERT().\r | |
6429 | If EndBit is less than StartBit, then ASSERT().\r | |
6430 | \r | |
6431 | @param Index The 32-bit MSR index to read.\r | |
6432 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6433 | Range 0..31.\r | |
6434 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6435 | Range 0..31.\r | |
6436 | \r | |
6437 | @return The bit field read from the MSR.\r | |
6438 | \r | |
6439 | **/\r | |
6440 | UINT32\r | |
6441 | EFIAPI\r | |
6442 | AsmMsrBitFieldRead32 (\r | |
6443 | IN UINT32 Index,\r | |
6444 | IN UINTN StartBit,\r | |
6445 | IN UINTN EndBit\r | |
6446 | );\r | |
6447 | \r | |
6448 | \r | |
6449 | /**\r | |
6450 | Writes a bit field to an MSR.\r | |
6451 | \r | |
2fe241a2 | 6452 | Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit\r |
ac644614 | 6453 | field is specified by the StartBit and the EndBit. All other bits in the\r |
6454 | destination MSR are preserved. The lower 32-bits of the MSR written is\r | |
62991af2 | 6455 | returned. The caller must either guarantee that Index and the data written \r |
6456 | is valid, or the caller must set up exception handlers to catch the exceptions. \r | |
6457 | This function is only available on IA-32 and x64.\r | |
ac644614 | 6458 | \r |
6459 | If StartBit is greater than 31, then ASSERT().\r | |
6460 | If EndBit is greater than 31, then ASSERT().\r | |
6461 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6462 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6463 | \r |
6464 | @param Index The 32-bit MSR index to write.\r | |
6465 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6466 | Range 0..31.\r | |
6467 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6468 | Range 0..31.\r | |
6469 | @param Value New value of the bit field.\r | |
6470 | \r | |
6471 | @return The lower 32-bit of the value written to the MSR.\r | |
6472 | \r | |
6473 | **/\r | |
6474 | UINT32\r | |
6475 | EFIAPI\r | |
6476 | AsmMsrBitFieldWrite32 (\r | |
6477 | IN UINT32 Index,\r | |
6478 | IN UINTN StartBit,\r | |
6479 | IN UINTN EndBit,\r | |
6480 | IN UINT32 Value\r | |
6481 | );\r | |
6482 | \r | |
6483 | \r | |
6484 | /**\r | |
6485 | Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the\r | |
6486 | result back to the bit field in the 64-bit MSR.\r | |
6487 | \r | |
62991af2 | 6488 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 6489 | between the read result and the value specified by OrData, and writes the\r |
6490 | result to the 64-bit MSR specified by Index. The lower 32-bits of the value\r | |
6491 | written to the MSR are returned. Extra left bits in OrData are stripped. The\r | |
6492 | caller must either guarantee that Index and the data written is valid, or\r | |
6493 | the caller must set up exception handlers to catch the exceptions. This\r | |
030cd1a2 | 6494 | function is only available on IA-32 and x64.\r |
ac644614 | 6495 | \r |
6496 | If StartBit is greater than 31, then ASSERT().\r | |
6497 | If EndBit is greater than 31, then ASSERT().\r | |
6498 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6499 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6500 | \r |
6501 | @param Index The 32-bit MSR index to write.\r | |
6502 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6503 | Range 0..31.\r | |
6504 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6505 | Range 0..31.\r | |
6506 | @param OrData The value to OR with the read value from the MSR.\r | |
6507 | \r | |
6508 | @return The lower 32-bit of the value written to the MSR.\r | |
6509 | \r | |
6510 | **/\r | |
6511 | UINT32\r | |
6512 | EFIAPI\r | |
6513 | AsmMsrBitFieldOr32 (\r | |
6514 | IN UINT32 Index,\r | |
6515 | IN UINTN StartBit,\r | |
6516 | IN UINTN EndBit,\r | |
6517 | IN UINT32 OrData\r | |
6518 | );\r | |
6519 | \r | |
6520 | \r | |
6521 | /**\r | |
6522 | Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r | |
6523 | result back to the bit field in the 64-bit MSR.\r | |
6524 | \r | |
6525 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6526 | read result and the value specified by AndData, and writes the result to the\r | |
6527 | 64-bit MSR specified by Index. The lower 32-bits of the value written to the\r | |
6528 | MSR are returned. Extra left bits in AndData are stripped. The caller must\r | |
6529 | either guarantee that Index and the data written is valid, or the caller must\r | |
6530 | set up exception handlers to catch the exceptions. This function is only\r | |
030cd1a2 | 6531 | available on IA-32 and x64.\r |
ac644614 | 6532 | \r |
6533 | If StartBit is greater than 31, then ASSERT().\r | |
6534 | If EndBit is greater than 31, then ASSERT().\r | |
6535 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6536 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6537 | \r |
6538 | @param Index The 32-bit MSR index to write.\r | |
6539 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6540 | Range 0..31.\r | |
6541 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6542 | Range 0..31.\r | |
6543 | @param AndData The value to AND with the read value from the MSR.\r | |
6544 | \r | |
6545 | @return The lower 32-bit of the value written to the MSR.\r | |
6546 | \r | |
6547 | **/\r | |
6548 | UINT32\r | |
6549 | EFIAPI\r | |
6550 | AsmMsrBitFieldAnd32 (\r | |
6551 | IN UINT32 Index,\r | |
6552 | IN UINTN StartBit,\r | |
6553 | IN UINTN EndBit,\r | |
6554 | IN UINT32 AndData\r | |
6555 | );\r | |
6556 | \r | |
6557 | \r | |
6558 | /**\r | |
6559 | Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r | |
62991af2 | 6560 | bitwise OR, and writes the result back to the bit field in the\r |
ac644614 | 6561 | 64-bit MSR.\r |
6562 | \r | |
6563 | Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by a\r | |
62991af2 | 6564 | bitwise OR between the read result and the value specified by\r |
ac644614 | 6565 | AndData, and writes the result to the 64-bit MSR specified by Index. The\r |
6566 | lower 32-bits of the value written to the MSR are returned. Extra left bits\r | |
6567 | in both AndData and OrData are stripped. The caller must either guarantee\r | |
6568 | that Index and the data written is valid, or the caller must set up exception\r | |
6569 | handlers to catch the exceptions. This function is only available on IA-32\r | |
030cd1a2 | 6570 | and x64.\r |
ac644614 | 6571 | \r |
6572 | If StartBit is greater than 31, then ASSERT().\r | |
6573 | If EndBit is greater than 31, then ASSERT().\r | |
6574 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
6575 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
6576 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 6577 | \r |
6578 | @param Index The 32-bit MSR index to write.\r | |
6579 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6580 | Range 0..31.\r | |
6581 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6582 | Range 0..31.\r | |
6583 | @param AndData The value to AND with the read value from the MSR.\r | |
6584 | @param OrData The value to OR with the result of the AND operation.\r | |
6585 | \r | |
6586 | @return The lower 32-bit of the value written to the MSR.\r | |
6587 | \r | |
6588 | **/\r | |
6589 | UINT32\r | |
6590 | EFIAPI\r | |
6591 | AsmMsrBitFieldAndThenOr32 (\r | |
6592 | IN UINT32 Index,\r | |
6593 | IN UINTN StartBit,\r | |
6594 | IN UINTN EndBit,\r | |
6595 | IN UINT32 AndData,\r | |
6596 | IN UINT32 OrData\r | |
6597 | );\r | |
6598 | \r | |
6599 | \r | |
6600 | /**\r | |
6601 | Returns a 64-bit Machine Specific Register(MSR).\r | |
6602 | \r | |
6603 | Reads and returns the 64-bit MSR specified by Index. No parameter checking is\r | |
6604 | performed on Index, and some Index values may cause CPU exceptions. The\r | |
6605 | caller must either guarantee that Index is valid, or the caller must set up\r | |
6606 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 6607 | on IA-32 and x64.\r |
ac644614 | 6608 | \r |
6609 | @param Index The 32-bit MSR index to read.\r | |
6610 | \r | |
6611 | @return The value of the MSR identified by Index.\r | |
6612 | \r | |
6613 | **/\r | |
6614 | UINT64\r | |
6615 | EFIAPI\r | |
6616 | AsmReadMsr64 (\r | |
6617 | IN UINT32 Index\r | |
6618 | );\r | |
6619 | \r | |
6620 | \r | |
6621 | /**\r | |
6622 | Writes a 64-bit value to a Machine Specific Register(MSR), and returns the\r | |
6623 | value.\r | |
6624 | \r | |
6625 | Writes the 64-bit value specified by Value to the MSR specified by Index. The\r | |
6626 | 64-bit value written to the MSR is returned. No parameter checking is\r | |
6627 | performed on Index or Value, and some of these may cause CPU exceptions. The\r | |
6628 | caller must either guarantee that Index and Value are valid, or the caller\r | |
6629 | must establish proper exception handlers. This function is only available on\r | |
030cd1a2 | 6630 | IA-32 and x64.\r |
ac644614 | 6631 | \r |
6632 | @param Index The 32-bit MSR index to write.\r | |
6633 | @param Value The 64-bit value to write to the MSR.\r | |
6634 | \r | |
6635 | @return Value\r | |
6636 | \r | |
6637 | **/\r | |
6638 | UINT64\r | |
6639 | EFIAPI\r | |
6640 | AsmWriteMsr64 (\r | |
6641 | IN UINT32 Index,\r | |
6642 | IN UINT64 Value\r | |
6643 | );\r | |
6644 | \r | |
6645 | \r | |
6646 | /**\r | |
62991af2 | 6647 | Reads a 64-bit MSR, performs a bitwise OR, and writes the result\r |
ac644614 | 6648 | back to the 64-bit MSR.\r |
6649 | \r | |
62991af2 | 6650 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 6651 | between the read result and the value specified by OrData, and writes the\r |
6652 | result to the 64-bit MSR specified by Index. The value written to the MSR is\r | |
6653 | returned. No parameter checking is performed on Index or OrData, and some of\r | |
6654 | these may cause CPU exceptions. The caller must either guarantee that Index\r | |
6655 | and OrData are valid, or the caller must establish proper exception handlers.\r | |
030cd1a2 | 6656 | This function is only available on IA-32 and x64.\r |
ac644614 | 6657 | \r |
6658 | @param Index The 32-bit MSR index to write.\r | |
6659 | @param OrData The value to OR with the read value from the MSR.\r | |
6660 | \r | |
6661 | @return The value written back to the MSR.\r | |
6662 | \r | |
6663 | **/\r | |
6664 | UINT64\r | |
6665 | EFIAPI\r | |
6666 | AsmMsrOr64 (\r | |
6667 | IN UINT32 Index,\r | |
6668 | IN UINT64 OrData\r | |
6669 | );\r | |
6670 | \r | |
6671 | \r | |
6672 | /**\r | |
6673 | Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the\r | |
6674 | 64-bit MSR.\r | |
6675 | \r | |
6676 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6677 | read result and the value specified by OrData, and writes the result to the\r | |
6678 | 64-bit MSR specified by Index. The value written to the MSR is returned. No\r | |
6679 | parameter checking is performed on Index or OrData, and some of these may\r | |
6680 | cause CPU exceptions. The caller must either guarantee that Index and OrData\r | |
6681 | are valid, or the caller must establish proper exception handlers. This\r | |
030cd1a2 | 6682 | function is only available on IA-32 and x64.\r |
ac644614 | 6683 | \r |
6684 | @param Index The 32-bit MSR index to write.\r | |
6685 | @param AndData The value to AND with the read value from the MSR.\r | |
6686 | \r | |
6687 | @return The value written back to the MSR.\r | |
6688 | \r | |
6689 | **/\r | |
6690 | UINT64\r | |
6691 | EFIAPI\r | |
6692 | AsmMsrAnd64 (\r | |
6693 | IN UINT32 Index,\r | |
6694 | IN UINT64 AndData\r | |
6695 | );\r | |
6696 | \r | |
6697 | \r | |
6698 | /**\r | |
62991af2 | 6699 | Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise \r |
ac644614 | 6700 | OR, and writes the result back to the 64-bit MSR.\r |
6701 | \r | |
6702 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between read\r | |
62991af2 | 6703 | result and the value specified by AndData, performs a bitwise OR\r |
ac644614 | 6704 | between the result of the AND operation and the value specified by OrData,\r |
6705 | and writes the result to the 64-bit MSR specified by Index. The value written\r | |
6706 | to the MSR is returned. No parameter checking is performed on Index, AndData,\r | |
6707 | or OrData, and some of these may cause CPU exceptions. The caller must either\r | |
6708 | guarantee that Index, AndData, and OrData are valid, or the caller must\r | |
6709 | establish proper exception handlers. This function is only available on IA-32\r | |
030cd1a2 | 6710 | and x64.\r |
ac644614 | 6711 | \r |
6712 | @param Index The 32-bit MSR index to write.\r | |
6713 | @param AndData The value to AND with the read value from the MSR.\r | |
6714 | @param OrData The value to OR with the result of the AND operation.\r | |
6715 | \r | |
6716 | @return The value written back to the MSR.\r | |
6717 | \r | |
6718 | **/\r | |
6719 | UINT64\r | |
6720 | EFIAPI\r | |
6721 | AsmMsrAndThenOr64 (\r | |
6722 | IN UINT32 Index,\r | |
6723 | IN UINT64 AndData,\r | |
6724 | IN UINT64 OrData\r | |
6725 | );\r | |
6726 | \r | |
6727 | \r | |
6728 | /**\r | |
6729 | Reads a bit field of an MSR.\r | |
6730 | \r | |
6731 | Reads the bit field in the 64-bit MSR. The bit field is specified by the\r | |
6732 | StartBit and the EndBit. The value of the bit field is returned. The caller\r | |
6733 | must either guarantee that Index is valid, or the caller must set up\r | |
6734 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 6735 | on IA-32 and x64.\r |
ac644614 | 6736 | \r |
6737 | If StartBit is greater than 63, then ASSERT().\r | |
6738 | If EndBit is greater than 63, then ASSERT().\r | |
6739 | If EndBit is less than StartBit, then ASSERT().\r | |
6740 | \r | |
6741 | @param Index The 32-bit MSR index to read.\r | |
6742 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6743 | Range 0..63.\r | |
6744 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6745 | Range 0..63.\r | |
6746 | \r | |
6747 | @return The value read from the MSR.\r | |
6748 | \r | |
6749 | **/\r | |
6750 | UINT64\r | |
6751 | EFIAPI\r | |
6752 | AsmMsrBitFieldRead64 (\r | |
6753 | IN UINT32 Index,\r | |
6754 | IN UINTN StartBit,\r | |
6755 | IN UINTN EndBit\r | |
6756 | );\r | |
6757 | \r | |
6758 | \r | |
6759 | /**\r | |
6760 | Writes a bit field to an MSR.\r | |
6761 | \r | |
6762 | Writes Value to a bit field in a 64-bit MSR. The bit field is specified by\r | |
6763 | the StartBit and the EndBit. All other bits in the destination MSR are\r | |
62991af2 | 6764 | preserved. The MSR written is returned. The caller must either guarantee \r |
6765 | that Index and the data written is valid, or the caller must set up exception \r | |
6766 | handlers to catch the exceptions. This function is only available on IA-32 and x64.\r | |
ac644614 | 6767 | \r |
6768 | If StartBit is greater than 63, then ASSERT().\r | |
6769 | If EndBit is greater than 63, then ASSERT().\r | |
6770 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6771 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6772 | \r |
6773 | @param Index The 32-bit MSR index to write.\r | |
6774 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6775 | Range 0..63.\r | |
6776 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6777 | Range 0..63.\r | |
6778 | @param Value New value of the bit field.\r | |
6779 | \r | |
6780 | @return The value written back to the MSR.\r | |
6781 | \r | |
6782 | **/\r | |
6783 | UINT64\r | |
6784 | EFIAPI\r | |
6785 | AsmMsrBitFieldWrite64 (\r | |
6786 | IN UINT32 Index,\r | |
6787 | IN UINTN StartBit,\r | |
6788 | IN UINTN EndBit,\r | |
6789 | IN UINT64 Value\r | |
6790 | );\r | |
6791 | \r | |
6792 | \r | |
6793 | /**\r | |
62991af2 | 6794 | Reads a bit field in a 64-bit MSR, performs a bitwise OR, and\r |
ac644614 | 6795 | writes the result back to the bit field in the 64-bit MSR.\r |
6796 | \r | |
62991af2 | 6797 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 6798 | between the read result and the value specified by OrData, and writes the\r |
6799 | result to the 64-bit MSR specified by Index. The value written to the MSR is\r | |
6800 | returned. Extra left bits in OrData are stripped. The caller must either\r | |
6801 | guarantee that Index and the data written is valid, or the caller must set up\r | |
6802 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 6803 | on IA-32 and x64.\r |
ac644614 | 6804 | \r |
6805 | If StartBit is greater than 63, then ASSERT().\r | |
6806 | If EndBit is greater than 63, then ASSERT().\r | |
6807 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6808 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6809 | \r |
6810 | @param Index The 32-bit MSR index to write.\r | |
6811 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6812 | Range 0..63.\r | |
6813 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6814 | Range 0..63.\r | |
6815 | @param OrData The value to OR with the read value from the bit field.\r | |
6816 | \r | |
6817 | @return The value written back to the MSR.\r | |
6818 | \r | |
6819 | **/\r | |
6820 | UINT64\r | |
6821 | EFIAPI\r | |
6822 | AsmMsrBitFieldOr64 (\r | |
6823 | IN UINT32 Index,\r | |
6824 | IN UINTN StartBit,\r | |
6825 | IN UINTN EndBit,\r | |
6826 | IN UINT64 OrData\r | |
6827 | );\r | |
6828 | \r | |
6829 | \r | |
6830 | /**\r | |
6831 | Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r | |
6832 | result back to the bit field in the 64-bit MSR.\r | |
6833 | \r | |
6834 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6835 | read result and the value specified by AndData, and writes the result to the\r | |
6836 | 64-bit MSR specified by Index. The value written to the MSR is returned.\r | |
6837 | Extra left bits in AndData are stripped. The caller must either guarantee\r | |
6838 | that Index and the data written is valid, or the caller must set up exception\r | |
6839 | handlers to catch the exceptions. This function is only available on IA-32\r | |
030cd1a2 | 6840 | and x64.\r |
ac644614 | 6841 | \r |
6842 | If StartBit is greater than 63, then ASSERT().\r | |
6843 | If EndBit is greater than 63, then ASSERT().\r | |
6844 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6845 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6846 | \r |
6847 | @param Index The 32-bit MSR index to write.\r | |
6848 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6849 | Range 0..63.\r | |
6850 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6851 | Range 0..63.\r | |
6852 | @param AndData The value to AND with the read value from the bit field.\r | |
6853 | \r | |
6854 | @return The value written back to the MSR.\r | |
6855 | \r | |
6856 | **/\r | |
6857 | UINT64\r | |
6858 | EFIAPI\r | |
6859 | AsmMsrBitFieldAnd64 (\r | |
6860 | IN UINT32 Index,\r | |
6861 | IN UINTN StartBit,\r | |
6862 | IN UINTN EndBit,\r | |
6863 | IN UINT64 AndData\r | |
6864 | );\r | |
6865 | \r | |
6866 | \r | |
6867 | /**\r | |
6868 | Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r | |
62991af2 | 6869 | bitwise OR, and writes the result back to the bit field in the\r |
ac644614 | 6870 | 64-bit MSR.\r |
6871 | \r | |
6872 | Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by\r | |
62991af2 | 6873 | a bitwise OR between the read result and the value specified by\r |
ac644614 | 6874 | AndData, and writes the result to the 64-bit MSR specified by Index. The\r |
6875 | value written to the MSR is returned. Extra left bits in both AndData and\r | |
6876 | OrData are stripped. The caller must either guarantee that Index and the data\r | |
6877 | written is valid, or the caller must set up exception handlers to catch the\r | |
030cd1a2 | 6878 | exceptions. This function is only available on IA-32 and x64.\r |
ac644614 | 6879 | \r |
6880 | If StartBit is greater than 63, then ASSERT().\r | |
6881 | If EndBit is greater than 63, then ASSERT().\r | |
6882 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
6883 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
6884 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 6885 | \r |
6886 | @param Index The 32-bit MSR index to write.\r | |
6887 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6888 | Range 0..63.\r | |
6889 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6890 | Range 0..63.\r | |
6891 | @param AndData The value to AND with the read value from the bit field.\r | |
6892 | @param OrData The value to OR with the result of the AND operation.\r | |
6893 | \r | |
6894 | @return The value written back to the MSR.\r | |
6895 | \r | |
6896 | **/\r | |
6897 | UINT64\r | |
6898 | EFIAPI\r | |
6899 | AsmMsrBitFieldAndThenOr64 (\r | |
6900 | IN UINT32 Index,\r | |
6901 | IN UINTN StartBit,\r | |
6902 | IN UINTN EndBit,\r | |
6903 | IN UINT64 AndData,\r | |
6904 | IN UINT64 OrData\r | |
6905 | );\r | |
6906 | \r | |
6907 | \r | |
6908 | /**\r | |
6909 | Reads the current value of the EFLAGS register.\r | |
6910 | \r | |
6911 | Reads and returns the current value of the EFLAGS register. This function is\r | |
030cd1a2 | 6912 | only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a\r |
6913 | 64-bit value on x64.\r | |
ac644614 | 6914 | \r |
030cd1a2 | 6915 | @return EFLAGS on IA-32 or RFLAGS on x64.\r |
ac644614 | 6916 | \r |
6917 | **/\r | |
6918 | UINTN\r | |
6919 | EFIAPI\r | |
6920 | AsmReadEflags (\r | |
6921 | VOID\r | |
6922 | );\r | |
6923 | \r | |
6924 | \r | |
6925 | /**\r | |
6926 | Reads the current value of the Control Register 0 (CR0).\r | |
6927 | \r | |
6928 | Reads and returns the current value of CR0. This function is only available\r | |
030cd1a2 | 6929 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
6930 | x64.\r | |
ac644614 | 6931 | \r |
6932 | @return The value of the Control Register 0 (CR0).\r | |
6933 | \r | |
6934 | **/\r | |
6935 | UINTN\r | |
6936 | EFIAPI\r | |
6937 | AsmReadCr0 (\r | |
6938 | VOID\r | |
6939 | );\r | |
6940 | \r | |
6941 | \r | |
6942 | /**\r | |
6943 | Reads the current value of the Control Register 2 (CR2).\r | |
6944 | \r | |
6945 | Reads and returns the current value of CR2. This function is only available\r | |
030cd1a2 | 6946 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
6947 | x64.\r | |
ac644614 | 6948 | \r |
6949 | @return The value of the Control Register 2 (CR2).\r | |
6950 | \r | |
6951 | **/\r | |
6952 | UINTN\r | |
6953 | EFIAPI\r | |
6954 | AsmReadCr2 (\r | |
6955 | VOID\r | |
6956 | );\r | |
6957 | \r | |
6958 | \r | |
6959 | /**\r | |
6960 | Reads the current value of the Control Register 3 (CR3).\r | |
6961 | \r | |
6962 | Reads and returns the current value of CR3. This function is only available\r | |
030cd1a2 | 6963 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
6964 | x64.\r | |
ac644614 | 6965 | \r |
6966 | @return The value of the Control Register 3 (CR3).\r | |
6967 | \r | |
6968 | **/\r | |
6969 | UINTN\r | |
6970 | EFIAPI\r | |
6971 | AsmReadCr3 (\r | |
6972 | VOID\r | |
6973 | );\r | |
6974 | \r | |
6975 | \r | |
6976 | /**\r | |
6977 | Reads the current value of the Control Register 4 (CR4).\r | |
6978 | \r | |
6979 | Reads and returns the current value of CR4. This function is only available\r | |
030cd1a2 | 6980 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
6981 | x64.\r | |
ac644614 | 6982 | \r |
6983 | @return The value of the Control Register 4 (CR4).\r | |
6984 | \r | |
6985 | **/\r | |
6986 | UINTN\r | |
6987 | EFIAPI\r | |
6988 | AsmReadCr4 (\r | |
6989 | VOID\r | |
6990 | );\r | |
6991 | \r | |
6992 | \r | |
6993 | /**\r | |
6994 | Writes a value to Control Register 0 (CR0).\r | |
6995 | \r | |
6996 | Writes and returns a new value to CR0. This function is only available on\r | |
030cd1a2 | 6997 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6998 | \r |
6999 | @param Cr0 The value to write to CR0.\r | |
7000 | \r | |
7001 | @return The value written to CR0.\r | |
7002 | \r | |
7003 | **/\r | |
7004 | UINTN\r | |
7005 | EFIAPI\r | |
7006 | AsmWriteCr0 (\r | |
7007 | UINTN Cr0\r | |
7008 | );\r | |
7009 | \r | |
7010 | \r | |
7011 | /**\r | |
7012 | Writes a value to Control Register 2 (CR2).\r | |
7013 | \r | |
7014 | Writes and returns a new value to CR2. This function is only available on\r | |
030cd1a2 | 7015 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7016 | \r |
7017 | @param Cr2 The value to write to CR2.\r | |
7018 | \r | |
7019 | @return The value written to CR2.\r | |
7020 | \r | |
7021 | **/\r | |
7022 | UINTN\r | |
7023 | EFIAPI\r | |
7024 | AsmWriteCr2 (\r | |
7025 | UINTN Cr2\r | |
7026 | );\r | |
7027 | \r | |
7028 | \r | |
7029 | /**\r | |
7030 | Writes a value to Control Register 3 (CR3).\r | |
7031 | \r | |
7032 | Writes and returns a new value to CR3. This function is only available on\r | |
030cd1a2 | 7033 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7034 | \r |
7035 | @param Cr3 The value to write to CR3.\r | |
7036 | \r | |
7037 | @return The value written to CR3.\r | |
7038 | \r | |
7039 | **/\r | |
7040 | UINTN\r | |
7041 | EFIAPI\r | |
7042 | AsmWriteCr3 (\r | |
7043 | UINTN Cr3\r | |
7044 | );\r | |
7045 | \r | |
7046 | \r | |
7047 | /**\r | |
7048 | Writes a value to Control Register 4 (CR4).\r | |
7049 | \r | |
7050 | Writes and returns a new value to CR4. This function is only available on\r | |
030cd1a2 | 7051 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7052 | \r |
7053 | @param Cr4 The value to write to CR4.\r | |
7054 | \r | |
7055 | @return The value written to CR4.\r | |
7056 | \r | |
7057 | **/\r | |
7058 | UINTN\r | |
7059 | EFIAPI\r | |
7060 | AsmWriteCr4 (\r | |
7061 | UINTN Cr4\r | |
7062 | );\r | |
7063 | \r | |
7064 | \r | |
7065 | /**\r | |
7066 | Reads the current value of Debug Register 0 (DR0).\r | |
7067 | \r | |
7068 | Reads and returns the current value of DR0. This function is only available\r | |
030cd1a2 | 7069 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7070 | x64.\r | |
ac644614 | 7071 | \r |
7072 | @return The value of Debug Register 0 (DR0).\r | |
7073 | \r | |
7074 | **/\r | |
7075 | UINTN\r | |
7076 | EFIAPI\r | |
7077 | AsmReadDr0 (\r | |
7078 | VOID\r | |
7079 | );\r | |
7080 | \r | |
7081 | \r | |
7082 | /**\r | |
7083 | Reads the current value of Debug Register 1 (DR1).\r | |
7084 | \r | |
7085 | Reads and returns the current value of DR1. This function is only available\r | |
030cd1a2 | 7086 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7087 | x64.\r | |
ac644614 | 7088 | \r |
7089 | @return The value of Debug Register 1 (DR1).\r | |
7090 | \r | |
7091 | **/\r | |
7092 | UINTN\r | |
7093 | EFIAPI\r | |
7094 | AsmReadDr1 (\r | |
7095 | VOID\r | |
7096 | );\r | |
7097 | \r | |
7098 | \r | |
7099 | /**\r | |
7100 | Reads the current value of Debug Register 2 (DR2).\r | |
7101 | \r | |
7102 | Reads and returns the current value of DR2. This function is only available\r | |
030cd1a2 | 7103 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7104 | x64.\r | |
ac644614 | 7105 | \r |
7106 | @return The value of Debug Register 2 (DR2).\r | |
7107 | \r | |
7108 | **/\r | |
7109 | UINTN\r | |
7110 | EFIAPI\r | |
7111 | AsmReadDr2 (\r | |
7112 | VOID\r | |
7113 | );\r | |
7114 | \r | |
7115 | \r | |
7116 | /**\r | |
7117 | Reads the current value of Debug Register 3 (DR3).\r | |
7118 | \r | |
7119 | Reads and returns the current value of DR3. This function is only available\r | |
030cd1a2 | 7120 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7121 | x64.\r | |
ac644614 | 7122 | \r |
7123 | @return The value of Debug Register 3 (DR3).\r | |
7124 | \r | |
7125 | **/\r | |
7126 | UINTN\r | |
7127 | EFIAPI\r | |
7128 | AsmReadDr3 (\r | |
7129 | VOID\r | |
7130 | );\r | |
7131 | \r | |
7132 | \r | |
7133 | /**\r | |
7134 | Reads the current value of Debug Register 4 (DR4).\r | |
7135 | \r | |
7136 | Reads and returns the current value of DR4. This function is only available\r | |
030cd1a2 | 7137 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7138 | x64.\r | |
ac644614 | 7139 | \r |
7140 | @return The value of Debug Register 4 (DR4).\r | |
7141 | \r | |
7142 | **/\r | |
7143 | UINTN\r | |
7144 | EFIAPI\r | |
7145 | AsmReadDr4 (\r | |
7146 | VOID\r | |
7147 | );\r | |
7148 | \r | |
7149 | \r | |
7150 | /**\r | |
7151 | Reads the current value of Debug Register 5 (DR5).\r | |
7152 | \r | |
7153 | Reads and returns the current value of DR5. This function is only available\r | |
030cd1a2 | 7154 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7155 | x64.\r | |
ac644614 | 7156 | \r |
7157 | @return The value of Debug Register 5 (DR5).\r | |
7158 | \r | |
7159 | **/\r | |
7160 | UINTN\r | |
7161 | EFIAPI\r | |
7162 | AsmReadDr5 (\r | |
7163 | VOID\r | |
7164 | );\r | |
7165 | \r | |
7166 | \r | |
7167 | /**\r | |
7168 | Reads the current value of Debug Register 6 (DR6).\r | |
7169 | \r | |
7170 | Reads and returns the current value of DR6. This function is only available\r | |
030cd1a2 | 7171 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7172 | x64.\r | |
ac644614 | 7173 | \r |
7174 | @return The value of Debug Register 6 (DR6).\r | |
7175 | \r | |
7176 | **/\r | |
7177 | UINTN\r | |
7178 | EFIAPI\r | |
7179 | AsmReadDr6 (\r | |
7180 | VOID\r | |
7181 | );\r | |
7182 | \r | |
7183 | \r | |
7184 | /**\r | |
7185 | Reads the current value of Debug Register 7 (DR7).\r | |
7186 | \r | |
7187 | Reads and returns the current value of DR7. This function is only available\r | |
030cd1a2 | 7188 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7189 | x64.\r | |
ac644614 | 7190 | \r |
7191 | @return The value of Debug Register 7 (DR7).\r | |
7192 | \r | |
7193 | **/\r | |
7194 | UINTN\r | |
7195 | EFIAPI\r | |
7196 | AsmReadDr7 (\r | |
7197 | VOID\r | |
7198 | );\r | |
7199 | \r | |
7200 | \r | |
7201 | /**\r | |
7202 | Writes a value to Debug Register 0 (DR0).\r | |
7203 | \r | |
7204 | Writes and returns a new value to DR0. This function is only available on\r | |
030cd1a2 | 7205 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7206 | \r |
7207 | @param Dr0 The value to write to Dr0.\r | |
7208 | \r | |
7209 | @return The value written to Debug Register 0 (DR0).\r | |
7210 | \r | |
7211 | **/\r | |
7212 | UINTN\r | |
7213 | EFIAPI\r | |
7214 | AsmWriteDr0 (\r | |
7215 | UINTN Dr0\r | |
7216 | );\r | |
7217 | \r | |
7218 | \r | |
7219 | /**\r | |
7220 | Writes a value to Debug Register 1 (DR1).\r | |
7221 | \r | |
7222 | Writes and returns a new value to DR1. This function is only available on\r | |
030cd1a2 | 7223 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7224 | \r |
7225 | @param Dr1 The value to write to Dr1.\r | |
7226 | \r | |
7227 | @return The value written to Debug Register 1 (DR1).\r | |
7228 | \r | |
7229 | **/\r | |
7230 | UINTN\r | |
7231 | EFIAPI\r | |
7232 | AsmWriteDr1 (\r | |
7233 | UINTN Dr1\r | |
7234 | );\r | |
7235 | \r | |
7236 | \r | |
7237 | /**\r | |
7238 | Writes a value to Debug Register 2 (DR2).\r | |
7239 | \r | |
7240 | Writes and returns a new value to DR2. This function is only available on\r | |
030cd1a2 | 7241 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7242 | \r |
7243 | @param Dr2 The value to write to Dr2.\r | |
7244 | \r | |
7245 | @return The value written to Debug Register 2 (DR2).\r | |
7246 | \r | |
7247 | **/\r | |
7248 | UINTN\r | |
7249 | EFIAPI\r | |
7250 | AsmWriteDr2 (\r | |
7251 | UINTN Dr2\r | |
7252 | );\r | |
7253 | \r | |
7254 | \r | |
7255 | /**\r | |
7256 | Writes a value to Debug Register 3 (DR3).\r | |
7257 | \r | |
7258 | Writes and returns a new value to DR3. This function is only available on\r | |
030cd1a2 | 7259 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7260 | \r |
7261 | @param Dr3 The value to write to Dr3.\r | |
7262 | \r | |
7263 | @return The value written to Debug Register 3 (DR3).\r | |
7264 | \r | |
7265 | **/\r | |
7266 | UINTN\r | |
7267 | EFIAPI\r | |
7268 | AsmWriteDr3 (\r | |
7269 | UINTN Dr3\r | |
7270 | );\r | |
7271 | \r | |
7272 | \r | |
7273 | /**\r | |
7274 | Writes a value to Debug Register 4 (DR4).\r | |
7275 | \r | |
7276 | Writes and returns a new value to DR4. This function is only available on\r | |
030cd1a2 | 7277 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7278 | \r |
7279 | @param Dr4 The value to write to Dr4.\r | |
7280 | \r | |
7281 | @return The value written to Debug Register 4 (DR4).\r | |
7282 | \r | |
7283 | **/\r | |
7284 | UINTN\r | |
7285 | EFIAPI\r | |
7286 | AsmWriteDr4 (\r | |
7287 | UINTN Dr4\r | |
7288 | );\r | |
7289 | \r | |
7290 | \r | |
7291 | /**\r | |
7292 | Writes a value to Debug Register 5 (DR5).\r | |
7293 | \r | |
7294 | Writes and returns a new value to DR5. This function is only available on\r | |
030cd1a2 | 7295 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7296 | \r |
7297 | @param Dr5 The value to write to Dr5.\r | |
7298 | \r | |
7299 | @return The value written to Debug Register 5 (DR5).\r | |
7300 | \r | |
7301 | **/\r | |
7302 | UINTN\r | |
7303 | EFIAPI\r | |
7304 | AsmWriteDr5 (\r | |
7305 | UINTN Dr5\r | |
7306 | );\r | |
7307 | \r | |
7308 | \r | |
7309 | /**\r | |
7310 | Writes a value to Debug Register 6 (DR6).\r | |
7311 | \r | |
7312 | Writes and returns a new value to DR6. This function is only available on\r | |
030cd1a2 | 7313 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7314 | \r |
7315 | @param Dr6 The value to write to Dr6.\r | |
7316 | \r | |
7317 | @return The value written to Debug Register 6 (DR6).\r | |
7318 | \r | |
7319 | **/\r | |
7320 | UINTN\r | |
7321 | EFIAPI\r | |
7322 | AsmWriteDr6 (\r | |
7323 | UINTN Dr6\r | |
7324 | );\r | |
7325 | \r | |
7326 | \r | |
7327 | /**\r | |
7328 | Writes a value to Debug Register 7 (DR7).\r | |
7329 | \r | |
7330 | Writes and returns a new value to DR7. This function is only available on\r | |
030cd1a2 | 7331 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7332 | \r |
7333 | @param Dr7 The value to write to Dr7.\r | |
7334 | \r | |
7335 | @return The value written to Debug Register 7 (DR7).\r | |
7336 | \r | |
7337 | **/\r | |
7338 | UINTN\r | |
7339 | EFIAPI\r | |
7340 | AsmWriteDr7 (\r | |
7341 | UINTN Dr7\r | |
7342 | );\r | |
7343 | \r | |
7344 | \r | |
7345 | /**\r | |
7346 | Reads the current value of Code Segment Register (CS).\r | |
7347 | \r | |
7348 | Reads and returns the current value of CS. This function is only available on\r | |
030cd1a2 | 7349 | IA-32 and x64.\r |
ac644614 | 7350 | \r |
7351 | @return The current value of CS.\r | |
7352 | \r | |
7353 | **/\r | |
7354 | UINT16\r | |
7355 | EFIAPI\r | |
7356 | AsmReadCs (\r | |
7357 | VOID\r | |
7358 | );\r | |
7359 | \r | |
7360 | \r | |
7361 | /**\r | |
7362 | Reads the current value of Data Segment Register (DS).\r | |
7363 | \r | |
7364 | Reads and returns the current value of DS. This function is only available on\r | |
030cd1a2 | 7365 | IA-32 and x64.\r |
ac644614 | 7366 | \r |
7367 | @return The current value of DS.\r | |
7368 | \r | |
7369 | **/\r | |
7370 | UINT16\r | |
7371 | EFIAPI\r | |
7372 | AsmReadDs (\r | |
7373 | VOID\r | |
7374 | );\r | |
7375 | \r | |
7376 | \r | |
7377 | /**\r | |
7378 | Reads the current value of Extra Segment Register (ES).\r | |
7379 | \r | |
7380 | Reads and returns the current value of ES. This function is only available on\r | |
030cd1a2 | 7381 | IA-32 and x64.\r |
ac644614 | 7382 | \r |
7383 | @return The current value of ES.\r | |
7384 | \r | |
7385 | **/\r | |
7386 | UINT16\r | |
7387 | EFIAPI\r | |
7388 | AsmReadEs (\r | |
7389 | VOID\r | |
7390 | );\r | |
7391 | \r | |
7392 | \r | |
7393 | /**\r | |
7394 | Reads the current value of FS Data Segment Register (FS).\r | |
7395 | \r | |
7396 | Reads and returns the current value of FS. This function is only available on\r | |
030cd1a2 | 7397 | IA-32 and x64.\r |
ac644614 | 7398 | \r |
7399 | @return The current value of FS.\r | |
7400 | \r | |
7401 | **/\r | |
7402 | UINT16\r | |
7403 | EFIAPI\r | |
7404 | AsmReadFs (\r | |
7405 | VOID\r | |
7406 | );\r | |
7407 | \r | |
7408 | \r | |
7409 | /**\r | |
7410 | Reads the current value of GS Data Segment Register (GS).\r | |
7411 | \r | |
7412 | Reads and returns the current value of GS. This function is only available on\r | |
030cd1a2 | 7413 | IA-32 and x64.\r |
ac644614 | 7414 | \r |
7415 | @return The current value of GS.\r | |
7416 | \r | |
7417 | **/\r | |
7418 | UINT16\r | |
7419 | EFIAPI\r | |
7420 | AsmReadGs (\r | |
7421 | VOID\r | |
7422 | );\r | |
7423 | \r | |
7424 | \r | |
7425 | /**\r | |
7426 | Reads the current value of Stack Segment Register (SS).\r | |
7427 | \r | |
7428 | Reads and returns the current value of SS. This function is only available on\r | |
030cd1a2 | 7429 | IA-32 and x64.\r |
ac644614 | 7430 | \r |
7431 | @return The current value of SS.\r | |
7432 | \r | |
7433 | **/\r | |
7434 | UINT16\r | |
7435 | EFIAPI\r | |
7436 | AsmReadSs (\r | |
7437 | VOID\r | |
7438 | );\r | |
7439 | \r | |
7440 | \r | |
7441 | /**\r | |
7442 | Reads the current value of Task Register (TR).\r | |
7443 | \r | |
7444 | Reads and returns the current value of TR. This function is only available on\r | |
030cd1a2 | 7445 | IA-32 and x64.\r |
ac644614 | 7446 | \r |
7447 | @return The current value of TR.\r | |
7448 | \r | |
7449 | **/\r | |
7450 | UINT16\r | |
7451 | EFIAPI\r | |
7452 | AsmReadTr (\r | |
7453 | VOID\r | |
7454 | );\r | |
7455 | \r | |
7456 | \r | |
7457 | /**\r | |
7458 | Reads the current Global Descriptor Table Register(GDTR) descriptor.\r | |
7459 | \r | |
7460 | Reads and returns the current GDTR descriptor and returns it in Gdtr. This\r | |
030cd1a2 | 7461 | function is only available on IA-32 and x64.\r |
ac644614 | 7462 | \r |
7463 | If Gdtr is NULL, then ASSERT().\r | |
7464 | \r | |
af2dc6a7 | 7465 | @param Gdtr The pointer to a GDTR descriptor.\r |
ac644614 | 7466 | \r |
7467 | **/\r | |
7468 | VOID\r | |
7469 | EFIAPI\r | |
7470 | AsmReadGdtr (\r | |
7471 | OUT IA32_DESCRIPTOR *Gdtr\r | |
7472 | );\r | |
7473 | \r | |
7474 | \r | |
7475 | /**\r | |
7476 | Writes the current Global Descriptor Table Register (GDTR) descriptor.\r | |
7477 | \r | |
7478 | Writes and the current GDTR descriptor specified by Gdtr. This function is\r | |
030cd1a2 | 7479 | only available on IA-32 and x64.\r |
ac644614 | 7480 | \r |
7481 | If Gdtr is NULL, then ASSERT().\r | |
7482 | \r | |
af2dc6a7 | 7483 | @param Gdtr The pointer to a GDTR descriptor.\r |
ac644614 | 7484 | \r |
7485 | **/\r | |
7486 | VOID\r | |
7487 | EFIAPI\r | |
7488 | AsmWriteGdtr (\r | |
7489 | IN CONST IA32_DESCRIPTOR *Gdtr\r | |
7490 | );\r | |
7491 | \r | |
7492 | \r | |
7493 | /**\r | |
17f695ed | 7494 | Reads the current Interrupt Descriptor Table Register(IDTR) descriptor.\r |
ac644614 | 7495 | \r |
7496 | Reads and returns the current IDTR descriptor and returns it in Idtr. This\r | |
030cd1a2 | 7497 | function is only available on IA-32 and x64.\r |
ac644614 | 7498 | \r |
7499 | If Idtr is NULL, then ASSERT().\r | |
7500 | \r | |
af2dc6a7 | 7501 | @param Idtr The pointer to a IDTR descriptor.\r |
ac644614 | 7502 | \r |
7503 | **/\r | |
7504 | VOID\r | |
7505 | EFIAPI\r | |
7506 | AsmReadIdtr (\r | |
7507 | OUT IA32_DESCRIPTOR *Idtr\r | |
7508 | );\r | |
7509 | \r | |
7510 | \r | |
7511 | /**\r | |
17f695ed | 7512 | Writes the current Interrupt Descriptor Table Register(IDTR) descriptor.\r |
ac644614 | 7513 | \r |
7514 | Writes the current IDTR descriptor and returns it in Idtr. This function is\r | |
030cd1a2 | 7515 | only available on IA-32 and x64.\r |
ac644614 | 7516 | \r |
7517 | If Idtr is NULL, then ASSERT().\r | |
7518 | \r | |
af2dc6a7 | 7519 | @param Idtr The pointer to a IDTR descriptor.\r |
ac644614 | 7520 | \r |
7521 | **/\r | |
7522 | VOID\r | |
7523 | EFIAPI\r | |
7524 | AsmWriteIdtr (\r | |
7525 | IN CONST IA32_DESCRIPTOR *Idtr\r | |
7526 | );\r | |
7527 | \r | |
7528 | \r | |
7529 | /**\r | |
7530 | Reads the current Local Descriptor Table Register(LDTR) selector.\r | |
7531 | \r | |
7532 | Reads and returns the current 16-bit LDTR descriptor value. This function is\r | |
030cd1a2 | 7533 | only available on IA-32 and x64.\r |
ac644614 | 7534 | \r |
7535 | @return The current selector of LDT.\r | |
7536 | \r | |
7537 | **/\r | |
7538 | UINT16\r | |
7539 | EFIAPI\r | |
7540 | AsmReadLdtr (\r | |
7541 | VOID\r | |
7542 | );\r | |
7543 | \r | |
7544 | \r | |
7545 | /**\r | |
17f695ed | 7546 | Writes the current Local Descriptor Table Register (LDTR) selector.\r |
ac644614 | 7547 | \r |
7548 | Writes and the current LDTR descriptor specified by Ldtr. This function is\r | |
030cd1a2 | 7549 | only available on IA-32 and x64.\r |
ac644614 | 7550 | \r |
7551 | @param Ldtr 16-bit LDTR selector value.\r | |
7552 | \r | |
7553 | **/\r | |
7554 | VOID\r | |
7555 | EFIAPI\r | |
7556 | AsmWriteLdtr (\r | |
7557 | IN UINT16 Ldtr\r | |
7558 | );\r | |
7559 | \r | |
7560 | \r | |
7561 | /**\r | |
7562 | Save the current floating point/SSE/SSE2 context to a buffer.\r | |
7563 | \r | |
7564 | Saves the current floating point/SSE/SSE2 state to the buffer specified by\r | |
7565 | Buffer. Buffer must be aligned on a 16-byte boundary. This function is only\r | |
030cd1a2 | 7566 | available on IA-32 and x64.\r |
ac644614 | 7567 | \r |
7568 | If Buffer is NULL, then ASSERT().\r | |
7569 | If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
7570 | \r | |
af2dc6a7 | 7571 | @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.\r |
ac644614 | 7572 | \r |
7573 | **/\r | |
7574 | VOID\r | |
7575 | EFIAPI\r | |
7576 | AsmFxSave (\r | |
7577 | OUT IA32_FX_BUFFER *Buffer\r | |
7578 | );\r | |
7579 | \r | |
7580 | \r | |
7581 | /**\r | |
7582 | Restores the current floating point/SSE/SSE2 context from a buffer.\r | |
7583 | \r | |
7584 | Restores the current floating point/SSE/SSE2 state from the buffer specified\r | |
7585 | by Buffer. Buffer must be aligned on a 16-byte boundary. This function is\r | |
030cd1a2 | 7586 | only available on IA-32 and x64.\r |
ac644614 | 7587 | \r |
7588 | If Buffer is NULL, then ASSERT().\r | |
7589 | If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
7590 | If Buffer was not saved with AsmFxSave(), then ASSERT().\r | |
7591 | \r | |
af2dc6a7 | 7592 | @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.\r |
ac644614 | 7593 | \r |
7594 | **/\r | |
7595 | VOID\r | |
7596 | EFIAPI\r | |
7597 | AsmFxRestore (\r | |
7598 | IN CONST IA32_FX_BUFFER *Buffer\r | |
7599 | );\r | |
7600 | \r | |
7601 | \r | |
7602 | /**\r | |
7603 | Reads the current value of 64-bit MMX Register #0 (MM0).\r | |
7604 | \r | |
7605 | Reads and returns the current value of MM0. This function is only available\r | |
030cd1a2 | 7606 | on IA-32 and x64.\r |
ac644614 | 7607 | \r |
7608 | @return The current value of MM0.\r | |
7609 | \r | |
7610 | **/\r | |
7611 | UINT64\r | |
7612 | EFIAPI\r | |
7613 | AsmReadMm0 (\r | |
7614 | VOID\r | |
7615 | );\r | |
7616 | \r | |
7617 | \r | |
7618 | /**\r | |
7619 | Reads the current value of 64-bit MMX Register #1 (MM1).\r | |
7620 | \r | |
7621 | Reads and returns the current value of MM1. This function is only available\r | |
030cd1a2 | 7622 | on IA-32 and x64.\r |
ac644614 | 7623 | \r |
7624 | @return The current value of MM1.\r | |
7625 | \r | |
7626 | **/\r | |
7627 | UINT64\r | |
7628 | EFIAPI\r | |
7629 | AsmReadMm1 (\r | |
7630 | VOID\r | |
7631 | );\r | |
7632 | \r | |
7633 | \r | |
7634 | /**\r | |
7635 | Reads the current value of 64-bit MMX Register #2 (MM2).\r | |
7636 | \r | |
7637 | Reads and returns the current value of MM2. This function is only available\r | |
030cd1a2 | 7638 | on IA-32 and x64.\r |
ac644614 | 7639 | \r |
7640 | @return The current value of MM2.\r | |
7641 | \r | |
7642 | **/\r | |
7643 | UINT64\r | |
7644 | EFIAPI\r | |
7645 | AsmReadMm2 (\r | |
7646 | VOID\r | |
7647 | );\r | |
7648 | \r | |
7649 | \r | |
7650 | /**\r | |
7651 | Reads the current value of 64-bit MMX Register #3 (MM3).\r | |
7652 | \r | |
7653 | Reads and returns the current value of MM3. This function is only available\r | |
030cd1a2 | 7654 | on IA-32 and x64.\r |
ac644614 | 7655 | \r |
7656 | @return The current value of MM3.\r | |
7657 | \r | |
7658 | **/\r | |
7659 | UINT64\r | |
7660 | EFIAPI\r | |
7661 | AsmReadMm3 (\r | |
7662 | VOID\r | |
7663 | );\r | |
7664 | \r | |
7665 | \r | |
7666 | /**\r | |
7667 | Reads the current value of 64-bit MMX Register #4 (MM4).\r | |
7668 | \r | |
7669 | Reads and returns the current value of MM4. This function is only available\r | |
030cd1a2 | 7670 | on IA-32 and x64.\r |
ac644614 | 7671 | \r |
7672 | @return The current value of MM4.\r | |
7673 | \r | |
7674 | **/\r | |
7675 | UINT64\r | |
7676 | EFIAPI\r | |
7677 | AsmReadMm4 (\r | |
7678 | VOID\r | |
7679 | );\r | |
7680 | \r | |
7681 | \r | |
7682 | /**\r | |
7683 | Reads the current value of 64-bit MMX Register #5 (MM5).\r | |
7684 | \r | |
7685 | Reads and returns the current value of MM5. This function is only available\r | |
030cd1a2 | 7686 | on IA-32 and x64.\r |
ac644614 | 7687 | \r |
7688 | @return The current value of MM5.\r | |
7689 | \r | |
7690 | **/\r | |
7691 | UINT64\r | |
7692 | EFIAPI\r | |
7693 | AsmReadMm5 (\r | |
7694 | VOID\r | |
7695 | );\r | |
7696 | \r | |
7697 | \r | |
7698 | /**\r | |
7699 | Reads the current value of 64-bit MMX Register #6 (MM6).\r | |
7700 | \r | |
7701 | Reads and returns the current value of MM6. This function is only available\r | |
030cd1a2 | 7702 | on IA-32 and x64.\r |
ac644614 | 7703 | \r |
7704 | @return The current value of MM6.\r | |
7705 | \r | |
7706 | **/\r | |
7707 | UINT64\r | |
7708 | EFIAPI\r | |
7709 | AsmReadMm6 (\r | |
7710 | VOID\r | |
7711 | );\r | |
7712 | \r | |
7713 | \r | |
7714 | /**\r | |
7715 | Reads the current value of 64-bit MMX Register #7 (MM7).\r | |
7716 | \r | |
7717 | Reads and returns the current value of MM7. This function is only available\r | |
030cd1a2 | 7718 | on IA-32 and x64.\r |
ac644614 | 7719 | \r |
7720 | @return The current value of MM7.\r | |
7721 | \r | |
7722 | **/\r | |
7723 | UINT64\r | |
7724 | EFIAPI\r | |
7725 | AsmReadMm7 (\r | |
7726 | VOID\r | |
7727 | );\r | |
7728 | \r | |
7729 | \r | |
7730 | /**\r | |
7731 | Writes the current value of 64-bit MMX Register #0 (MM0).\r | |
7732 | \r | |
7733 | Writes the current value of MM0. This function is only available on IA32 and\r | |
030cd1a2 | 7734 | x64.\r |
ac644614 | 7735 | \r |
7736 | @param Value The 64-bit value to write to MM0.\r | |
7737 | \r | |
7738 | **/\r | |
7739 | VOID\r | |
7740 | EFIAPI\r | |
7741 | AsmWriteMm0 (\r | |
7742 | IN UINT64 Value\r | |
7743 | );\r | |
7744 | \r | |
7745 | \r | |
7746 | /**\r | |
7747 | Writes the current value of 64-bit MMX Register #1 (MM1).\r | |
7748 | \r | |
7749 | Writes the current value of MM1. This function is only available on IA32 and\r | |
030cd1a2 | 7750 | x64.\r |
ac644614 | 7751 | \r |
7752 | @param Value The 64-bit value to write to MM1.\r | |
7753 | \r | |
7754 | **/\r | |
7755 | VOID\r | |
7756 | EFIAPI\r | |
7757 | AsmWriteMm1 (\r | |
7758 | IN UINT64 Value\r | |
7759 | );\r | |
7760 | \r | |
7761 | \r | |
7762 | /**\r | |
7763 | Writes the current value of 64-bit MMX Register #2 (MM2).\r | |
7764 | \r | |
7765 | Writes the current value of MM2. This function is only available on IA32 and\r | |
030cd1a2 | 7766 | x64.\r |
ac644614 | 7767 | \r |
7768 | @param Value The 64-bit value to write to MM2.\r | |
7769 | \r | |
7770 | **/\r | |
7771 | VOID\r | |
7772 | EFIAPI\r | |
7773 | AsmWriteMm2 (\r | |
7774 | IN UINT64 Value\r | |
7775 | );\r | |
7776 | \r | |
7777 | \r | |
7778 | /**\r | |
7779 | Writes the current value of 64-bit MMX Register #3 (MM3).\r | |
7780 | \r | |
7781 | Writes the current value of MM3. This function is only available on IA32 and\r | |
030cd1a2 | 7782 | x64.\r |
ac644614 | 7783 | \r |
7784 | @param Value The 64-bit value to write to MM3.\r | |
7785 | \r | |
7786 | **/\r | |
7787 | VOID\r | |
7788 | EFIAPI\r | |
7789 | AsmWriteMm3 (\r | |
7790 | IN UINT64 Value\r | |
7791 | );\r | |
7792 | \r | |
7793 | \r | |
7794 | /**\r | |
7795 | Writes the current value of 64-bit MMX Register #4 (MM4).\r | |
7796 | \r | |
7797 | Writes the current value of MM4. This function is only available on IA32 and\r | |
030cd1a2 | 7798 | x64.\r |
ac644614 | 7799 | \r |
7800 | @param Value The 64-bit value to write to MM4.\r | |
7801 | \r | |
7802 | **/\r | |
7803 | VOID\r | |
7804 | EFIAPI\r | |
7805 | AsmWriteMm4 (\r | |
7806 | IN UINT64 Value\r | |
7807 | );\r | |
7808 | \r | |
7809 | \r | |
7810 | /**\r | |
7811 | Writes the current value of 64-bit MMX Register #5 (MM5).\r | |
7812 | \r | |
7813 | Writes the current value of MM5. This function is only available on IA32 and\r | |
030cd1a2 | 7814 | x64.\r |
ac644614 | 7815 | \r |
7816 | @param Value The 64-bit value to write to MM5.\r | |
7817 | \r | |
7818 | **/\r | |
7819 | VOID\r | |
7820 | EFIAPI\r | |
7821 | AsmWriteMm5 (\r | |
7822 | IN UINT64 Value\r | |
7823 | );\r | |
7824 | \r | |
7825 | \r | |
7826 | /**\r | |
7827 | Writes the current value of 64-bit MMX Register #6 (MM6).\r | |
7828 | \r | |
7829 | Writes the current value of MM6. This function is only available on IA32 and\r | |
030cd1a2 | 7830 | x64.\r |
ac644614 | 7831 | \r |
7832 | @param Value The 64-bit value to write to MM6.\r | |
7833 | \r | |
7834 | **/\r | |
7835 | VOID\r | |
7836 | EFIAPI\r | |
7837 | AsmWriteMm6 (\r | |
7838 | IN UINT64 Value\r | |
7839 | );\r | |
7840 | \r | |
7841 | \r | |
7842 | /**\r | |
7843 | Writes the current value of 64-bit MMX Register #7 (MM7).\r | |
7844 | \r | |
7845 | Writes the current value of MM7. This function is only available on IA32 and\r | |
030cd1a2 | 7846 | x64.\r |
ac644614 | 7847 | \r |
7848 | @param Value The 64-bit value to write to MM7.\r | |
7849 | \r | |
7850 | **/\r | |
7851 | VOID\r | |
7852 | EFIAPI\r | |
7853 | AsmWriteMm7 (\r | |
7854 | IN UINT64 Value\r | |
7855 | );\r | |
7856 | \r | |
7857 | \r | |
7858 | /**\r | |
7859 | Reads the current value of Time Stamp Counter (TSC).\r | |
7860 | \r | |
7861 | Reads and returns the current value of TSC. This function is only available\r | |
030cd1a2 | 7862 | on IA-32 and x64.\r |
ac644614 | 7863 | \r |
7864 | @return The current value of TSC\r | |
7865 | \r | |
7866 | **/\r | |
7867 | UINT64\r | |
7868 | EFIAPI\r | |
7869 | AsmReadTsc (\r | |
7870 | VOID\r | |
7871 | );\r | |
7872 | \r | |
7873 | \r | |
7874 | /**\r | |
7875 | Reads the current value of a Performance Counter (PMC).\r | |
7876 | \r | |
7877 | Reads and returns the current value of performance counter specified by\r | |
030cd1a2 | 7878 | Index. This function is only available on IA-32 and x64.\r |
ac644614 | 7879 | \r |
7880 | @param Index The 32-bit Performance Counter index to read.\r | |
7881 | \r | |
7882 | @return The value of the PMC specified by Index.\r | |
7883 | \r | |
7884 | **/\r | |
7885 | UINT64\r | |
7886 | EFIAPI\r | |
7887 | AsmReadPmc (\r | |
7888 | IN UINT32 Index\r | |
7889 | );\r | |
7890 | \r | |
7891 | \r | |
7892 | /**\r | |
7893 | Sets up a monitor buffer that is used by AsmMwait().\r | |
7894 | \r | |
7895 | Executes a MONITOR instruction with the register state specified by Eax, Ecx\r | |
030cd1a2 | 7896 | and Edx. Returns Eax. This function is only available on IA-32 and x64.\r |
ac644614 | 7897 | \r |
7898 | @param Eax The value to load into EAX or RAX before executing the MONITOR\r | |
7899 | instruction.\r | |
7900 | @param Ecx The value to load into ECX or RCX before executing the MONITOR\r | |
7901 | instruction.\r | |
7902 | @param Edx The value to load into EDX or RDX before executing the MONITOR\r | |
7903 | instruction.\r | |
7904 | \r | |
7905 | @return Eax\r | |
7906 | \r | |
7907 | **/\r | |
7908 | UINTN\r | |
7909 | EFIAPI\r | |
7910 | AsmMonitor (\r | |
7911 | IN UINTN Eax,\r | |
7912 | IN UINTN Ecx,\r | |
7913 | IN UINTN Edx\r | |
7914 | );\r | |
7915 | \r | |
7916 | \r | |
7917 | /**\r | |
7918 | Executes an MWAIT instruction.\r | |
7919 | \r | |
7920 | Executes an MWAIT instruction with the register state specified by Eax and\r | |
030cd1a2 | 7921 | Ecx. Returns Eax. This function is only available on IA-32 and x64.\r |
ac644614 | 7922 | \r |
7923 | @param Eax The value to load into EAX or RAX before executing the MONITOR\r | |
7924 | instruction.\r | |
7925 | @param Ecx The value to load into ECX or RCX before executing the MONITOR\r | |
7926 | instruction.\r | |
7927 | \r | |
7928 | @return Eax\r | |
7929 | \r | |
7930 | **/\r | |
7931 | UINTN\r | |
7932 | EFIAPI\r | |
7933 | AsmMwait (\r | |
7934 | IN UINTN Eax,\r | |
7935 | IN UINTN Ecx\r | |
7936 | );\r | |
7937 | \r | |
7938 | \r | |
7939 | /**\r | |
7940 | Executes a WBINVD instruction.\r | |
7941 | \r | |
7942 | Executes a WBINVD instruction. This function is only available on IA-32 and\r | |
030cd1a2 | 7943 | x64.\r |
ac644614 | 7944 | \r |
7945 | **/\r | |
7946 | VOID\r | |
7947 | EFIAPI\r | |
7948 | AsmWbinvd (\r | |
7949 | VOID\r | |
7950 | );\r | |
7951 | \r | |
7952 | \r | |
7953 | /**\r | |
7954 | Executes a INVD instruction.\r | |
7955 | \r | |
7956 | Executes a INVD instruction. This function is only available on IA-32 and\r | |
030cd1a2 | 7957 | x64.\r |
ac644614 | 7958 | \r |
7959 | **/\r | |
7960 | VOID\r | |
7961 | EFIAPI\r | |
7962 | AsmInvd (\r | |
7963 | VOID\r | |
7964 | );\r | |
7965 | \r | |
7966 | \r | |
7967 | /**\r | |
7968 | Flushes a cache line from all the instruction and data caches within the\r | |
7969 | coherency domain of the CPU.\r | |
7970 | \r | |
7971 | Flushed the cache line specified by LinearAddress, and returns LinearAddress.\r | |
030cd1a2 | 7972 | This function is only available on IA-32 and x64.\r |
ac644614 | 7973 | \r |
7974 | @param LinearAddress The address of the cache line to flush. If the CPU is\r | |
7975 | in a physical addressing mode, then LinearAddress is a\r | |
7976 | physical address. If the CPU is in a virtual\r | |
7977 | addressing mode, then LinearAddress is a virtual\r | |
7978 | address.\r | |
7979 | \r | |
af2dc6a7 | 7980 | @return LinearAddress.\r |
ac644614 | 7981 | **/\r |
7982 | VOID *\r | |
7983 | EFIAPI\r | |
7984 | AsmFlushCacheLine (\r | |
7985 | IN VOID *LinearAddress\r | |
7986 | );\r | |
7987 | \r | |
7988 | \r | |
7989 | /**\r | |
7990 | Enables the 32-bit paging mode on the CPU.\r | |
7991 | \r | |
7992 | Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
7993 | must be properly initialized prior to calling this service. This function\r | |
7994 | assumes the current execution mode is 32-bit protected mode. This function is\r | |
7995 | only available on IA-32. After the 32-bit paging mode is enabled, control is\r | |
7996 | transferred to the function specified by EntryPoint using the new stack\r | |
7997 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
7998 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
7999 | EntryPoint must never return.\r | |
8000 | \r | |
8001 | If the current execution mode is not 32-bit protected mode, then ASSERT().\r | |
8002 | If EntryPoint is NULL, then ASSERT().\r | |
8003 | If NewStack is NULL, then ASSERT().\r | |
8004 | \r | |
8005 | There are a number of constraints that must be followed before calling this\r | |
8006 | function:\r | |
8007 | 1) Interrupts must be disabled.\r | |
8008 | 2) The caller must be in 32-bit protected mode with flat descriptors. This\r | |
8009 | means all descriptors must have a base of 0 and a limit of 4GB.\r | |
8010 | 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat\r | |
8011 | descriptors.\r | |
8012 | 4) CR3 must point to valid page tables that will be used once the transition\r | |
8013 | is complete, and those page tables must guarantee that the pages for this\r | |
8014 | function and the stack are identity mapped.\r | |
8015 | \r | |
8016 | @param EntryPoint A pointer to function to call with the new stack after\r | |
8017 | paging is enabled.\r | |
8018 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
8019 | function as the first parameter after paging is enabled.\r | |
8020 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
8021 | function as the second parameter after paging is enabled.\r | |
8022 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
8023 | function after paging is enabled.\r | |
8024 | \r | |
8025 | **/\r | |
8026 | VOID\r | |
8027 | EFIAPI\r | |
8028 | AsmEnablePaging32 (\r | |
8029 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
8030 | IN VOID *Context1, OPTIONAL\r | |
8031 | IN VOID *Context2, OPTIONAL\r | |
8032 | IN VOID *NewStack\r | |
8033 | );\r | |
8034 | \r | |
8035 | \r | |
8036 | /**\r | |
8037 | Disables the 32-bit paging mode on the CPU.\r | |
8038 | \r | |
8039 | Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r | |
8040 | mode. This function assumes the current execution mode is 32-paged protected\r | |
8041 | mode. This function is only available on IA-32. After the 32-bit paging mode\r | |
8042 | is disabled, control is transferred to the function specified by EntryPoint\r | |
8043 | using the new stack specified by NewStack and passing in the parameters\r | |
8044 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
8045 | may be NULL. The function EntryPoint must never return.\r | |
8046 | \r | |
8047 | If the current execution mode is not 32-bit paged mode, then ASSERT().\r | |
8048 | If EntryPoint is NULL, then ASSERT().\r | |
8049 | If NewStack is NULL, then ASSERT().\r | |
8050 | \r | |
8051 | There are a number of constraints that must be followed before calling this\r | |
8052 | function:\r | |
8053 | 1) Interrupts must be disabled.\r | |
8054 | 2) The caller must be in 32-bit paged mode.\r | |
8055 | 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r | |
8056 | 4) CR3 must point to valid page tables that guarantee that the pages for\r | |
8057 | this function and the stack are identity mapped.\r | |
8058 | \r | |
8059 | @param EntryPoint A pointer to function to call with the new stack after\r | |
8060 | paging is disabled.\r | |
8061 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
8062 | function as the first parameter after paging is disabled.\r | |
8063 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
8064 | function as the second parameter after paging is\r | |
8065 | disabled.\r | |
8066 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
8067 | function after paging is disabled.\r | |
8068 | \r | |
8069 | **/\r | |
8070 | VOID\r | |
8071 | EFIAPI\r | |
8072 | AsmDisablePaging32 (\r | |
8073 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
8074 | IN VOID *Context1, OPTIONAL\r | |
8075 | IN VOID *Context2, OPTIONAL\r | |
8076 | IN VOID *NewStack\r | |
8077 | );\r | |
8078 | \r | |
8079 | \r | |
8080 | /**\r | |
8081 | Enables the 64-bit paging mode on the CPU.\r | |
8082 | \r | |
8083 | Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
8084 | must be properly initialized prior to calling this service. This function\r | |
8085 | assumes the current execution mode is 32-bit protected mode with flat\r | |
8086 | descriptors. This function is only available on IA-32. After the 64-bit\r | |
8087 | paging mode is enabled, control is transferred to the function specified by\r | |
8088 | EntryPoint using the new stack specified by NewStack and passing in the\r | |
8089 | parameters specified by Context1 and Context2. Context1 and Context2 are\r | |
8090 | optional and may be 0. The function EntryPoint must never return.\r | |
8091 | \r | |
8092 | If the current execution mode is not 32-bit protected mode with flat\r | |
8093 | descriptors, then ASSERT().\r | |
8094 | If EntryPoint is 0, then ASSERT().\r | |
8095 | If NewStack is 0, then ASSERT().\r | |
8096 | \r | |
17f695ed | 8097 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r |
ac644614 | 8098 | is called. The descriptor in the GDT that this selector\r |
8099 | references must be setup for long mode.\r | |
8100 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
8101 | the new stack after paging is enabled.\r | |
8102 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
8103 | the EntryPoint function as the first parameter after\r | |
8104 | paging is enabled.\r | |
8105 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
8106 | the EntryPoint function as the second parameter after\r | |
8107 | paging is enabled.\r | |
8108 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
8109 | the EntryPoint function after paging is enabled.\r | |
8110 | \r | |
8111 | **/\r | |
8112 | VOID\r | |
8113 | EFIAPI\r | |
8114 | AsmEnablePaging64 (\r | |
17f695ed | 8115 | IN UINT16 Cs,\r |
ac644614 | 8116 | IN UINT64 EntryPoint,\r |
8117 | IN UINT64 Context1, OPTIONAL\r | |
8118 | IN UINT64 Context2, OPTIONAL\r | |
8119 | IN UINT64 NewStack\r | |
8120 | );\r | |
8121 | \r | |
8122 | \r | |
8123 | /**\r | |
8124 | Disables the 64-bit paging mode on the CPU.\r | |
8125 | \r | |
8126 | Disables the 64-bit paging mode on the CPU and returns to 32-bit protected\r | |
8127 | mode. This function assumes the current execution mode is 64-paging mode.\r | |
030cd1a2 | 8128 | This function is only available on x64. After the 64-bit paging mode is\r |
ac644614 | 8129 | disabled, control is transferred to the function specified by EntryPoint\r |
8130 | using the new stack specified by NewStack and passing in the parameters\r | |
8131 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
8132 | may be 0. The function EntryPoint must never return.\r | |
8133 | \r | |
8134 | If the current execution mode is not 64-bit paged mode, then ASSERT().\r | |
8135 | If EntryPoint is 0, then ASSERT().\r | |
8136 | If NewStack is 0, then ASSERT().\r | |
8137 | \r | |
17f695ed | 8138 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r |
ac644614 | 8139 | is called. The descriptor in the GDT that this selector\r |
8140 | references must be setup for 32-bit protected mode.\r | |
8141 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
8142 | the new stack after paging is disabled.\r | |
8143 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
8144 | the EntryPoint function as the first parameter after\r | |
8145 | paging is disabled.\r | |
8146 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
8147 | the EntryPoint function as the second parameter after\r | |
8148 | paging is disabled.\r | |
8149 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
8150 | the EntryPoint function after paging is disabled.\r | |
8151 | \r | |
8152 | **/\r | |
8153 | VOID\r | |
8154 | EFIAPI\r | |
8155 | AsmDisablePaging64 (\r | |
17f695ed | 8156 | IN UINT16 Cs,\r |
ac644614 | 8157 | IN UINT32 EntryPoint,\r |
8158 | IN UINT32 Context1, OPTIONAL\r | |
8159 | IN UINT32 Context2, OPTIONAL\r | |
8160 | IN UINT32 NewStack\r | |
8161 | );\r | |
8162 | \r | |
8163 | \r | |
8164 | //\r | |
8165 | // 16-bit thunking services\r | |
8166 | //\r | |
8167 | \r | |
8168 | /**\r | |
8169 | Retrieves the properties for 16-bit thunk functions.\r | |
8170 | \r | |
8171 | Computes the size of the buffer and stack below 1MB required to use the\r | |
8172 | AsmPrepareThunk16(), AsmThunk16() and AsmPrepareAndThunk16() functions. This\r | |
8173 | buffer size is returned in RealModeBufferSize, and the stack size is returned\r | |
8174 | in ExtraStackSize. If parameters are passed to the 16-bit real mode code,\r | |
8175 | then the actual minimum stack size is ExtraStackSize plus the maximum number\r | |
8176 | of bytes that need to be passed to the 16-bit real mode code.\r | |
52fa075c | 8177 | \r |
ac644614 | 8178 | If RealModeBufferSize is NULL, then ASSERT().\r |
8179 | If ExtraStackSize is NULL, then ASSERT().\r | |
8180 | \r | |
8181 | @param RealModeBufferSize A pointer to the size of the buffer below 1MB\r | |
8182 | required to use the 16-bit thunk functions.\r | |
8183 | @param ExtraStackSize A pointer to the extra size of stack below 1MB\r | |
8184 | that the 16-bit thunk functions require for\r | |
8185 | temporary storage in the transition to and from\r | |
8186 | 16-bit real mode.\r | |
8187 | \r | |
8188 | **/\r | |
8189 | VOID\r | |
8190 | EFIAPI\r | |
8191 | AsmGetThunk16Properties (\r | |
8192 | OUT UINT32 *RealModeBufferSize,\r | |
8193 | OUT UINT32 *ExtraStackSize\r | |
8194 | );\r | |
8195 | \r | |
8196 | \r | |
8197 | /**\r | |
8198 | Prepares all structures a code required to use AsmThunk16().\r | |
8199 | \r | |
8200 | Prepares all structures and code required to use AsmThunk16().\r | |
52fa075c | 8201 | \r |
8243b089 | 8202 | This interface is limited to be used in either physical mode or virtual modes with paging enabled where the\r |
8203 | virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.\r | |
ac644614 | 8204 | \r |
8205 | If ThunkContext is NULL, then ASSERT().\r | |
8206 | \r | |
8207 | @param ThunkContext A pointer to the context structure that describes the\r | |
8208 | 16-bit real mode code to call.\r | |
8209 | \r | |
8210 | **/\r | |
8211 | VOID\r | |
8212 | EFIAPI\r | |
8213 | AsmPrepareThunk16 (\r | |
1445300f | 8214 | IN OUT THUNK_CONTEXT *ThunkContext\r |
ac644614 | 8215 | );\r |
8216 | \r | |
8217 | \r | |
8218 | /**\r | |
8219 | Transfers control to a 16-bit real mode entry point and returns the results.\r | |
8220 | \r | |
8221 | Transfers control to a 16-bit real mode entry point and returns the results.\r | |
17f695ed | 8222 | AsmPrepareThunk16() must be called with ThunkContext before this function is used.\r |
8223 | This function must be called with interrupts disabled.\r | |
8224 | \r | |
8225 | The register state from the RealModeState field of ThunkContext is restored just prior \r | |
8226 | to calling the 16-bit real mode entry point. This includes the EFLAGS field of RealModeState, \r | |
8227 | which is used to set the interrupt state when a 16-bit real mode entry point is called.\r | |
8228 | Control is transferred to the 16-bit real mode entry point specified by the CS and Eip fields of RealModeState.\r | |
8229 | The stack is initialized to the SS and ESP fields of RealModeState. Any parameters passed to \r | |
8230 | the 16-bit real mode code must be populated by the caller at SS:ESP prior to calling this function. \r | |
8231 | The 16-bit real mode entry point is invoked with a 16-bit CALL FAR instruction,\r | |
8232 | so when accessing stack contents, the 16-bit real mode code must account for the 16-bit segment \r | |
8233 | and 16-bit offset of the return address that were pushed onto the stack. The 16-bit real mode entry \r | |
8234 | point must exit with a RETF instruction. The register state is captured into RealModeState immediately \r | |
8235 | after the RETF instruction is executed.\r | |
8236 | \r | |
8237 | If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts, \r | |
8238 | or any of the 16-bit real mode code makes a SW interrupt, then the caller is responsible for making sure \r | |
8239 | the IDT at address 0 is initialized to handle any HW or SW interrupts that may occur while in 16-bit real mode. \r | |
8240 | \r | |
8241 | If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts, \r | |
8242 | then the caller is responsible for making sure the 8259 PIC is in a state compatible with 16-bit real mode. \r | |
8243 | This includes the base vectors, the interrupt masks, and the edge/level trigger mode.\r | |
8244 | \r | |
8245 | If THUNK_ATTRIBUTE_BIG_REAL_MODE is set in the ThunkAttributes field of ThunkContext, then the user code \r | |
8246 | is invoked in big real mode. Otherwise, the user code is invoked in 16-bit real mode with 64KB segment limits.\r | |
8247 | \r | |
8248 | If neither THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 nor THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in \r | |
8249 | ThunkAttributes, then it is assumed that the user code did not enable the A20 mask, and no attempt is made to \r | |
8250 | disable the A20 mask.\r | |
8251 | \r | |
8252 | If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is set and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is clear in \r | |
8253 | ThunkAttributes, then attempt to use the INT 15 service to disable the A20 mask. If this INT 15 call fails, \r | |
8254 | then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.\r | |
8255 | \r | |
8256 | If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is clear and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is set in \r | |
8257 | ThunkAttributes, then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.\r | |
8258 | \r | |
ac644614 | 8259 | If ThunkContext is NULL, then ASSERT().\r |
8260 | If AsmPrepareThunk16() was not previously called with ThunkContext, then ASSERT().\r | |
17f695ed | 8261 | If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in \r |
8262 | ThunkAttributes, then ASSERT().\r | |
ac644614 | 8263 | \r |
8243b089 | 8264 | This interface is limited to be used in either physical mode or virtual modes with paging enabled where the\r |
af2dc6a7 | 8265 | virtual to physical mappings for ThunkContext.RealModeBuffer are mapped 1:1.\r |
52fa075c | 8266 | \r |
ac644614 | 8267 | @param ThunkContext A pointer to the context structure that describes the\r |
8268 | 16-bit real mode code to call.\r | |
8269 | \r | |
8270 | **/\r | |
8271 | VOID\r | |
8272 | EFIAPI\r | |
8273 | AsmThunk16 (\r | |
8274 | IN OUT THUNK_CONTEXT *ThunkContext\r | |
8275 | );\r | |
8276 | \r | |
8277 | \r | |
8278 | /**\r | |
8279 | Prepares all structures and code for a 16-bit real mode thunk, transfers\r | |
8280 | control to a 16-bit real mode entry point, and returns the results.\r | |
8281 | \r | |
8282 | Prepares all structures and code for a 16-bit real mode thunk, transfers\r | |
8283 | control to a 16-bit real mode entry point, and returns the results. If the\r | |
8284 | caller only need to perform a single 16-bit real mode thunk, then this\r | |
8285 | service should be used. If the caller intends to make more than one 16-bit\r | |
8286 | real mode thunk, then it is more efficient if AsmPrepareThunk16() is called\r | |
8287 | once and AsmThunk16() can be called for each 16-bit real mode thunk.\r | |
8288 | \r | |
8243b089 | 8289 | This interface is limited to be used in either physical mode or virtual modes with paging enabled where the\r |
8290 | virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.\r | |
52fa075c | 8291 | \r |
17f695ed | 8292 | See AsmPrepareThunk16() and AsmThunk16() for the detailed description and ASSERT() conditions.\r |
ac644614 | 8293 | \r |
8294 | @param ThunkContext A pointer to the context structure that describes the\r | |
8295 | 16-bit real mode code to call.\r | |
8296 | \r | |
8297 | **/\r | |
8298 | VOID\r | |
8299 | EFIAPI\r | |
8300 | AsmPrepareAndThunk16 (\r | |
8301 | IN OUT THUNK_CONTEXT *ThunkContext\r | |
8302 | );\r | |
8303 | \r | |
3cfc7813 QL |
8304 | /**\r |
8305 | Generates a 16-bit random number through RDRAND instruction.\r | |
8306 | \r | |
8307 | if Rand is NULL, then ASSERT().\r | |
8308 | \r | |
8309 | @param[out] Rand Buffer pointer to store the random result.\r | |
8310 | \r | |
8311 | @retval TRUE RDRAND call was successful.\r | |
8312 | @retval FALSE Failed attempts to call RDRAND.\r | |
8313 | \r | |
8314 | **/\r | |
8315 | BOOLEAN\r | |
8316 | EFIAPI\r | |
8317 | AsmRdRand16 (\r | |
8318 | OUT UINT16 *Rand\r | |
8319 | );\r | |
8320 | \r | |
8321 | /**\r | |
8322 | Generates a 32-bit random number through RDRAND instruction.\r | |
8323 | \r | |
8324 | if Rand is NULL, then ASSERT().\r | |
8325 | \r | |
8326 | @param[out] Rand Buffer pointer to store the random result.\r | |
8327 | \r | |
8328 | @retval TRUE RDRAND call was successful.\r | |
8329 | @retval FALSE Failed attempts to call RDRAND.\r | |
8330 | \r | |
8331 | **/\r | |
8332 | BOOLEAN\r | |
8333 | EFIAPI\r | |
8334 | AsmRdRand32 (\r | |
8335 | OUT UINT32 *Rand\r | |
8336 | );\r | |
8337 | \r | |
8338 | /**\r | |
8339 | Generates a 64-bit random number through RDRAND instruction.\r | |
8340 | \r | |
8341 | if Rand is NULL, then ASSERT().\r | |
8342 | \r | |
8343 | @param[out] Rand Buffer pointer to store the random result.\r | |
8344 | \r | |
8345 | @retval TRUE RDRAND call was successful.\r | |
8346 | @retval FALSE Failed attempts to call RDRAND.\r | |
8347 | \r | |
8348 | **/\r | |
8349 | BOOLEAN\r | |
8350 | EFIAPI\r | |
8351 | AsmRdRand64 (\r | |
8352 | OUT UINT64 *Rand\r | |
8353 | );\r | |
8354 | \r | |
ac644614 | 8355 | #endif\r |
e3a7917f | 8356 | #endif\r |
ac644614 | 8357 | \r |
8358 | \r |