]>
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 | |
ea2e0921 | 1398 | to the range defined by UINTN, then MAX_UINTN is returned.\r |
ac644614 | 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 | |
ea2e0921 | 1438 | to the range defined by UINT64, then MAX_UINT64 is returned.\r |
ac644614 | 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 | |
ea2e0921 | 1480 | UINTN, then MAX_UINTN is returned.\r |
ac644614 | 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 | |
ea2e0921 | 1522 | UINT64, then MAX_UINT64 is returned.\r |
ac644614 | 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 |
02263214 HW |
1634 | /**\r |
1635 | Convert not more than Length successive characters from a Null-terminated\r | |
1636 | Unicode string to a Null-terminated Ascii string. If no null char is copied\r | |
1637 | from Source, then Destination[Length] is always set to null.\r | |
1638 | \r | |
1639 | This function converts not more than Length successive characters from the\r | |
1640 | Unicode string Source to the Ascii string Destination by copying the lower 8\r | |
1641 | bits of each Unicode character. The function terminates the Ascii string\r | |
1642 | Destination by appending a Null-terminator character at the end.\r | |
1643 | \r | |
1644 | The caller is responsible to make sure Destination points to a buffer with size\r | |
1645 | equal or greater than ((StrLen (Source) + 1) * sizeof (CHAR8)) in bytes.\r | |
1646 | \r | |
1647 | If any Unicode characters in Source contain non-zero value in the upper 8\r | |
1648 | bits, then ASSERT().\r | |
1649 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
1650 | If an error would be returned, then the function will also ASSERT().\r | |
1651 | \r | |
1652 | If an error is returned, then the Destination is unmodified.\r | |
1653 | \r | |
1654 | @param Source The pointer to a Null-terminated Unicode string.\r | |
1655 | @param Length The maximum number of Unicode characters to\r | |
1656 | convert.\r | |
1657 | @param Destination The pointer to a Null-terminated Ascii string.\r | |
1658 | @param DestMax The maximum number of Destination Ascii\r | |
1659 | char, including terminating null char.\r | |
1660 | @param DestinationLength The number of Unicode characters converted.\r | |
1661 | \r | |
1662 | @retval RETURN_SUCCESS String is converted.\r | |
1663 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
1664 | If Source is NULL.\r | |
1665 | If DestinationLength is NULL.\r | |
1666 | If PcdMaximumAsciiStringLength is not zero,\r | |
1667 | and Length or DestMax is greater than\r | |
1668 | PcdMaximumAsciiStringLength.\r | |
1669 | If PcdMaximumUnicodeStringLength is not\r | |
1670 | zero, and Length or DestMax is greater than\r | |
1671 | PcdMaximumUnicodeStringLength.\r | |
1672 | If DestMax is 0.\r | |
1673 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than\r | |
1674 | MIN(StrLen(Source), Length).\r | |
1675 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
1676 | \r | |
1677 | **/\r | |
1678 | RETURN_STATUS\r | |
1679 | EFIAPI\r | |
1680 | UnicodeStrnToAsciiStrS (\r | |
1681 | IN CONST CHAR16 *Source,\r | |
1682 | IN UINTN Length,\r | |
1683 | OUT CHAR8 *Destination,\r | |
1684 | IN UINTN DestMax,\r | |
1685 | OUT UINTN *DestinationLength\r | |
1686 | );\r | |
1687 | \r | |
1bb390f1 ED |
1688 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
1689 | \r | |
ac644614 | 1690 | /**\r |
ae591c14 | 1691 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1692 | \r |
ac644614 | 1693 | Copies one Null-terminated ASCII string to another Null-terminated ASCII\r |
1694 | string and returns the new ASCII string.\r | |
1695 | \r | |
1696 | This function copies the contents of the ASCII string Source to the ASCII\r | |
1697 | string Destination, and returns Destination. If Source and Destination\r | |
1698 | overlap, then the results are undefined.\r | |
1699 | \r | |
1700 | If Destination is NULL, then ASSERT().\r | |
1701 | If Source is NULL, then ASSERT().\r | |
1702 | If Source and Destination overlap, then ASSERT().\r | |
1703 | If PcdMaximumAsciiStringLength is not zero and Source contains more than\r | |
1704 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1705 | then ASSERT().\r | |
1706 | \r | |
af2dc6a7 | 1707 | @param Destination The pointer to a Null-terminated ASCII string.\r |
1708 | @param Source The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1709 | \r |
1710 | @return Destination\r | |
1711 | \r | |
1712 | **/\r | |
1713 | CHAR8 *\r | |
1714 | EFIAPI\r | |
1715 | AsciiStrCpy (\r | |
1716 | OUT CHAR8 *Destination,\r | |
1717 | IN CONST CHAR8 *Source\r | |
1718 | );\r | |
1719 | \r | |
1720 | \r | |
1721 | /**\r | |
ae591c14 | 1722 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1723 | \r |
17f695ed | 1724 | Copies up to a specified length one Null-terminated ASCII string to another \r |
1725 | Null-terminated ASCII string and returns the new ASCII string.\r | |
ac644614 | 1726 | \r |
1727 | This function copies the contents of the ASCII string Source to the ASCII\r | |
1728 | string Destination, and returns Destination. At most, Length ASCII characters\r | |
1729 | are copied from Source to Destination. If Length is 0, then Destination is\r | |
1730 | returned unmodified. If Length is greater that the number of ASCII characters\r | |
1731 | in Source, then Destination is padded with Null ASCII characters. If Source\r | |
1732 | and Destination overlap, then the results are undefined.\r | |
1733 | \r | |
1734 | If Destination is NULL, then ASSERT().\r | |
1735 | If Source is NULL, then ASSERT().\r | |
1736 | If Source and Destination overlap, then ASSERT().\r | |
50c247fd | 1737 | If PcdMaximumAsciiStringLength is not zero, and Length is greater than \r |
1738 | PcdMaximumAsciiStringLength, then ASSERT().\r | |
ac644614 | 1739 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r |
50c247fd | 1740 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r |
ac644614 | 1741 | then ASSERT().\r |
1742 | \r | |
af2dc6a7 | 1743 | @param Destination The pointer to a Null-terminated ASCII string.\r |
1744 | @param Source The pointer to a Null-terminated ASCII string.\r | |
1745 | @param Length The maximum number of ASCII characters to copy.\r | |
ac644614 | 1746 | \r |
1747 | @return Destination\r | |
1748 | \r | |
1749 | **/\r | |
1750 | CHAR8 *\r | |
1751 | EFIAPI\r | |
1752 | AsciiStrnCpy (\r | |
1753 | OUT CHAR8 *Destination,\r | |
1754 | IN CONST CHAR8 *Source,\r | |
1755 | IN UINTN Length\r | |
1756 | );\r | |
1bb390f1 | 1757 | #endif\r |
ac644614 | 1758 | \r |
1759 | /**\r | |
1760 | Returns the length of a Null-terminated ASCII string.\r | |
1761 | \r | |
1762 | This function returns the number of ASCII characters in the Null-terminated\r | |
1763 | ASCII string specified by String.\r | |
1764 | \r | |
1765 | If Length > 0 and Destination is NULL, then ASSERT().\r | |
1766 | If Length > 0 and Source is NULL, then ASSERT().\r | |
1767 | If PcdMaximumAsciiStringLength is not zero and String contains more than\r | |
1768 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1769 | then ASSERT().\r | |
1770 | \r | |
af2dc6a7 | 1771 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 1772 | \r |
1773 | @return The length of String.\r | |
1774 | \r | |
1775 | **/\r | |
1776 | UINTN\r | |
1777 | EFIAPI\r | |
1778 | AsciiStrLen (\r | |
1779 | IN CONST CHAR8 *String\r | |
1780 | );\r | |
1781 | \r | |
1782 | \r | |
1783 | /**\r | |
1784 | Returns the size of a Null-terminated ASCII string in bytes, including the\r | |
1785 | Null terminator.\r | |
1786 | \r | |
1787 | This function returns the size, in bytes, of the Null-terminated ASCII string\r | |
1788 | specified by String.\r | |
1789 | \r | |
1790 | If String is NULL, then ASSERT().\r | |
1791 | If PcdMaximumAsciiStringLength is not zero and String contains more than\r | |
1792 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1793 | then ASSERT().\r | |
1794 | \r | |
af2dc6a7 | 1795 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 1796 | \r |
1797 | @return The size of String.\r | |
1798 | \r | |
1799 | **/\r | |
1800 | UINTN\r | |
1801 | EFIAPI\r | |
1802 | AsciiStrSize (\r | |
1803 | IN CONST CHAR8 *String\r | |
1804 | );\r | |
1805 | \r | |
1806 | \r | |
1807 | /**\r | |
1808 | Compares two Null-terminated ASCII strings, and returns the difference\r | |
1809 | between the first mismatched ASCII characters.\r | |
1810 | \r | |
1811 | This function compares the Null-terminated ASCII string FirstString to the\r | |
1812 | Null-terminated ASCII string SecondString. If FirstString is identical to\r | |
1813 | SecondString, then 0 is returned. Otherwise, the value returned is the first\r | |
1814 | mismatched ASCII character in SecondString subtracted from the first\r | |
1815 | mismatched ASCII character in FirstString.\r | |
1816 | \r | |
1817 | If FirstString is NULL, then ASSERT().\r | |
1818 | If SecondString is NULL, then ASSERT().\r | |
1819 | If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r | |
1820 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1821 | then ASSERT().\r | |
1822 | If PcdMaximumAsciiStringLength is not zero and SecondString contains more\r | |
1823 | than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
1824 | Null-terminator, then ASSERT().\r | |
1825 | \r | |
af2dc6a7 | 1826 | @param FirstString The pointer to a Null-terminated ASCII string.\r |
1827 | @param SecondString The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1828 | \r |
17f695ed | 1829 | @retval ==0 FirstString is identical to SecondString.\r |
1830 | @retval !=0 FirstString is not identical to SecondString.\r | |
ac644614 | 1831 | \r |
1832 | **/\r | |
1833 | INTN\r | |
1834 | EFIAPI\r | |
1835 | AsciiStrCmp (\r | |
1836 | IN CONST CHAR8 *FirstString,\r | |
1837 | IN CONST CHAR8 *SecondString\r | |
1838 | );\r | |
1839 | \r | |
1840 | \r | |
1841 | /**\r | |
1842 | Performs a case insensitive comparison of two Null-terminated ASCII strings,\r | |
1843 | and returns the difference between the first mismatched ASCII characters.\r | |
1844 | \r | |
1845 | This function performs a case insensitive comparison of the Null-terminated\r | |
1846 | ASCII string FirstString to the Null-terminated ASCII string SecondString. If\r | |
1847 | FirstString is identical to SecondString, then 0 is returned. Otherwise, the\r | |
1848 | value returned is the first mismatched lower case ASCII character in\r | |
1849 | SecondString subtracted from the first mismatched lower case ASCII character\r | |
1850 | in FirstString.\r | |
1851 | \r | |
1852 | If FirstString is NULL, then ASSERT().\r | |
1853 | If SecondString is NULL, then ASSERT().\r | |
1854 | If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r | |
1855 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1856 | then ASSERT().\r | |
1857 | If PcdMaximumAsciiStringLength is not zero and SecondString contains more\r | |
1858 | than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
1859 | Null-terminator, then ASSERT().\r | |
1860 | \r | |
af2dc6a7 | 1861 | @param FirstString The pointer to a Null-terminated ASCII string.\r |
1862 | @param SecondString The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1863 | \r |
17f695ed | 1864 | @retval ==0 FirstString is identical to SecondString using case insensitive\r |
1106ffe1 | 1865 | comparisons.\r |
17f695ed | 1866 | @retval !=0 FirstString is not identical to SecondString using case\r |
1106ffe1 | 1867 | insensitive comparisons.\r |
ac644614 | 1868 | \r |
1869 | **/\r | |
1870 | INTN\r | |
1871 | EFIAPI\r | |
1872 | AsciiStriCmp (\r | |
1873 | IN CONST CHAR8 *FirstString,\r | |
1874 | IN CONST CHAR8 *SecondString\r | |
1875 | );\r | |
1876 | \r | |
1877 | \r | |
1878 | /**\r | |
1879 | Compares two Null-terminated ASCII strings with maximum lengths, and returns\r | |
1880 | the difference between the first mismatched ASCII characters.\r | |
1881 | \r | |
1882 | This function compares the Null-terminated ASCII string FirstString to the\r | |
1883 | Null-terminated ASCII string SecondString. At most, Length ASCII characters\r | |
1884 | will be compared. If Length is 0, then 0 is returned. If FirstString is\r | |
1885 | identical to SecondString, then 0 is returned. Otherwise, the value returned\r | |
1886 | is the first mismatched ASCII character in SecondString subtracted from the\r | |
1887 | first mismatched ASCII character in FirstString.\r | |
1888 | \r | |
1889 | If Length > 0 and FirstString is NULL, then ASSERT().\r | |
1890 | If Length > 0 and SecondString is NULL, then ASSERT().\r | |
50c247fd | 1891 | If PcdMaximumAsciiStringLength is not zero, and Length is greater than \r |
1892 | PcdMaximumAsciiStringLength, then ASSERT().\r | |
1893 | If PcdMaximumAsciiStringLength is not zero, and FirstString contains more than\r | |
1894 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r | |
ac644614 | 1895 | then ASSERT().\r |
50c247fd | 1896 | If PcdMaximumAsciiStringLength is not zero, and SecondString contains more than\r |
1897 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r | |
ac644614 | 1898 | then ASSERT().\r |
1899 | \r | |
af2dc6a7 | 1900 | @param FirstString The pointer to a Null-terminated ASCII string.\r |
1901 | @param SecondString The pointer to a Null-terminated ASCII string.\r | |
1902 | @param Length The maximum number of ASCII characters for compare.\r | |
ac644614 | 1903 | \r |
17f695ed | 1904 | @retval ==0 FirstString is identical to SecondString.\r |
1905 | @retval !=0 FirstString is not identical to SecondString.\r | |
ac644614 | 1906 | \r |
1907 | **/\r | |
1908 | INTN\r | |
1909 | EFIAPI\r | |
1910 | AsciiStrnCmp (\r | |
1911 | IN CONST CHAR8 *FirstString,\r | |
1912 | IN CONST CHAR8 *SecondString,\r | |
1913 | IN UINTN Length\r | |
1914 | );\r | |
1915 | \r | |
1916 | \r | |
1bb390f1 ED |
1917 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
1918 | \r | |
ac644614 | 1919 | /**\r |
ae591c14 | 1920 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1921 | \r |
ac644614 | 1922 | Concatenates one Null-terminated ASCII string to another Null-terminated\r |
1923 | ASCII string, and returns the concatenated ASCII string.\r | |
1924 | \r | |
1925 | This function concatenates two Null-terminated ASCII strings. The contents of\r | |
1926 | Null-terminated ASCII string Source are concatenated to the end of Null-\r | |
1927 | terminated ASCII string Destination. The Null-terminated concatenated ASCII\r | |
1928 | String is returned.\r | |
1929 | \r | |
1930 | If Destination is NULL, then ASSERT().\r | |
1931 | If Source is NULL, then ASSERT().\r | |
1932 | If PcdMaximumAsciiStringLength is not zero and Destination contains more than\r | |
1933 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1934 | then ASSERT().\r | |
1935 | If PcdMaximumAsciiStringLength is not zero and Source contains more than\r | |
1936 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1937 | then ASSERT().\r | |
1938 | If PcdMaximumAsciiStringLength is not zero and concatenating Destination and\r | |
1939 | Source results in a ASCII string with more than PcdMaximumAsciiStringLength\r | |
1940 | ASCII characters, then ASSERT().\r | |
1941 | \r | |
af2dc6a7 | 1942 | @param Destination The pointer to a Null-terminated ASCII string.\r |
1943 | @param Source The pointer to a Null-terminated ASCII string.\r | |
ac644614 | 1944 | \r |
1945 | @return Destination\r | |
1946 | \r | |
1947 | **/\r | |
1948 | CHAR8 *\r | |
1949 | EFIAPI\r | |
1950 | AsciiStrCat (\r | |
1951 | IN OUT CHAR8 *Destination,\r | |
1952 | IN CONST CHAR8 *Source\r | |
1953 | );\r | |
1954 | \r | |
1955 | \r | |
1956 | /**\r | |
ae591c14 | 1957 | [ATTENTION] This function is deprecated for security reason.\r |
1bb390f1 | 1958 | \r |
17f695ed | 1959 | Concatenates up to a specified length one Null-terminated ASCII string to \r |
1960 | the end of another Null-terminated ASCII string, and returns the \r | |
1961 | concatenated ASCII string.\r | |
ac644614 | 1962 | \r |
1963 | This function concatenates two Null-terminated ASCII strings. The contents\r | |
1964 | of Null-terminated ASCII string Source are concatenated to the end of Null-\r | |
1965 | terminated ASCII string Destination, and Destination is returned. At most,\r | |
1966 | Length ASCII characters are concatenated from Source to the end of\r | |
1967 | Destination, and Destination is always Null-terminated. If Length is 0, then\r | |
1968 | Destination is returned unmodified. If Source and Destination overlap, then\r | |
1969 | the results are undefined.\r | |
1970 | \r | |
1971 | If Length > 0 and Destination is NULL, then ASSERT().\r | |
1972 | If Length > 0 and Source is NULL, then ASSERT().\r | |
1973 | If Source and Destination overlap, then ASSERT().\r | |
50c247fd | 1974 | If PcdMaximumAsciiStringLength is not zero, and Length is greater than\r |
1975 | PcdMaximumAsciiStringLength, then ASSERT().\r | |
ac644614 | 1976 | If PcdMaximumAsciiStringLength is not zero, and Destination contains more than\r |
50c247fd | 1977 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r |
ac644614 | 1978 | then ASSERT().\r |
1979 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r | |
50c247fd | 1980 | PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator,\r |
ac644614 | 1981 | then ASSERT().\r |
1982 | If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and\r | |
1983 | Source results in a ASCII string with more than PcdMaximumAsciiStringLength\r | |
50c247fd | 1984 | ASCII characters, not including the Null-terminator, then ASSERT().\r |
ac644614 | 1985 | \r |
af2dc6a7 | 1986 | @param Destination The pointer to a Null-terminated ASCII string.\r |
1987 | @param Source The pointer to a Null-terminated ASCII string.\r | |
1988 | @param Length The maximum number of ASCII characters to concatenate from\r | |
ac644614 | 1989 | Source.\r |
1990 | \r | |
1991 | @return Destination\r | |
1992 | \r | |
1993 | **/\r | |
1994 | CHAR8 *\r | |
1995 | EFIAPI\r | |
1996 | AsciiStrnCat (\r | |
1997 | IN OUT CHAR8 *Destination,\r | |
1998 | IN CONST CHAR8 *Source,\r | |
1999 | IN UINTN Length\r | |
2000 | );\r | |
1bb390f1 | 2001 | #endif\r |
ac644614 | 2002 | \r |
2003 | /**\r | |
9aa049d9 | 2004 | Returns the first occurrence of a Null-terminated ASCII sub-string\r |
ac644614 | 2005 | in a Null-terminated ASCII string.\r |
2006 | \r | |
2007 | This function scans the contents of the ASCII string specified by String\r | |
2008 | and returns the first occurrence of SearchString. If SearchString is not\r | |
2009 | found in String, then NULL is returned. If the length of SearchString is zero,\r | |
2010 | then String is returned.\r | |
2011 | \r | |
2012 | If String is NULL, then ASSERT().\r | |
2013 | If SearchString is NULL, then ASSERT().\r | |
2014 | \r | |
2015 | If PcdMaximumAsciiStringLength is not zero, and SearchString or\r | |
2016 | String contains more than PcdMaximumAsciiStringLength Unicode characters\r | |
2017 | not including the Null-terminator, then ASSERT().\r | |
2018 | \r | |
af2dc6a7 | 2019 | @param String The pointer to a Null-terminated ASCII string.\r |
2020 | @param SearchString The pointer to a Null-terminated ASCII string to search for.\r | |
ac644614 | 2021 | \r |
2022 | @retval NULL If the SearchString does not appear in String.\r | |
17f695ed | 2023 | @retval others If there is a match return the first occurrence of SearchingString.\r |
9aa049d9 | 2024 | If the length of SearchString is zero,return String.\r |
ac644614 | 2025 | \r |
2026 | **/\r | |
2027 | CHAR8 *\r | |
2028 | EFIAPI\r | |
2029 | AsciiStrStr (\r | |
17f695ed | 2030 | IN CONST CHAR8 *String,\r |
2031 | IN CONST CHAR8 *SearchString\r | |
ac644614 | 2032 | );\r |
2033 | \r | |
2034 | \r | |
2035 | /**\r | |
2036 | Convert a Null-terminated ASCII decimal string to a value of type\r | |
2037 | UINTN.\r | |
2038 | \r | |
2039 | This function returns a value of type UINTN by interpreting the contents\r | |
2040 | of the ASCII string String as a decimal number. The format of the input\r | |
2041 | ASCII string String is:\r | |
2042 | \r | |
2043 | [spaces] [decimal digits].\r | |
2044 | \r | |
2045 | The valid decimal digit character is in the range [0-9]. The function will\r | |
2046 | ignore the pad space, which includes spaces or tab characters, before the digits.\r | |
2047 | The running zero in the beginning of [decimal digits] will be ignored. Then, the\r | |
2048 | function stops at the first character that is a not a valid decimal character or\r | |
2049 | Null-terminator, whichever on comes first.\r | |
2050 | \r | |
2051 | If String has only pad spaces, then 0 is returned.\r | |
2052 | If String has no pad spaces or valid decimal digits, then 0 is returned.\r | |
2053 | If the number represented by String overflows according to the range defined by\r | |
ea2e0921 | 2054 | UINTN, then MAX_UINTN is returned.\r |
ac644614 | 2055 | If String is NULL, then ASSERT().\r |
2056 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
2057 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
2058 | then ASSERT().\r | |
2059 | \r | |
af2dc6a7 | 2060 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 2061 | \r |
af2dc6a7 | 2062 | @retval The value translated from String.\r |
ac644614 | 2063 | \r |
2064 | **/\r | |
2065 | UINTN\r | |
2066 | EFIAPI\r | |
2067 | AsciiStrDecimalToUintn (\r | |
2068 | IN CONST CHAR8 *String\r | |
2069 | );\r | |
2070 | \r | |
2071 | \r | |
2072 | /**\r | |
2073 | Convert a Null-terminated ASCII decimal string to a value of type\r | |
2074 | UINT64.\r | |
2075 | \r | |
2076 | This function returns a value of type UINT64 by interpreting the contents\r | |
2077 | of the ASCII string String as a decimal number. The format of the input\r | |
2078 | ASCII string String is:\r | |
2079 | \r | |
2080 | [spaces] [decimal digits].\r | |
2081 | \r | |
2082 | The valid decimal digit character is in the range [0-9]. The function will\r | |
2083 | ignore the pad space, which includes spaces or tab characters, before the digits.\r | |
2084 | The running zero in the beginning of [decimal digits] will be ignored. Then, the\r | |
2085 | function stops at the first character that is a not a valid decimal character or\r | |
2086 | Null-terminator, whichever on comes first.\r | |
2087 | \r | |
2088 | If String has only pad spaces, then 0 is returned.\r | |
2089 | If String has no pad spaces or valid decimal digits, then 0 is returned.\r | |
2090 | If the number represented by String overflows according to the range defined by\r | |
ea2e0921 | 2091 | UINT64, then MAX_UINT64 is returned.\r |
ac644614 | 2092 | If String is NULL, then ASSERT().\r |
2093 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
2094 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
2095 | then ASSERT().\r | |
2096 | \r | |
af2dc6a7 | 2097 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 2098 | \r |
38bbd3d9 | 2099 | @retval Value translated from String.\r |
ac644614 | 2100 | \r |
2101 | **/\r | |
2102 | UINT64\r | |
2103 | EFIAPI\r | |
2104 | AsciiStrDecimalToUint64 (\r | |
17f695ed | 2105 | IN CONST CHAR8 *String\r |
ac644614 | 2106 | );\r |
2107 | \r | |
2108 | \r | |
2109 | /**\r | |
2110 | Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.\r | |
2111 | \r | |
2112 | This function returns a value of type UINTN by interpreting the contents of\r | |
2113 | the ASCII string String as a hexadecimal number. The format of the input ASCII\r | |
2114 | string String is:\r | |
2115 | \r | |
2116 | [spaces][zeros][x][hexadecimal digits].\r | |
2117 | \r | |
2118 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
2119 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"\r | |
2120 | appears in the input string, it must be prefixed with at least one 0. The function\r | |
2121 | will ignore the pad space, which includes spaces or tab characters, before [zeros],\r | |
2122 | [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]\r | |
2123 | will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal\r | |
2124 | digit. Then, the function stops at the first character that is a not a valid\r | |
2125 | hexadecimal character or Null-terminator, whichever on comes first.\r | |
2126 | \r | |
2127 | If String has only pad spaces, then 0 is returned.\r | |
2128 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then\r | |
2129 | 0 is returned.\r | |
2130 | \r | |
2131 | If the number represented by String overflows according to the range defined by UINTN,\r | |
ea2e0921 | 2132 | then MAX_UINTN is returned.\r |
ac644614 | 2133 | If String is NULL, then ASSERT().\r |
2134 | If PcdMaximumAsciiStringLength is not zero,\r | |
2135 | and String contains more than PcdMaximumAsciiStringLength ASCII characters not including\r | |
2136 | the Null-terminator, then ASSERT().\r | |
2137 | \r | |
af2dc6a7 | 2138 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 2139 | \r |
38bbd3d9 | 2140 | @retval Value translated from String.\r |
ac644614 | 2141 | \r |
2142 | **/\r | |
2143 | UINTN\r | |
2144 | EFIAPI\r | |
2145 | AsciiStrHexToUintn (\r | |
17f695ed | 2146 | IN CONST CHAR8 *String\r |
ac644614 | 2147 | );\r |
2148 | \r | |
2149 | \r | |
2150 | /**\r | |
2151 | Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.\r | |
2152 | \r | |
2153 | This function returns a value of type UINT64 by interpreting the contents of\r | |
2154 | the ASCII string String as a hexadecimal number. The format of the input ASCII\r | |
2155 | string String is:\r | |
2156 | \r | |
2157 | [spaces][zeros][x][hexadecimal digits].\r | |
2158 | \r | |
2159 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
2160 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"\r | |
2161 | appears in the input string, it must be prefixed with at least one 0. The function\r | |
2162 | will ignore the pad space, which includes spaces or tab characters, before [zeros],\r | |
2163 | [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]\r | |
2164 | will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal\r | |
2165 | digit. Then, the function stops at the first character that is a not a valid\r | |
2166 | hexadecimal character or Null-terminator, whichever on comes first.\r | |
2167 | \r | |
2168 | If String has only pad spaces, then 0 is returned.\r | |
2169 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then\r | |
2170 | 0 is returned.\r | |
2171 | \r | |
2172 | If the number represented by String overflows according to the range defined by UINT64,\r | |
ea2e0921 | 2173 | then MAX_UINT64 is returned.\r |
ac644614 | 2174 | If String is NULL, then ASSERT().\r |
2175 | If PcdMaximumAsciiStringLength is not zero,\r | |
2176 | and String contains more than PcdMaximumAsciiStringLength ASCII characters not including\r | |
2177 | the Null-terminator, then ASSERT().\r | |
2178 | \r | |
af2dc6a7 | 2179 | @param String The pointer to a Null-terminated ASCII string.\r |
ac644614 | 2180 | \r |
38bbd3d9 | 2181 | @retval Value translated from String.\r |
ac644614 | 2182 | \r |
2183 | **/\r | |
2184 | UINT64\r | |
2185 | EFIAPI\r | |
2186 | AsciiStrHexToUint64 (\r | |
17f695ed | 2187 | IN CONST CHAR8 *String\r |
ac644614 | 2188 | );\r |
2189 | \r | |
415aa2f1 | 2190 | #ifndef DISABLE_NEW_DEPRECATED_INTERFACES\r |
ac644614 | 2191 | \r |
2192 | /**\r | |
415aa2f1 SZ |
2193 | [ATTENTION] This function is deprecated for security reason.\r |
2194 | \r | |
ac644614 | 2195 | Convert one Null-terminated ASCII string to a Null-terminated\r |
2196 | Unicode string and returns the Unicode string.\r | |
2197 | \r | |
2198 | This function converts the contents of the ASCII string Source to the Unicode\r | |
2199 | string Destination, and returns Destination. The function terminates the\r | |
2200 | Unicode string Destination by appending a Null-terminator character at the end.\r | |
2201 | The caller is responsible to make sure Destination points to a buffer with size\r | |
2202 | equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.\r | |
2203 | \r | |
2204 | If Destination is NULL, then ASSERT().\r | |
2205 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
2206 | If Source is NULL, then ASSERT().\r | |
2207 | If Source and Destination overlap, then ASSERT().\r | |
2208 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r | |
2209 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
2210 | then ASSERT().\r | |
2211 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
2212 | PcdMaximumUnicodeStringLength ASCII characters not including the\r | |
2213 | Null-terminator, then ASSERT().\r | |
2214 | \r | |
af2dc6a7 | 2215 | @param Source The pointer to a Null-terminated ASCII string.\r |
2216 | @param Destination The pointer to a Null-terminated Unicode string.\r | |
ac644614 | 2217 | \r |
9aa049d9 | 2218 | @return Destination.\r |
ac644614 | 2219 | \r |
2220 | **/\r | |
2221 | CHAR16 *\r | |
2222 | EFIAPI\r | |
2223 | AsciiStrToUnicodeStr (\r | |
17f695ed | 2224 | IN CONST CHAR8 *Source,\r |
2225 | OUT CHAR16 *Destination\r | |
ac644614 | 2226 | );\r |
2227 | \r | |
415aa2f1 SZ |
2228 | #endif\r |
2229 | \r | |
3ab41b7a JY |
2230 | /**\r |
2231 | Convert one Null-terminated ASCII string to a Null-terminated\r | |
2232 | Unicode string.\r | |
2233 | \r | |
2234 | This function is similar to StrCpyS.\r | |
2235 | \r | |
2236 | This function converts the contents of the ASCII string Source to the Unicode\r | |
2237 | string Destination. The function terminates the Unicode string Destination by\r | |
2238 | appending a Null-terminator character at the end.\r | |
2239 | \r | |
2240 | The caller is responsible to make sure Destination points to a buffer with size\r | |
2241 | equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.\r | |
2242 | \r | |
2243 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
2244 | If an error would be returned, then the function will also ASSERT().\r | |
2245 | \r | |
2246 | If an error is returned, then the Destination is unmodified.\r | |
2247 | \r | |
2248 | @param Source The pointer to a Null-terminated ASCII string.\r | |
2249 | @param Destination The pointer to a Null-terminated Unicode string.\r | |
2250 | @param DestMax The maximum number of Destination Unicode\r | |
2251 | char, including terminating null char.\r | |
2252 | \r | |
2253 | @retval RETURN_SUCCESS String is converted.\r | |
2254 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than StrLen(Source).\r | |
2255 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
2256 | If Source is NULL.\r | |
2257 | If PcdMaximumUnicodeStringLength is not zero,\r | |
2258 | and DestMax is greater than\r | |
2259 | PcdMaximumUnicodeStringLength.\r | |
2260 | If PcdMaximumAsciiStringLength is not zero,\r | |
2261 | and DestMax is greater than\r | |
2262 | PcdMaximumAsciiStringLength.\r | |
2263 | If DestMax is 0.\r | |
2264 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
2265 | \r | |
2266 | **/\r | |
2267 | RETURN_STATUS\r | |
2268 | EFIAPI\r | |
2269 | AsciiStrToUnicodeStrS (\r | |
2270 | IN CONST CHAR8 *Source,\r | |
2271 | OUT CHAR16 *Destination,\r | |
2272 | IN UINTN DestMax\r | |
2273 | );\r | |
ac644614 | 2274 | \r |
02263214 HW |
2275 | /**\r |
2276 | Convert not more than Length successive characters from a Null-terminated\r | |
2277 | Ascii string to a Null-terminated Unicode string. If no null char is copied\r | |
2278 | from Source, then Destination[Length] is always set to null.\r | |
2279 | \r | |
2280 | This function converts not more than Length successive characters from the\r | |
2281 | Ascii string Source to the Unicode string Destination. The function\r | |
2282 | terminates the Unicode string Destination by appending a Null-terminator\r | |
2283 | character at the end.\r | |
2284 | \r | |
2285 | The caller is responsible to make sure Destination points to a buffer with\r | |
2286 | size not smaller than\r | |
2287 | ((MIN(AsciiStrLen(Source), Length) + 1) * sizeof (CHAR8)) in bytes.\r | |
2288 | \r | |
2289 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
2290 | If an error would be returned, then the function will also ASSERT().\r | |
2291 | \r | |
2292 | If an error is returned, then Destination and DestinationLength are\r | |
2293 | unmodified.\r | |
2294 | \r | |
2295 | @param Source The pointer to a Null-terminated Ascii string.\r | |
2296 | @param Length The maximum number of Ascii characters to convert.\r | |
2297 | @param Destination The pointer to a Null-terminated Unicode string.\r | |
2298 | @param DestMax The maximum number of Destination Unicode char,\r | |
2299 | including terminating null char.\r | |
2300 | @param DestinationLength The number of Ascii characters converted.\r | |
2301 | \r | |
2302 | @retval RETURN_SUCCESS String is converted.\r | |
2303 | @retval RETURN_INVALID_PARAMETER If Destination is NULL.\r | |
2304 | If Source is NULL.\r | |
2305 | If DestinationLength is NULL.\r | |
2306 | If PcdMaximumUnicodeStringLength is not\r | |
2307 | zero, and Length or DestMax is greater than\r | |
2308 | PcdMaximumUnicodeStringLength.\r | |
2309 | If PcdMaximumAsciiStringLength is not zero,\r | |
2310 | and Length or DestMax is greater than\r | |
2311 | PcdMaximumAsciiStringLength.\r | |
2312 | If DestMax is 0.\r | |
2313 | @retval RETURN_BUFFER_TOO_SMALL If DestMax is NOT greater than\r | |
2314 | MIN(AsciiStrLen(Source), Length).\r | |
2315 | @retval RETURN_ACCESS_DENIED If Source and Destination overlap.\r | |
2316 | \r | |
2317 | **/\r | |
2318 | RETURN_STATUS\r | |
2319 | EFIAPI\r | |
2320 | AsciiStrnToUnicodeStrS (\r | |
2321 | IN CONST CHAR8 *Source,\r | |
2322 | IN UINTN Length,\r | |
2323 | OUT CHAR16 *Destination,\r | |
2324 | IN UINTN DestMax,\r | |
2325 | OUT UINTN *DestinationLength\r | |
2326 | );\r | |
2327 | \r | |
ac644614 | 2328 | /**\r |
2329 | Converts an 8-bit value to an 8-bit BCD value.\r | |
2330 | \r | |
2331 | Converts the 8-bit value specified by Value to BCD. The BCD value is\r | |
2332 | returned.\r | |
2333 | \r | |
2334 | If Value >= 100, then ASSERT().\r | |
2335 | \r | |
2336 | @param Value The 8-bit value to convert to BCD. Range 0..99.\r | |
2337 | \r | |
9aa049d9 | 2338 | @return The BCD value.\r |
ac644614 | 2339 | \r |
2340 | **/\r | |
2341 | UINT8\r | |
2342 | EFIAPI\r | |
2343 | DecimalToBcd8 (\r | |
2344 | IN UINT8 Value\r | |
2345 | );\r | |
2346 | \r | |
2347 | \r | |
2348 | /**\r | |
2349 | Converts an 8-bit BCD value to an 8-bit value.\r | |
2350 | \r | |
2351 | Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit\r | |
2352 | value is returned.\r | |
2353 | \r | |
2354 | If Value >= 0xA0, then ASSERT().\r | |
2355 | If (Value & 0x0F) >= 0x0A, then ASSERT().\r | |
2356 | \r | |
2357 | @param Value The 8-bit BCD value to convert to an 8-bit value.\r | |
2358 | \r | |
2359 | @return The 8-bit value is returned.\r | |
2360 | \r | |
2361 | **/\r | |
2362 | UINT8\r | |
2363 | EFIAPI\r | |
2364 | BcdToDecimal8 (\r | |
2365 | IN UINT8 Value\r | |
2366 | );\r | |
2367 | \r | |
ae591c14 DM |
2368 | //\r |
2369 | // File Path Manipulation Functions\r | |
2370 | //\r | |
2371 | \r | |
2372 | /**\r | |
6a623094 | 2373 | Removes the last directory or file entry in a path.\r |
ae591c14 DM |
2374 | \r |
2375 | @param[in, out] Path The pointer to the path to modify.\r | |
2376 | \r | |
2377 | @retval FALSE Nothing was found to remove.\r | |
2378 | @retval TRUE A directory or file was removed.\r | |
2379 | **/\r | |
2380 | BOOLEAN\r | |
2381 | EFIAPI\r | |
2382 | PathRemoveLastItem(\r | |
2383 | IN OUT CHAR16 *Path\r | |
2384 | );\r | |
2385 | \r | |
2386 | /**\r | |
2387 | Function to clean up paths.\r | |
2388 | - Single periods in the path are removed.\r | |
2389 | - Double periods in the path are removed along with a single parent directory.\r | |
2390 | - Forward slashes L'/' are converted to backward slashes L'\'.\r | |
2391 | \r | |
2392 | This will be done inline and the existing buffer may be larger than required\r | |
2393 | upon completion.\r | |
2394 | \r | |
2395 | @param[in] Path The pointer to the string containing the path.\r | |
2396 | \r | |
00b7cc0f | 2397 | @return Returns Path, otherwise returns NULL to indicate that an error has occurred.\r |
ae591c14 DM |
2398 | **/\r |
2399 | CHAR16*\r | |
2400 | EFIAPI\r | |
2401 | PathCleanUpDirectories(\r | |
2402 | IN CHAR16 *Path\r | |
909ac47b | 2403 | );\r |
ac644614 | 2404 | \r |
2405 | //\r | |
2406 | // Linked List Functions and Macros\r | |
2407 | //\r | |
2408 | \r | |
2409 | /**\r | |
2410 | Initializes the head node of a doubly linked list that is declared as a\r | |
2411 | global variable in a module.\r | |
2412 | \r | |
2413 | Initializes the forward and backward links of a new linked list. After\r | |
2414 | initializing a linked list with this macro, the other linked list functions\r | |
2415 | may be used to add and remove nodes from the linked list. This macro results\r | |
2416 | in smaller executables by initializing the linked list in the data section,\r | |
2417 | instead if calling the InitializeListHead() function to perform the\r | |
2418 | equivalent operation.\r | |
2419 | \r | |
77f863ee | 2420 | @param ListHead The head note of a list to initialize.\r |
ac644614 | 2421 | \r |
2422 | **/\r | |
17f695ed | 2423 | #define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)}\r |
ac644614 | 2424 | \r |
2425 | \r | |
2426 | /**\r | |
2427 | Initializes the head node of a doubly linked list, and returns the pointer to\r | |
2428 | the head node of the doubly linked list.\r | |
2429 | \r | |
2430 | Initializes the forward and backward links of a new linked list. After\r | |
2431 | initializing a linked list with this function, the other linked list\r | |
2432 | functions may be used to add and remove nodes from the linked list. It is up\r | |
2433 | to the caller of this function to allocate the memory for ListHead.\r | |
2434 | \r | |
2435 | If ListHead is NULL, then ASSERT().\r | |
2436 | \r | |
2437 | @param ListHead A pointer to the head node of a new doubly linked list.\r | |
2438 | \r | |
2439 | @return ListHead\r | |
2440 | \r | |
2441 | **/\r | |
2442 | LIST_ENTRY *\r | |
2443 | EFIAPI\r | |
2444 | InitializeListHead (\r | |
aa0583c7 | 2445 | IN OUT LIST_ENTRY *ListHead\r |
ac644614 | 2446 | );\r |
2447 | \r | |
2448 | \r | |
2449 | /**\r | |
2450 | Adds a node to the beginning of a doubly linked list, and returns the pointer\r | |
2451 | to the head node of the doubly linked list.\r | |
2452 | \r | |
2453 | Adds the node Entry at the beginning of the doubly linked list denoted by\r | |
2454 | ListHead, and returns ListHead.\r | |
2455 | \r | |
2456 | If ListHead is NULL, then ASSERT().\r | |
2457 | If Entry is NULL, then ASSERT().\r | |
17f695ed | 2458 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or\r |
2459 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2460 | If PcdMaximumLinkedListLength is not zero, and prior to insertion the number\r |
ac644614 | 2461 | of nodes in ListHead, including the ListHead node, is greater than or\r |
2462 | equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
2463 | \r | |
2464 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
2465 | @param Entry A pointer to a node that is to be inserted at the beginning\r | |
2466 | of a doubly linked list.\r | |
2467 | \r | |
2468 | @return ListHead\r | |
2469 | \r | |
2470 | **/\r | |
2471 | LIST_ENTRY *\r | |
2472 | EFIAPI\r | |
2473 | InsertHeadList (\r | |
aa0583c7 | 2474 | IN OUT LIST_ENTRY *ListHead,\r |
2475 | IN OUT LIST_ENTRY *Entry\r | |
ac644614 | 2476 | );\r |
2477 | \r | |
2478 | \r | |
2479 | /**\r | |
2480 | Adds a node to the end of a doubly linked list, and returns the pointer to\r | |
2481 | the head node of the doubly linked list.\r | |
2482 | \r | |
2483 | Adds the node Entry to the end of the doubly linked list denoted by ListHead,\r | |
2484 | and returns ListHead.\r | |
2485 | \r | |
2486 | If ListHead is NULL, then ASSERT().\r | |
2487 | If Entry is NULL, then ASSERT().\r | |
17f695ed | 2488 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
2489 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2490 | If PcdMaximumLinkedListLength is not zero, and prior to insertion the number\r |
ac644614 | 2491 | of nodes in ListHead, including the ListHead node, is greater than or\r |
2492 | equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
2493 | \r | |
2494 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
2495 | @param Entry A pointer to a node that is to be added at the end of the\r | |
2496 | doubly linked list.\r | |
2497 | \r | |
2498 | @return ListHead\r | |
2499 | \r | |
2500 | **/\r | |
2501 | LIST_ENTRY *\r | |
2502 | EFIAPI\r | |
2503 | InsertTailList (\r | |
aa0583c7 | 2504 | IN OUT LIST_ENTRY *ListHead,\r |
2505 | IN OUT LIST_ENTRY *Entry\r | |
ac644614 | 2506 | );\r |
2507 | \r | |
2508 | \r | |
2509 | /**\r | |
2510 | Retrieves the first node of a doubly linked list.\r | |
2511 | \r | |
17f695ed | 2512 | Returns the first node of a doubly linked list. List must have been \r |
2513 | initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r | |
2514 | If List is empty, then List is returned.\r | |
ac644614 | 2515 | \r |
2516 | If List is NULL, then ASSERT().\r | |
17f695ed | 2517 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
2518 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2519 | If PcdMaximumLinkedListLength is not zero, and the number of nodes\r |
ac644614 | 2520 | in List, including the List node, is greater than or equal to\r |
2521 | PcdMaximumLinkedListLength, then ASSERT().\r | |
2522 | \r | |
2523 | @param List A pointer to the head node of a doubly linked list.\r | |
2524 | \r | |
2525 | @return The first node of a doubly linked list.\r | |
e01a125f | 2526 | @retval List The list is empty.\r |
ac644614 | 2527 | \r |
2528 | **/\r | |
2529 | LIST_ENTRY *\r | |
2530 | EFIAPI\r | |
2531 | GetFirstNode (\r | |
2532 | IN CONST LIST_ENTRY *List\r | |
2533 | );\r | |
2534 | \r | |
2535 | \r | |
2536 | /**\r | |
2537 | Retrieves the next node of a doubly linked list.\r | |
2538 | \r | |
17f695ed | 2539 | Returns the node of a doubly linked list that follows Node. \r |
2540 | List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()\r | |
2541 | or InitializeListHead(). If List is empty, then List is returned.\r | |
ac644614 | 2542 | \r |
2543 | If List is NULL, then ASSERT().\r | |
2544 | If Node is NULL, then ASSERT().\r | |
17f695ed | 2545 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
2546 | InitializeListHead(), then ASSERT().\r | |
a71865b1 LG |
2547 | If PcdMaximumLinkedListLength is not zero, and List contains more than\r |
2548 | PcdMaximumLinkedListLength nodes, then ASSERT().\r | |
1081f624 | 2549 | If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r |
ac644614 | 2550 | \r |
2551 | @param List A pointer to the head node of a doubly linked list.\r | |
2552 | @param Node A pointer to a node in the doubly linked list.\r | |
2553 | \r | |
af2dc6a7 | 2554 | @return The pointer to the next node if one exists. Otherwise List is returned.\r |
ac644614 | 2555 | \r |
2556 | **/\r | |
2557 | LIST_ENTRY *\r | |
2558 | EFIAPI\r | |
2559 | GetNextNode (\r | |
2560 | IN CONST LIST_ENTRY *List,\r | |
2561 | IN CONST LIST_ENTRY *Node\r | |
2562 | );\r | |
2563 | \r | |
cbca8de5 | 2564 | \r |
2565 | /**\r | |
2566 | Retrieves the previous node of a doubly linked list.\r | |
2567 | \r | |
2568 | Returns the node of a doubly linked list that precedes Node. \r | |
2569 | List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()\r | |
2570 | or InitializeListHead(). If List is empty, then List is returned.\r | |
2571 | \r | |
2572 | If List is NULL, then ASSERT().\r | |
2573 | If Node is NULL, then ASSERT().\r | |
2574 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r | |
2575 | InitializeListHead(), then ASSERT().\r | |
a71865b1 LG |
2576 | If PcdMaximumLinkedListLength is not zero, and List contains more than\r |
2577 | PcdMaximumLinkedListLength nodes, then ASSERT().\r | |
cbca8de5 | 2578 | If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r |
2579 | \r | |
2580 | @param List A pointer to the head node of a doubly linked list.\r | |
2581 | @param Node A pointer to a node in the doubly linked list.\r | |
2582 | \r | |
af2dc6a7 | 2583 | @return The pointer to the previous node if one exists. Otherwise List is returned.\r |
cbca8de5 | 2584 | \r |
2585 | **/\r | |
2586 | LIST_ENTRY *\r | |
2587 | EFIAPI\r | |
2588 | GetPreviousNode (\r | |
2589 | IN CONST LIST_ENTRY *List,\r | |
2590 | IN CONST LIST_ENTRY *Node\r | |
2591 | );\r | |
ac644614 | 2592 | \r |
cbca8de5 | 2593 | \r |
ac644614 | 2594 | /**\r |
2595 | Checks to see if a doubly linked list is empty or not.\r | |
2596 | \r | |
2597 | Checks to see if the doubly linked list is empty. If the linked list contains\r | |
2598 | zero nodes, this function returns TRUE. Otherwise, it returns FALSE.\r | |
2599 | \r | |
2600 | If ListHead is NULL, then ASSERT().\r | |
17f695ed | 2601 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
2602 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2603 | If PcdMaximumLinkedListLength is not zero, and the number of nodes\r |
ac644614 | 2604 | in List, including the List node, is greater than or equal to\r |
2605 | PcdMaximumLinkedListLength, then ASSERT().\r | |
2606 | \r | |
2607 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
2608 | \r | |
2609 | @retval TRUE The linked list is empty.\r | |
2610 | @retval FALSE The linked list is not empty.\r | |
2611 | \r | |
2612 | **/\r | |
2613 | BOOLEAN\r | |
2614 | EFIAPI\r | |
2615 | IsListEmpty (\r | |
2616 | IN CONST LIST_ENTRY *ListHead\r | |
2617 | );\r | |
2618 | \r | |
2619 | \r | |
2620 | /**\r | |
aa0583c7 | 2621 | Determines if a node in a doubly linked list is the head node of a the same\r |
2622 | doubly linked list. This function is typically used to terminate a loop that\r | |
2623 | traverses all the nodes in a doubly linked list starting with the head node.\r | |
ac644614 | 2624 | \r |
aa0583c7 | 2625 | Returns TRUE if Node is equal to List. Returns FALSE if Node is one of the\r |
2626 | nodes in the doubly linked list specified by List. List must have been\r | |
17f695ed | 2627 | initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r |
ac644614 | 2628 | \r |
2629 | If List is NULL, then ASSERT().\r | |
2630 | If Node is NULL, then ASSERT().\r | |
17f695ed | 2631 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), \r |
2632 | then ASSERT().\r | |
a71865b1 | 2633 | If PcdMaximumLinkedListLength is not zero, and the number of nodes\r |
ac644614 | 2634 | in List, including the List node, is greater than or equal to\r |
2635 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1081f624 | 2636 | If PcdVerifyNodeInList is TRUE and Node is not a node in List the and Node is not equal \r |
2637 | to List, then ASSERT().\r | |
ac644614 | 2638 | \r |
2639 | @param List A pointer to the head node of a doubly linked list.\r | |
2640 | @param Node A pointer to a node in the doubly linked list.\r | |
2641 | \r | |
1955808d LG |
2642 | @retval TRUE Node is the head of the doubly-linked list pointed by List.\r |
2643 | @retval FALSE Node is not the head of the doubly-linked list pointed by List.\r | |
ac644614 | 2644 | \r |
2645 | **/\r | |
2646 | BOOLEAN\r | |
2647 | EFIAPI\r | |
2648 | IsNull (\r | |
2649 | IN CONST LIST_ENTRY *List,\r | |
2650 | IN CONST LIST_ENTRY *Node\r | |
2651 | );\r | |
2652 | \r | |
2653 | \r | |
2654 | /**\r | |
2655 | Determines if a node the last node in a doubly linked list.\r | |
2656 | \r | |
2657 | Returns TRUE if Node is the last node in the doubly linked list specified by\r | |
2658 | List. Otherwise, FALSE is returned. List must have been initialized with\r | |
17f695ed | 2659 | INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r |
ac644614 | 2660 | \r |
2661 | If List is NULL, then ASSERT().\r | |
2662 | If Node is NULL, then ASSERT().\r | |
17f695ed | 2663 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or\r |
2664 | InitializeListHead(), then ASSERT().\r | |
a71865b1 | 2665 | If PcdMaximumLinkedListLength is not zero, and the number of nodes\r |
ac644614 | 2666 | in List, including the List node, is greater than or equal to\r |
2667 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1081f624 | 2668 | If PcdVerifyNodeInList is TRUE and Node is not a node in List, then ASSERT().\r |
ac644614 | 2669 | \r |
2670 | @param List A pointer to the head node of a doubly linked list.\r | |
2671 | @param Node A pointer to a node in the doubly linked list.\r | |
2672 | \r | |
2673 | @retval TRUE Node is the last node in the linked list.\r | |
2674 | @retval FALSE Node is not the last node in the linked list.\r | |
2675 | \r | |
2676 | **/\r | |
2677 | BOOLEAN\r | |
2678 | EFIAPI\r | |
2679 | IsNodeAtEnd (\r | |
2680 | IN CONST LIST_ENTRY *List,\r | |
2681 | IN CONST LIST_ENTRY *Node\r | |
2682 | );\r | |
2683 | \r | |
2684 | \r | |
2685 | /**\r | |
2686 | Swaps the location of two nodes in a doubly linked list, and returns the\r | |
2687 | first node after the swap.\r | |
2688 | \r | |
2689 | If FirstEntry is identical to SecondEntry, then SecondEntry is returned.\r | |
2690 | Otherwise, the location of the FirstEntry node is swapped with the location\r | |
2691 | of the SecondEntry node in a doubly linked list. SecondEntry must be in the\r | |
2692 | same double linked list as FirstEntry and that double linked list must have\r | |
17f695ed | 2693 | been initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(). \r |
2694 | SecondEntry is returned after the nodes are swapped.\r | |
ac644614 | 2695 | \r |
2696 | If FirstEntry is NULL, then ASSERT().\r | |
2697 | If SecondEntry is NULL, then ASSERT().\r | |
1081f624 | 2698 | If PcdVerifyNodeInList is TRUE and SecondEntry and FirstEntry are not in the \r |
2699 | same linked list, then ASSERT().\r | |
ac644614 | 2700 | If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r |
2701 | linked list containing the FirstEntry and SecondEntry nodes, including\r | |
2702 | the FirstEntry and SecondEntry nodes, is greater than or equal to\r | |
2703 | PcdMaximumLinkedListLength, then ASSERT().\r | |
2704 | \r | |
2705 | @param FirstEntry A pointer to a node in a linked list.\r | |
2706 | @param SecondEntry A pointer to another node in the same linked list.\r | |
38bbd3d9 | 2707 | \r |
9aa049d9 | 2708 | @return SecondEntry.\r |
ac644614 | 2709 | \r |
2710 | **/\r | |
2711 | LIST_ENTRY *\r | |
2712 | EFIAPI\r | |
2713 | SwapListEntries (\r | |
aa0583c7 | 2714 | IN OUT LIST_ENTRY *FirstEntry,\r |
2715 | IN OUT LIST_ENTRY *SecondEntry\r | |
ac644614 | 2716 | );\r |
2717 | \r | |
2718 | \r | |
2719 | /**\r | |
2720 | Removes a node from a doubly linked list, and returns the node that follows\r | |
2721 | the removed node.\r | |
2722 | \r | |
2723 | Removes the node Entry from a doubly linked list. It is up to the caller of\r | |
2724 | this function to release the memory used by this node if that is required. On\r | |
2725 | exit, the node following Entry in the doubly linked list is returned. If\r | |
2726 | Entry is the only node in the linked list, then the head node of the linked\r | |
2727 | list is returned.\r | |
2728 | \r | |
2729 | If Entry is NULL, then ASSERT().\r | |
2730 | If Entry is the head node of an empty list, then ASSERT().\r | |
2731 | If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r | |
2732 | linked list containing Entry, including the Entry node, is greater than\r | |
2733 | or equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
2734 | \r | |
9aa049d9 | 2735 | @param Entry A pointer to a node in a linked list.\r |
ac644614 | 2736 | \r |
9aa049d9 | 2737 | @return Entry.\r |
ac644614 | 2738 | \r |
2739 | **/\r | |
2740 | LIST_ENTRY *\r | |
2741 | EFIAPI\r | |
2742 | RemoveEntryList (\r | |
2743 | IN CONST LIST_ENTRY *Entry\r | |
2744 | );\r | |
2745 | \r | |
2746 | //\r | |
2747 | // Math Services\r | |
2748 | //\r | |
2749 | \r | |
2750 | /**\r | |
2751 | Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled\r | |
2752 | with zeros. The shifted value is returned.\r | |
2753 | \r | |
2754 | This function shifts the 64-bit value Operand to the left by Count bits. The\r | |
2755 | low Count bits are set to zero. The shifted value is returned.\r | |
2756 | \r | |
2757 | If Count is greater than 63, then ASSERT().\r | |
2758 | \r | |
2759 | @param Operand The 64-bit operand to shift left.\r | |
2760 | @param Count The number of bits to shift left.\r | |
2761 | \r | |
9aa049d9 | 2762 | @return Operand << Count.\r |
ac644614 | 2763 | \r |
2764 | **/\r | |
2765 | UINT64\r | |
2766 | EFIAPI\r | |
2767 | LShiftU64 (\r | |
2768 | IN UINT64 Operand,\r | |
2769 | IN UINTN Count\r | |
2770 | );\r | |
2771 | \r | |
2772 | \r | |
2773 | /**\r | |
2774 | Shifts a 64-bit integer right between 0 and 63 bits. This high bits are\r | |
2775 | filled with zeros. The shifted value is returned.\r | |
2776 | \r | |
2777 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
2778 | high Count bits are set to zero. The shifted value is returned.\r | |
2779 | \r | |
2780 | If Count is greater than 63, then ASSERT().\r | |
2781 | \r | |
2782 | @param Operand The 64-bit operand to shift right.\r | |
2783 | @param Count The number of bits to shift right.\r | |
2784 | \r | |
2785 | @return Operand >> Count\r | |
2786 | \r | |
2787 | **/\r | |
2788 | UINT64\r | |
2789 | EFIAPI\r | |
2790 | RShiftU64 (\r | |
2791 | IN UINT64 Operand,\r | |
2792 | IN UINTN Count\r | |
2793 | );\r | |
2794 | \r | |
2795 | \r | |
2796 | /**\r | |
2797 | Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled\r | |
2798 | with original integer's bit 63. The shifted value is returned.\r | |
2799 | \r | |
2800 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
2801 | high Count bits are set to bit 63 of Operand. The shifted value is returned.\r | |
2802 | \r | |
2803 | If Count is greater than 63, then ASSERT().\r | |
2804 | \r | |
2805 | @param Operand The 64-bit operand to shift right.\r | |
2806 | @param Count The number of bits to shift right.\r | |
2807 | \r | |
2808 | @return Operand >> Count\r | |
2809 | \r | |
2810 | **/\r | |
2811 | UINT64\r | |
2812 | EFIAPI\r | |
2813 | ARShiftU64 (\r | |
2814 | IN UINT64 Operand,\r | |
2815 | IN UINTN Count\r | |
2816 | );\r | |
2817 | \r | |
2818 | \r | |
2819 | /**\r | |
2820 | Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits\r | |
2821 | with the high bits that were rotated.\r | |
2822 | \r | |
2823 | This function rotates the 32-bit value Operand to the left by Count bits. The\r | |
2824 | low Count bits are fill with the high Count bits of Operand. The rotated\r | |
2825 | value is returned.\r | |
2826 | \r | |
2827 | If Count is greater than 31, then ASSERT().\r | |
2828 | \r | |
2829 | @param Operand The 32-bit operand to rotate left.\r | |
2830 | @param Count The number of bits to rotate left.\r | |
2831 | \r | |
17f695ed | 2832 | @return Operand << Count\r |
ac644614 | 2833 | \r |
2834 | **/\r | |
2835 | UINT32\r | |
2836 | EFIAPI\r | |
2837 | LRotU32 (\r | |
2838 | IN UINT32 Operand,\r | |
2839 | IN UINTN Count\r | |
2840 | );\r | |
2841 | \r | |
2842 | \r | |
2843 | /**\r | |
2844 | Rotates a 32-bit integer right between 0 and 31 bits, filling the high bits\r | |
2845 | with the low bits that were rotated.\r | |
2846 | \r | |
2847 | This function rotates the 32-bit value Operand to the right by Count bits.\r | |
2848 | The high Count bits are fill with the low Count bits of Operand. The rotated\r | |
2849 | value is returned.\r | |
2850 | \r | |
2851 | If Count is greater than 31, then ASSERT().\r | |
2852 | \r | |
2853 | @param Operand The 32-bit operand to rotate right.\r | |
2854 | @param Count The number of bits to rotate right.\r | |
2855 | \r | |
2fe241a2 | 2856 | @return Operand >> Count\r |
ac644614 | 2857 | \r |
2858 | **/\r | |
2859 | UINT32\r | |
2860 | EFIAPI\r | |
2861 | RRotU32 (\r | |
2862 | IN UINT32 Operand,\r | |
2863 | IN UINTN Count\r | |
2864 | );\r | |
2865 | \r | |
2866 | \r | |
2867 | /**\r | |
2868 | Rotates a 64-bit integer left between 0 and 63 bits, filling the low bits\r | |
2869 | with the high bits that were rotated.\r | |
2870 | \r | |
2871 | This function rotates the 64-bit value Operand to the left by Count bits. The\r | |
2872 | low Count bits are fill with the high Count bits of Operand. The rotated\r | |
2873 | value is returned.\r | |
2874 | \r | |
2875 | If Count is greater than 63, then ASSERT().\r | |
2876 | \r | |
2877 | @param Operand The 64-bit operand to rotate left.\r | |
2878 | @param Count The number of bits to rotate left.\r | |
2879 | \r | |
17f695ed | 2880 | @return Operand << Count\r |
ac644614 | 2881 | \r |
2882 | **/\r | |
2883 | UINT64\r | |
2884 | EFIAPI\r | |
2885 | LRotU64 (\r | |
2886 | IN UINT64 Operand,\r | |
2887 | IN UINTN Count\r | |
2888 | );\r | |
2889 | \r | |
2890 | \r | |
2891 | /**\r | |
2892 | Rotates a 64-bit integer right between 0 and 63 bits, filling the high bits\r | |
2893 | with the high low bits that were rotated.\r | |
2894 | \r | |
2895 | This function rotates the 64-bit value Operand to the right by Count bits.\r | |
2896 | The high Count bits are fill with the low Count bits of Operand. The rotated\r | |
2897 | value is returned.\r | |
2898 | \r | |
2899 | If Count is greater than 63, then ASSERT().\r | |
2900 | \r | |
2901 | @param Operand The 64-bit operand to rotate right.\r | |
2902 | @param Count The number of bits to rotate right.\r | |
2903 | \r | |
17f695ed | 2904 | @return Operand >> Count\r |
ac644614 | 2905 | \r |
2906 | **/\r | |
2907 | UINT64\r | |
2908 | EFIAPI\r | |
2909 | RRotU64 (\r | |
2910 | IN UINT64 Operand,\r | |
2911 | IN UINTN Count\r | |
2912 | );\r | |
2913 | \r | |
2914 | \r | |
2915 | /**\r | |
2916 | Returns the bit position of the lowest bit set in a 32-bit value.\r | |
2917 | \r | |
2918 | This function computes the bit position of the lowest bit set in the 32-bit\r | |
2919 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
2920 | Otherwise, a value between 0 and 31 is returned.\r | |
2921 | \r | |
2922 | @param Operand The 32-bit operand to evaluate.\r | |
2923 | \r | |
9aa049d9 | 2924 | @retval 0..31 The lowest bit set in Operand was found.\r |
17f695ed | 2925 | @retval -1 Operand is zero.\r |
ac644614 | 2926 | \r |
2927 | **/\r | |
2928 | INTN\r | |
2929 | EFIAPI\r | |
2930 | LowBitSet32 (\r | |
2931 | IN UINT32 Operand\r | |
2932 | );\r | |
2933 | \r | |
2934 | \r | |
2935 | /**\r | |
2936 | Returns the bit position of the lowest bit set in a 64-bit value.\r | |
2937 | \r | |
2938 | This function computes the bit position of the lowest bit set in the 64-bit\r | |
2939 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
2940 | Otherwise, a value between 0 and 63 is returned.\r | |
2941 | \r | |
2942 | @param Operand The 64-bit operand to evaluate.\r | |
2943 | \r | |
9aa049d9 | 2944 | @retval 0..63 The lowest bit set in Operand was found.\r |
17f695ed | 2945 | @retval -1 Operand is zero.\r |
2946 | \r | |
ac644614 | 2947 | \r |
2948 | **/\r | |
2949 | INTN\r | |
2950 | EFIAPI\r | |
2951 | LowBitSet64 (\r | |
2952 | IN UINT64 Operand\r | |
2953 | );\r | |
2954 | \r | |
2955 | \r | |
2956 | /**\r | |
2957 | Returns the bit position of the highest bit set in a 32-bit value. Equivalent\r | |
2958 | to log2(x).\r | |
2959 | \r | |
2960 | This function computes the bit position of the highest bit set in the 32-bit\r | |
2961 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
2962 | Otherwise, a value between 0 and 31 is returned.\r | |
2963 | \r | |
2964 | @param Operand The 32-bit operand to evaluate.\r | |
2965 | \r | |
9aa049d9 | 2966 | @retval 0..31 Position of the highest bit set in Operand if found.\r |
17f695ed | 2967 | @retval -1 Operand is zero.\r |
ac644614 | 2968 | \r |
2969 | **/\r | |
2970 | INTN\r | |
2971 | EFIAPI\r | |
2972 | HighBitSet32 (\r | |
2973 | IN UINT32 Operand\r | |
2974 | );\r | |
2975 | \r | |
2976 | \r | |
2977 | /**\r | |
2978 | Returns the bit position of the highest bit set in a 64-bit value. Equivalent\r | |
2979 | to log2(x).\r | |
2980 | \r | |
2981 | This function computes the bit position of the highest bit set in the 64-bit\r | |
2982 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
2983 | Otherwise, a value between 0 and 63 is returned.\r | |
2984 | \r | |
2985 | @param Operand The 64-bit operand to evaluate.\r | |
2986 | \r | |
9aa049d9 | 2987 | @retval 0..63 Position of the highest bit set in Operand if found.\r |
17f695ed | 2988 | @retval -1 Operand is zero.\r |
ac644614 | 2989 | \r |
2990 | **/\r | |
2991 | INTN\r | |
2992 | EFIAPI\r | |
2993 | HighBitSet64 (\r | |
2994 | IN UINT64 Operand\r | |
2995 | );\r | |
2996 | \r | |
2997 | \r | |
2998 | /**\r | |
2999 | Returns the value of the highest bit set in a 32-bit value. Equivalent to\r | |
17f695ed | 3000 | 1 << log2(x).\r |
ac644614 | 3001 | \r |
3002 | This function computes the value of the highest bit set in the 32-bit value\r | |
3003 | specified by Operand. If Operand is zero, then zero is returned.\r | |
3004 | \r | |
3005 | @param Operand The 32-bit operand to evaluate.\r | |
3006 | \r | |
3007 | @return 1 << HighBitSet32(Operand)\r | |
3008 | @retval 0 Operand is zero.\r | |
3009 | \r | |
3010 | **/\r | |
3011 | UINT32\r | |
3012 | EFIAPI\r | |
3013 | GetPowerOfTwo32 (\r | |
3014 | IN UINT32 Operand\r | |
3015 | );\r | |
3016 | \r | |
3017 | \r | |
3018 | /**\r | |
3019 | Returns the value of the highest bit set in a 64-bit value. Equivalent to\r | |
17f695ed | 3020 | 1 << log2(x).\r |
ac644614 | 3021 | \r |
3022 | This function computes the value of the highest bit set in the 64-bit value\r | |
3023 | specified by Operand. If Operand is zero, then zero is returned.\r | |
3024 | \r | |
3025 | @param Operand The 64-bit operand to evaluate.\r | |
3026 | \r | |
3027 | @return 1 << HighBitSet64(Operand)\r | |
3028 | @retval 0 Operand is zero.\r | |
3029 | \r | |
3030 | **/\r | |
3031 | UINT64\r | |
3032 | EFIAPI\r | |
3033 | GetPowerOfTwo64 (\r | |
3034 | IN UINT64 Operand\r | |
3035 | );\r | |
3036 | \r | |
3037 | \r | |
3038 | /**\r | |
af2dc6a7 | 3039 | Switches the endianness of a 16-bit integer.\r |
ac644614 | 3040 | \r |
3041 | This function swaps the bytes in a 16-bit unsigned value to switch the value\r | |
3042 | from little endian to big endian or vice versa. The byte swapped value is\r | |
3043 | returned.\r | |
3044 | \r | |
2a53dabf | 3045 | @param Value A 16-bit unsigned value.\r |
ac644614 | 3046 | \r |
efb23117 | 3047 | @return The byte swapped Value.\r |
ac644614 | 3048 | \r |
3049 | **/\r | |
3050 | UINT16\r | |
3051 | EFIAPI\r | |
3052 | SwapBytes16 (\r | |
3053 | IN UINT16 Value\r | |
3054 | );\r | |
3055 | \r | |
3056 | \r | |
3057 | /**\r | |
af2dc6a7 | 3058 | Switches the endianness of a 32-bit integer.\r |
ac644614 | 3059 | \r |
3060 | This function swaps the bytes in a 32-bit unsigned value to switch the value\r | |
3061 | from little endian to big endian or vice versa. The byte swapped value is\r | |
3062 | returned.\r | |
3063 | \r | |
2a53dabf | 3064 | @param Value A 32-bit unsigned value.\r |
ac644614 | 3065 | \r |
efb23117 | 3066 | @return The byte swapped Value.\r |
ac644614 | 3067 | \r |
3068 | **/\r | |
3069 | UINT32\r | |
3070 | EFIAPI\r | |
3071 | SwapBytes32 (\r | |
3072 | IN UINT32 Value\r | |
3073 | );\r | |
3074 | \r | |
3075 | \r | |
3076 | /**\r | |
af2dc6a7 | 3077 | Switches the endianness of a 64-bit integer.\r |
ac644614 | 3078 | \r |
3079 | This function swaps the bytes in a 64-bit unsigned value to switch the value\r | |
3080 | from little endian to big endian or vice versa. The byte swapped value is\r | |
3081 | returned.\r | |
3082 | \r | |
2a53dabf | 3083 | @param Value A 64-bit unsigned value.\r |
ac644614 | 3084 | \r |
efb23117 | 3085 | @return The byte swapped Value.\r |
ac644614 | 3086 | \r |
3087 | **/\r | |
3088 | UINT64\r | |
3089 | EFIAPI\r | |
3090 | SwapBytes64 (\r | |
3091 | IN UINT64 Value\r | |
3092 | );\r | |
3093 | \r | |
3094 | \r | |
3095 | /**\r | |
3096 | Multiples a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
3097 | generates a 64-bit unsigned result.\r | |
3098 | \r | |
3099 | This function multiples the 64-bit unsigned value Multiplicand by the 32-bit\r | |
3100 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
3101 | bit unsigned result is returned.\r | |
3102 | \r | |
ac644614 | 3103 | @param Multiplicand A 64-bit unsigned value.\r |
3104 | @param Multiplier A 32-bit unsigned value.\r | |
3105 | \r | |
3106 | @return Multiplicand * Multiplier\r | |
3107 | \r | |
3108 | **/\r | |
3109 | UINT64\r | |
3110 | EFIAPI\r | |
3111 | MultU64x32 (\r | |
3112 | IN UINT64 Multiplicand,\r | |
3113 | IN UINT32 Multiplier\r | |
3114 | );\r | |
3115 | \r | |
3116 | \r | |
3117 | /**\r | |
3118 | Multiples a 64-bit unsigned integer by a 64-bit unsigned integer and\r | |
3119 | generates a 64-bit unsigned result.\r | |
3120 | \r | |
3121 | This function multiples the 64-bit unsigned value Multiplicand by the 64-bit\r | |
3122 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
3123 | bit unsigned result is returned.\r | |
3124 | \r | |
ac644614 | 3125 | @param Multiplicand A 64-bit unsigned value.\r |
3126 | @param Multiplier A 64-bit unsigned value.\r | |
3127 | \r | |
af2dc6a7 | 3128 | @return Multiplicand * Multiplier.\r |
ac644614 | 3129 | \r |
3130 | **/\r | |
3131 | UINT64\r | |
3132 | EFIAPI\r | |
3133 | MultU64x64 (\r | |
3134 | IN UINT64 Multiplicand,\r | |
3135 | IN UINT64 Multiplier\r | |
3136 | );\r | |
3137 | \r | |
3138 | \r | |
3139 | /**\r | |
3140 | Multiples a 64-bit signed integer by a 64-bit signed integer and generates a\r | |
3141 | 64-bit signed result.\r | |
3142 | \r | |
3143 | This function multiples the 64-bit signed value Multiplicand by the 64-bit\r | |
3144 | signed value Multiplier and generates a 64-bit signed result. This 64-bit\r | |
3145 | signed result is returned.\r | |
3146 | \r | |
ac644614 | 3147 | @param Multiplicand A 64-bit signed value.\r |
3148 | @param Multiplier A 64-bit signed value.\r | |
3149 | \r | |
3150 | @return Multiplicand * Multiplier\r | |
3151 | \r | |
3152 | **/\r | |
3153 | INT64\r | |
3154 | EFIAPI\r | |
3155 | MultS64x64 (\r | |
3156 | IN INT64 Multiplicand,\r | |
3157 | IN INT64 Multiplier\r | |
3158 | );\r | |
3159 | \r | |
3160 | \r | |
3161 | /**\r | |
3162 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
3163 | a 64-bit unsigned result.\r | |
3164 | \r | |
3165 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
3166 | unsigned value Divisor and generates a 64-bit unsigned quotient. This\r | |
3167 | function returns the 64-bit unsigned quotient.\r | |
3168 | \r | |
3169 | If Divisor is 0, then ASSERT().\r | |
3170 | \r | |
3171 | @param Dividend A 64-bit unsigned value.\r | |
3172 | @param Divisor A 32-bit unsigned value.\r | |
3173 | \r | |
af2dc6a7 | 3174 | @return Dividend / Divisor.\r |
ac644614 | 3175 | \r |
3176 | **/\r | |
3177 | UINT64\r | |
3178 | EFIAPI\r | |
3179 | DivU64x32 (\r | |
3180 | IN UINT64 Dividend,\r | |
3181 | IN UINT32 Divisor\r | |
3182 | );\r | |
3183 | \r | |
3184 | \r | |
3185 | /**\r | |
3186 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
3187 | a 32-bit unsigned remainder.\r | |
3188 | \r | |
3189 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
3190 | unsigned value Divisor and generates a 32-bit remainder. This function\r | |
3191 | returns the 32-bit unsigned remainder.\r | |
3192 | \r | |
3193 | If Divisor is 0, then ASSERT().\r | |
3194 | \r | |
3195 | @param Dividend A 64-bit unsigned value.\r | |
3196 | @param Divisor A 32-bit unsigned value.\r | |
3197 | \r | |
af2dc6a7 | 3198 | @return Dividend % Divisor.\r |
ac644614 | 3199 | \r |
3200 | **/\r | |
3201 | UINT32\r | |
3202 | EFIAPI\r | |
3203 | ModU64x32 (\r | |
3204 | IN UINT64 Dividend,\r | |
3205 | IN UINT32 Divisor\r | |
3206 | );\r | |
3207 | \r | |
3208 | \r | |
3209 | /**\r | |
3210 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
3211 | a 64-bit unsigned result and an optional 32-bit unsigned remainder.\r | |
3212 | \r | |
3213 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
3214 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
3215 | is not NULL, then the 32-bit unsigned remainder is returned in Remainder.\r | |
3216 | This function returns the 64-bit unsigned quotient.\r | |
3217 | \r | |
3218 | If Divisor is 0, then ASSERT().\r | |
3219 | \r | |
3220 | @param Dividend A 64-bit unsigned value.\r | |
3221 | @param Divisor A 32-bit unsigned value.\r | |
3222 | @param Remainder A pointer to a 32-bit unsigned value. This parameter is\r | |
3223 | optional and may be NULL.\r | |
3224 | \r | |
af2dc6a7 | 3225 | @return Dividend / Divisor.\r |
ac644614 | 3226 | \r |
3227 | **/\r | |
3228 | UINT64\r | |
3229 | EFIAPI\r | |
3230 | DivU64x32Remainder (\r | |
3231 | IN UINT64 Dividend,\r | |
3232 | IN UINT32 Divisor,\r | |
3233 | OUT UINT32 *Remainder OPTIONAL\r | |
3234 | );\r | |
3235 | \r | |
3236 | \r | |
3237 | /**\r | |
3238 | Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates\r | |
3239 | a 64-bit unsigned result and an optional 64-bit unsigned remainder.\r | |
3240 | \r | |
3241 | This function divides the 64-bit unsigned value Dividend by the 64-bit\r | |
3242 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
3243 | is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r | |
3244 | This function returns the 64-bit unsigned quotient.\r | |
3245 | \r | |
3246 | If Divisor is 0, then ASSERT().\r | |
3247 | \r | |
3248 | @param Dividend A 64-bit unsigned value.\r | |
3249 | @param Divisor A 64-bit unsigned value.\r | |
3250 | @param Remainder A pointer to a 64-bit unsigned value. This parameter is\r | |
3251 | optional and may be NULL.\r | |
3252 | \r | |
af2dc6a7 | 3253 | @return Dividend / Divisor.\r |
ac644614 | 3254 | \r |
3255 | **/\r | |
3256 | UINT64\r | |
3257 | EFIAPI\r | |
3258 | DivU64x64Remainder (\r | |
3259 | IN UINT64 Dividend,\r | |
3260 | IN UINT64 Divisor,\r | |
3261 | OUT UINT64 *Remainder OPTIONAL\r | |
3262 | );\r | |
3263 | \r | |
3264 | \r | |
3265 | /**\r | |
3266 | Divides a 64-bit signed integer by a 64-bit signed integer and generates a\r | |
3267 | 64-bit signed result and a optional 64-bit signed remainder.\r | |
3268 | \r | |
3269 | This function divides the 64-bit signed value Dividend by the 64-bit signed\r | |
3270 | value Divisor and generates a 64-bit signed quotient. If Remainder is not\r | |
3271 | NULL, then the 64-bit signed remainder is returned in Remainder. This\r | |
3272 | function returns the 64-bit signed quotient.\r | |
3273 | \r | |
9aa049d9 | 3274 | It is the caller's responsibility to not call this function with a Divisor of 0.\r |
17f695ed | 3275 | If Divisor is 0, then the quotient and remainder should be assumed to be \r |
3276 | the largest negative integer.\r | |
3277 | \r | |
ac644614 | 3278 | If Divisor is 0, then ASSERT().\r |
3279 | \r | |
3280 | @param Dividend A 64-bit signed value.\r | |
3281 | @param Divisor A 64-bit signed value.\r | |
3282 | @param Remainder A pointer to a 64-bit signed value. This parameter is\r | |
3283 | optional and may be NULL.\r | |
3284 | \r | |
af2dc6a7 | 3285 | @return Dividend / Divisor.\r |
ac644614 | 3286 | \r |
3287 | **/\r | |
3288 | INT64\r | |
3289 | EFIAPI\r | |
3290 | DivS64x64Remainder (\r | |
3291 | IN INT64 Dividend,\r | |
3292 | IN INT64 Divisor,\r | |
3293 | OUT INT64 *Remainder OPTIONAL\r | |
3294 | );\r | |
3295 | \r | |
3296 | \r | |
3297 | /**\r | |
3298 | Reads a 16-bit value from memory that may be unaligned.\r | |
3299 | \r | |
3300 | This function returns the 16-bit value pointed to by Buffer. The function\r | |
3301 | guarantees that the read operation does not produce 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 16-bit value that may be unaligned.\r |
ac644614 | 3306 | \r |
5385a579 | 3307 | @return The 16-bit value read from Buffer.\r |
ac644614 | 3308 | \r |
3309 | **/\r | |
3310 | UINT16\r | |
3311 | EFIAPI\r | |
3312 | ReadUnaligned16 (\r | |
5385a579 | 3313 | IN CONST UINT16 *Buffer\r |
ac644614 | 3314 | );\r |
3315 | \r | |
3316 | \r | |
3317 | /**\r | |
3318 | Writes a 16-bit value to memory that may be unaligned.\r | |
3319 | \r | |
3320 | This function writes the 16-bit value specified by Value to Buffer. Value is\r | |
3321 | returned. The function guarantees that the write operation does not produce\r | |
3322 | an alignment fault.\r | |
3323 | \r | |
3324 | If the Buffer is NULL, then ASSERT().\r | |
3325 | \r | |
af2dc6a7 | 3326 | @param Buffer The pointer to a 16-bit value that may be unaligned.\r |
ac644614 | 3327 | @param Value 16-bit value to write to Buffer.\r |
3328 | \r | |
5385a579 | 3329 | @return The 16-bit value to write to Buffer.\r |
ac644614 | 3330 | \r |
3331 | **/\r | |
3332 | UINT16\r | |
3333 | EFIAPI\r | |
3334 | WriteUnaligned16 (\r | |
5385a579 | 3335 | OUT UINT16 *Buffer,\r |
3336 | IN UINT16 Value\r | |
ac644614 | 3337 | );\r |
3338 | \r | |
3339 | \r | |
3340 | /**\r | |
3341 | Reads a 24-bit value from memory that may be unaligned.\r | |
3342 | \r | |
3343 | This function returns the 24-bit value pointed to by Buffer. The function\r | |
3344 | guarantees that the read operation does not produce 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 24-bit value that may be unaligned.\r |
ac644614 | 3349 | \r |
5385a579 | 3350 | @return The 24-bit value read from Buffer.\r |
ac644614 | 3351 | \r |
3352 | **/\r | |
3353 | UINT32\r | |
3354 | EFIAPI\r | |
3355 | ReadUnaligned24 (\r | |
5385a579 | 3356 | IN CONST UINT32 *Buffer\r |
ac644614 | 3357 | );\r |
3358 | \r | |
3359 | \r | |
3360 | /**\r | |
3361 | Writes a 24-bit value to memory that may be unaligned.\r | |
3362 | \r | |
3363 | This function writes the 24-bit value specified by Value to Buffer. Value is\r | |
3364 | returned. The function guarantees that the write operation does not produce\r | |
3365 | an alignment fault.\r | |
3366 | \r | |
3367 | If the Buffer is NULL, then ASSERT().\r | |
3368 | \r | |
af2dc6a7 | 3369 | @param Buffer The pointer to a 24-bit value that may be unaligned.\r |
ac644614 | 3370 | @param Value 24-bit value to write to Buffer.\r |
3371 | \r | |
5385a579 | 3372 | @return The 24-bit value to write to Buffer.\r |
ac644614 | 3373 | \r |
3374 | **/\r | |
3375 | UINT32\r | |
3376 | EFIAPI\r | |
3377 | WriteUnaligned24 (\r | |
5385a579 | 3378 | OUT UINT32 *Buffer,\r |
3379 | IN UINT32 Value\r | |
ac644614 | 3380 | );\r |
3381 | \r | |
3382 | \r | |
3383 | /**\r | |
3384 | Reads a 32-bit value from memory that may be unaligned.\r | |
3385 | \r | |
3386 | This function returns the 32-bit value pointed to by Buffer. The function\r | |
3387 | guarantees that the read operation does not produce an alignment fault.\r | |
3388 | \r | |
3389 | If the Buffer is NULL, then ASSERT().\r | |
3390 | \r | |
af2dc6a7 | 3391 | @param Buffer The pointer to a 32-bit value that may be unaligned.\r |
ac644614 | 3392 | \r |
5385a579 | 3393 | @return The 32-bit value read from Buffer.\r |
ac644614 | 3394 | \r |
3395 | **/\r | |
3396 | UINT32\r | |
3397 | EFIAPI\r | |
3398 | ReadUnaligned32 (\r | |
5385a579 | 3399 | IN CONST UINT32 *Buffer\r |
ac644614 | 3400 | );\r |
3401 | \r | |
3402 | \r | |
3403 | /**\r | |
3404 | Writes a 32-bit value to memory that may be unaligned.\r | |
3405 | \r | |
3406 | This function writes the 32-bit value specified by Value to Buffer. Value is\r | |
3407 | returned. The function guarantees that the write operation does not produce\r | |
3408 | an alignment fault.\r | |
3409 | \r | |
3410 | If the Buffer is NULL, then ASSERT().\r | |
3411 | \r | |
af2dc6a7 | 3412 | @param Buffer The pointer to a 32-bit value that may be unaligned.\r |
ac644614 | 3413 | @param Value 32-bit value to write to Buffer.\r |
3414 | \r | |
5385a579 | 3415 | @return The 32-bit value to write to Buffer.\r |
ac644614 | 3416 | \r |
3417 | **/\r | |
3418 | UINT32\r | |
3419 | EFIAPI\r | |
3420 | WriteUnaligned32 (\r | |
5385a579 | 3421 | OUT UINT32 *Buffer,\r |
3422 | IN UINT32 Value\r | |
ac644614 | 3423 | );\r |
3424 | \r | |
3425 | \r | |
3426 | /**\r | |
3427 | Reads a 64-bit value from memory that may be unaligned.\r | |
3428 | \r | |
3429 | This function returns the 64-bit value pointed to by Buffer. The function\r | |
3430 | guarantees that the read operation does not produce an alignment fault.\r | |
3431 | \r | |
3432 | If the Buffer is NULL, then ASSERT().\r | |
3433 | \r | |
af2dc6a7 | 3434 | @param Buffer The pointer to a 64-bit value that may be unaligned.\r |
ac644614 | 3435 | \r |
5385a579 | 3436 | @return The 64-bit value read from Buffer.\r |
ac644614 | 3437 | \r |
3438 | **/\r | |
3439 | UINT64\r | |
3440 | EFIAPI\r | |
3441 | ReadUnaligned64 (\r | |
5385a579 | 3442 | IN CONST UINT64 *Buffer\r |
ac644614 | 3443 | );\r |
3444 | \r | |
3445 | \r | |
3446 | /**\r | |
3447 | Writes a 64-bit value to memory that may be unaligned.\r | |
3448 | \r | |
3449 | This function writes the 64-bit value specified by Value to Buffer. Value is\r | |
3450 | returned. The function guarantees that the write operation does not produce\r | |
3451 | an alignment fault.\r | |
3452 | \r | |
3453 | If the Buffer is NULL, then ASSERT().\r | |
3454 | \r | |
af2dc6a7 | 3455 | @param Buffer The pointer to a 64-bit value that may be unaligned.\r |
ac644614 | 3456 | @param Value 64-bit value to write to Buffer.\r |
3457 | \r | |
5385a579 | 3458 | @return The 64-bit value to write to Buffer.\r |
ac644614 | 3459 | \r |
3460 | **/\r | |
3461 | UINT64\r | |
3462 | EFIAPI\r | |
3463 | WriteUnaligned64 (\r | |
5385a579 | 3464 | OUT UINT64 *Buffer,\r |
3465 | IN UINT64 Value\r | |
ac644614 | 3466 | );\r |
3467 | \r | |
3468 | \r | |
3469 | //\r | |
3470 | // Bit Field Functions\r | |
3471 | //\r | |
3472 | \r | |
3473 | /**\r | |
3474 | Returns a bit field from an 8-bit value.\r | |
3475 | \r | |
3476 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
3477 | \r | |
3478 | If 8-bit operations are not supported, then ASSERT().\r | |
3479 | If StartBit is greater than 7, then ASSERT().\r | |
3480 | If EndBit is greater than 7, then ASSERT().\r | |
3481 | If EndBit is less than StartBit, then ASSERT().\r | |
3482 | \r | |
3483 | @param Operand Operand on which to perform the bitfield operation.\r | |
3484 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3485 | Range 0..7.\r | |
3486 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3487 | Range 0..7.\r | |
3488 | \r | |
3489 | @return The bit field read.\r | |
3490 | \r | |
3491 | **/\r | |
3492 | UINT8\r | |
3493 | EFIAPI\r | |
3494 | BitFieldRead8 (\r | |
3495 | IN UINT8 Operand,\r | |
3496 | IN UINTN StartBit,\r | |
3497 | IN UINTN EndBit\r | |
3498 | );\r | |
3499 | \r | |
3500 | \r | |
3501 | /**\r | |
3502 | Writes a bit field to an 8-bit value, and returns the result.\r | |
3503 | \r | |
3504 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
3505 | Operand. All other bits in Operand are preserved. The new 8-bit value is\r | |
3506 | returned.\r | |
3507 | \r | |
3508 | If 8-bit operations are not supported, then ASSERT().\r | |
3509 | If StartBit is greater than 7, then ASSERT().\r | |
3510 | If EndBit is greater than 7, then ASSERT().\r | |
3511 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3512 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3513 | \r |
3514 | @param Operand Operand on which to perform the bitfield operation.\r | |
3515 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3516 | Range 0..7.\r | |
3517 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3518 | Range 0..7.\r | |
3519 | @param Value New value of the bit field.\r | |
3520 | \r | |
3521 | @return The new 8-bit value.\r | |
3522 | \r | |
3523 | **/\r | |
3524 | UINT8\r | |
3525 | EFIAPI\r | |
3526 | BitFieldWrite8 (\r | |
3527 | IN UINT8 Operand,\r | |
3528 | IN UINTN StartBit,\r | |
3529 | IN UINTN EndBit,\r | |
3530 | IN UINT8 Value\r | |
3531 | );\r | |
3532 | \r | |
3533 | \r | |
3534 | /**\r | |
3535 | Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the\r | |
3536 | result.\r | |
3537 | \r | |
62991af2 | 3538 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 3539 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
3540 | Operand are preserved. The new 8-bit value is returned.\r | |
3541 | \r | |
3542 | If 8-bit operations are not supported, then ASSERT().\r | |
3543 | If StartBit is greater than 7, then ASSERT().\r | |
3544 | If EndBit is greater than 7, then ASSERT().\r | |
3545 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3546 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3547 | \r |
3548 | @param Operand Operand on which to perform the bitfield operation.\r | |
3549 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3550 | Range 0..7.\r | |
3551 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3552 | Range 0..7.\r | |
3553 | @param OrData The value to OR with the read value from the value\r | |
3554 | \r | |
3555 | @return The new 8-bit value.\r | |
3556 | \r | |
3557 | **/\r | |
3558 | UINT8\r | |
3559 | EFIAPI\r | |
3560 | BitFieldOr8 (\r | |
3561 | IN UINT8 Operand,\r | |
3562 | IN UINTN StartBit,\r | |
3563 | IN UINTN EndBit,\r | |
3564 | IN UINT8 OrData\r | |
3565 | );\r | |
3566 | \r | |
3567 | \r | |
3568 | /**\r | |
3569 | Reads a bit field from an 8-bit value, performs a bitwise AND, and returns\r | |
3570 | the result.\r | |
3571 | \r | |
3572 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
3573 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
3574 | preserved. The new 8-bit value is returned.\r | |
3575 | \r | |
3576 | If 8-bit operations are not supported, then ASSERT().\r | |
3577 | If StartBit is greater than 7, then ASSERT().\r | |
3578 | If EndBit is greater than 7, then ASSERT().\r | |
3579 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3580 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3581 | \r |
3582 | @param Operand Operand on which to perform the bitfield operation.\r | |
3583 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3584 | Range 0..7.\r | |
3585 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3586 | Range 0..7.\r | |
3587 | @param AndData The value to AND with the read value from the value.\r | |
3588 | \r | |
3589 | @return The new 8-bit value.\r | |
3590 | \r | |
3591 | **/\r | |
3592 | UINT8\r | |
3593 | EFIAPI\r | |
3594 | BitFieldAnd8 (\r | |
3595 | IN UINT8 Operand,\r | |
3596 | IN UINTN StartBit,\r | |
3597 | IN UINTN EndBit,\r | |
3598 | IN UINT8 AndData\r | |
3599 | );\r | |
3600 | \r | |
3601 | \r | |
3602 | /**\r | |
3603 | Reads a bit field from an 8-bit value, performs a bitwise AND followed by a\r | |
3604 | bitwise OR, and returns the result.\r | |
3605 | \r | |
3606 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 3607 | in Operand and the value specified by AndData, followed by a bitwise \r |
3608 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 3609 | preserved. The new 8-bit value is returned.\r |
3610 | \r | |
3611 | If 8-bit operations are not supported, then ASSERT().\r | |
3612 | If StartBit is greater than 7, then ASSERT().\r | |
3613 | If EndBit is greater than 7, then ASSERT().\r | |
3614 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
3615 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
3616 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 3617 | \r |
3618 | @param Operand Operand on which to perform the bitfield operation.\r | |
3619 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3620 | Range 0..7.\r | |
3621 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3622 | Range 0..7.\r | |
3623 | @param AndData The value to AND with the read value from the value.\r | |
3624 | @param OrData The value to OR with the result of the AND operation.\r | |
3625 | \r | |
3626 | @return The new 8-bit value.\r | |
3627 | \r | |
3628 | **/\r | |
3629 | UINT8\r | |
3630 | EFIAPI\r | |
3631 | BitFieldAndThenOr8 (\r | |
3632 | IN UINT8 Operand,\r | |
3633 | IN UINTN StartBit,\r | |
3634 | IN UINTN EndBit,\r | |
3635 | IN UINT8 AndData,\r | |
3636 | IN UINT8 OrData\r | |
3637 | );\r | |
3638 | \r | |
3639 | \r | |
3640 | /**\r | |
3641 | Returns a bit field from a 16-bit value.\r | |
3642 | \r | |
3643 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
3644 | \r | |
3645 | If 16-bit operations are not supported, then ASSERT().\r | |
3646 | If StartBit is greater than 15, then ASSERT().\r | |
3647 | If EndBit is greater than 15, then ASSERT().\r | |
3648 | If EndBit is less than StartBit, then ASSERT().\r | |
3649 | \r | |
3650 | @param Operand Operand on which to perform the bitfield operation.\r | |
3651 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3652 | Range 0..15.\r | |
3653 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3654 | Range 0..15.\r | |
3655 | \r | |
3656 | @return The bit field read.\r | |
3657 | \r | |
3658 | **/\r | |
3659 | UINT16\r | |
3660 | EFIAPI\r | |
3661 | BitFieldRead16 (\r | |
3662 | IN UINT16 Operand,\r | |
3663 | IN UINTN StartBit,\r | |
3664 | IN UINTN EndBit\r | |
3665 | );\r | |
3666 | \r | |
3667 | \r | |
3668 | /**\r | |
3669 | Writes a bit field to a 16-bit value, and returns the result.\r | |
3670 | \r | |
3671 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
3672 | Operand. All other bits in Operand are preserved. The new 16-bit value is\r | |
3673 | returned.\r | |
3674 | \r | |
3675 | If 16-bit operations are not supported, then ASSERT().\r | |
3676 | If StartBit is greater than 15, then ASSERT().\r | |
3677 | If EndBit is greater than 15, then ASSERT().\r | |
3678 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3679 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3680 | \r |
3681 | @param Operand Operand on which to perform the bitfield operation.\r | |
3682 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3683 | Range 0..15.\r | |
3684 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3685 | Range 0..15.\r | |
3686 | @param Value New value of the bit field.\r | |
3687 | \r | |
3688 | @return The new 16-bit value.\r | |
3689 | \r | |
3690 | **/\r | |
3691 | UINT16\r | |
3692 | EFIAPI\r | |
3693 | BitFieldWrite16 (\r | |
3694 | IN UINT16 Operand,\r | |
3695 | IN UINTN StartBit,\r | |
3696 | IN UINTN EndBit,\r | |
3697 | IN UINT16 Value\r | |
3698 | );\r | |
3699 | \r | |
3700 | \r | |
3701 | /**\r | |
3702 | Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the\r | |
3703 | result.\r | |
3704 | \r | |
62991af2 | 3705 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 3706 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
3707 | Operand are preserved. The new 16-bit value is returned.\r | |
3708 | \r | |
3709 | If 16-bit operations are not supported, then ASSERT().\r | |
3710 | If StartBit is greater than 15, then ASSERT().\r | |
3711 | If EndBit is greater than 15, then ASSERT().\r | |
3712 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3713 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3714 | \r |
3715 | @param Operand Operand on which to perform the bitfield operation.\r | |
3716 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3717 | Range 0..15.\r | |
3718 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3719 | Range 0..15.\r | |
3720 | @param OrData The value to OR with the read value from the value\r | |
3721 | \r | |
3722 | @return The new 16-bit value.\r | |
3723 | \r | |
3724 | **/\r | |
3725 | UINT16\r | |
3726 | EFIAPI\r | |
3727 | BitFieldOr16 (\r | |
3728 | IN UINT16 Operand,\r | |
3729 | IN UINTN StartBit,\r | |
3730 | IN UINTN EndBit,\r | |
3731 | IN UINT16 OrData\r | |
3732 | );\r | |
3733 | \r | |
3734 | \r | |
3735 | /**\r | |
3736 | Reads a bit field from a 16-bit value, performs a bitwise AND, and returns\r | |
3737 | the result.\r | |
3738 | \r | |
3739 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
3740 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
3741 | preserved. The new 16-bit value is returned.\r | |
3742 | \r | |
3743 | If 16-bit operations are not supported, then ASSERT().\r | |
3744 | If StartBit is greater than 15, then ASSERT().\r | |
3745 | If EndBit is greater than 15, then ASSERT().\r | |
3746 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3747 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3748 | \r |
3749 | @param Operand Operand on which to perform the bitfield operation.\r | |
3750 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3751 | Range 0..15.\r | |
3752 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3753 | Range 0..15.\r | |
3754 | @param AndData The value to AND with the read value from the value\r | |
3755 | \r | |
3756 | @return The new 16-bit value.\r | |
3757 | \r | |
3758 | **/\r | |
3759 | UINT16\r | |
3760 | EFIAPI\r | |
3761 | BitFieldAnd16 (\r | |
3762 | IN UINT16 Operand,\r | |
3763 | IN UINTN StartBit,\r | |
3764 | IN UINTN EndBit,\r | |
3765 | IN UINT16 AndData\r | |
3766 | );\r | |
3767 | \r | |
3768 | \r | |
3769 | /**\r | |
3770 | Reads a bit field from a 16-bit value, performs a bitwise AND followed by a\r | |
3771 | bitwise OR, and returns the result.\r | |
3772 | \r | |
3773 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 3774 | in Operand and the value specified by AndData, followed by a bitwise \r |
3775 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 3776 | preserved. The new 16-bit value is returned.\r |
3777 | \r | |
3778 | If 16-bit operations are not supported, then ASSERT().\r | |
3779 | If StartBit is greater than 15, then ASSERT().\r | |
3780 | If EndBit is greater than 15, then ASSERT().\r | |
3781 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
3782 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
3783 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 3784 | \r |
3785 | @param Operand Operand on which to perform the bitfield operation.\r | |
3786 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3787 | Range 0..15.\r | |
3788 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3789 | Range 0..15.\r | |
3790 | @param AndData The value to AND with the read value from the value.\r | |
3791 | @param OrData The value to OR with the result of the AND operation.\r | |
3792 | \r | |
3793 | @return The new 16-bit value.\r | |
3794 | \r | |
3795 | **/\r | |
3796 | UINT16\r | |
3797 | EFIAPI\r | |
3798 | BitFieldAndThenOr16 (\r | |
3799 | IN UINT16 Operand,\r | |
3800 | IN UINTN StartBit,\r | |
3801 | IN UINTN EndBit,\r | |
3802 | IN UINT16 AndData,\r | |
3803 | IN UINT16 OrData\r | |
3804 | );\r | |
3805 | \r | |
3806 | \r | |
3807 | /**\r | |
3808 | Returns a bit field from a 32-bit value.\r | |
3809 | \r | |
3810 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
3811 | \r | |
3812 | If 32-bit operations are not supported, then ASSERT().\r | |
3813 | If StartBit is greater than 31, then ASSERT().\r | |
3814 | If EndBit is greater than 31, then ASSERT().\r | |
3815 | If EndBit is less than StartBit, then ASSERT().\r | |
3816 | \r | |
3817 | @param Operand Operand on which to perform the bitfield operation.\r | |
3818 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3819 | Range 0..31.\r | |
3820 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3821 | Range 0..31.\r | |
3822 | \r | |
3823 | @return The bit field read.\r | |
3824 | \r | |
3825 | **/\r | |
3826 | UINT32\r | |
3827 | EFIAPI\r | |
3828 | BitFieldRead32 (\r | |
3829 | IN UINT32 Operand,\r | |
3830 | IN UINTN StartBit,\r | |
3831 | IN UINTN EndBit\r | |
3832 | );\r | |
3833 | \r | |
3834 | \r | |
3835 | /**\r | |
3836 | Writes a bit field to a 32-bit value, and returns the result.\r | |
3837 | \r | |
3838 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
3839 | Operand. All other bits in Operand are preserved. The new 32-bit value is\r | |
3840 | returned.\r | |
3841 | \r | |
3842 | If 32-bit operations are not supported, then ASSERT().\r | |
3843 | If StartBit is greater than 31, then ASSERT().\r | |
3844 | If EndBit is greater than 31, then ASSERT().\r | |
3845 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3846 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3847 | \r |
3848 | @param Operand Operand on which to perform the bitfield operation.\r | |
3849 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3850 | Range 0..31.\r | |
3851 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3852 | Range 0..31.\r | |
3853 | @param Value New value of the bit field.\r | |
3854 | \r | |
3855 | @return The new 32-bit value.\r | |
3856 | \r | |
3857 | **/\r | |
3858 | UINT32\r | |
3859 | EFIAPI\r | |
3860 | BitFieldWrite32 (\r | |
3861 | IN UINT32 Operand,\r | |
3862 | IN UINTN StartBit,\r | |
3863 | IN UINTN EndBit,\r | |
3864 | IN UINT32 Value\r | |
3865 | );\r | |
3866 | \r | |
3867 | \r | |
3868 | /**\r | |
3869 | Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the\r | |
3870 | result.\r | |
3871 | \r | |
62991af2 | 3872 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 3873 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
3874 | Operand are preserved. The new 32-bit value is returned.\r | |
3875 | \r | |
3876 | If 32-bit operations are not supported, then ASSERT().\r | |
3877 | If StartBit is greater than 31, then ASSERT().\r | |
3878 | If EndBit is greater than 31, then ASSERT().\r | |
3879 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3880 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3881 | \r |
3882 | @param Operand Operand on which to perform the bitfield operation.\r | |
3883 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3884 | Range 0..31.\r | |
3885 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3886 | Range 0..31.\r | |
af2dc6a7 | 3887 | @param OrData The value to OR with the read value from the value.\r |
ac644614 | 3888 | \r |
3889 | @return The new 32-bit value.\r | |
3890 | \r | |
3891 | **/\r | |
3892 | UINT32\r | |
3893 | EFIAPI\r | |
3894 | BitFieldOr32 (\r | |
3895 | IN UINT32 Operand,\r | |
3896 | IN UINTN StartBit,\r | |
3897 | IN UINTN EndBit,\r | |
3898 | IN UINT32 OrData\r | |
3899 | );\r | |
3900 | \r | |
3901 | \r | |
3902 | /**\r | |
3903 | Reads a bit field from a 32-bit value, performs a bitwise AND, and returns\r | |
3904 | the result.\r | |
3905 | \r | |
3906 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
3907 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
3908 | preserved. The new 32-bit value is returned.\r | |
3909 | \r | |
3910 | If 32-bit operations are not supported, then ASSERT().\r | |
3911 | If StartBit is greater than 31, then ASSERT().\r | |
3912 | If EndBit is greater than 31, then ASSERT().\r | |
3913 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 3914 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 3915 | \r |
3916 | @param Operand Operand on which to perform the bitfield operation.\r | |
3917 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3918 | Range 0..31.\r | |
3919 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3920 | Range 0..31.\r | |
3921 | @param AndData The value to AND with the read value from the value\r | |
3922 | \r | |
3923 | @return The new 32-bit value.\r | |
3924 | \r | |
3925 | **/\r | |
3926 | UINT32\r | |
3927 | EFIAPI\r | |
3928 | BitFieldAnd32 (\r | |
3929 | IN UINT32 Operand,\r | |
3930 | IN UINTN StartBit,\r | |
3931 | IN UINTN EndBit,\r | |
3932 | IN UINT32 AndData\r | |
3933 | );\r | |
3934 | \r | |
3935 | \r | |
3936 | /**\r | |
3937 | Reads a bit field from a 32-bit value, performs a bitwise AND followed by a\r | |
3938 | bitwise OR, and returns the result.\r | |
3939 | \r | |
3940 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 3941 | in Operand and the value specified by AndData, followed by a bitwise \r |
3942 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 3943 | preserved. The new 32-bit value is returned.\r |
3944 | \r | |
3945 | If 32-bit operations are not supported, then ASSERT().\r | |
3946 | If StartBit is greater than 31, then ASSERT().\r | |
3947 | If EndBit is greater than 31, then ASSERT().\r | |
3948 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
3949 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
3950 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 3951 | \r |
3952 | @param Operand Operand on which to perform the bitfield operation.\r | |
3953 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3954 | Range 0..31.\r | |
3955 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3956 | Range 0..31.\r | |
3957 | @param AndData The value to AND with the read value from the value.\r | |
3958 | @param OrData The value to OR with the result of the AND operation.\r | |
3959 | \r | |
3960 | @return The new 32-bit value.\r | |
3961 | \r | |
3962 | **/\r | |
3963 | UINT32\r | |
3964 | EFIAPI\r | |
3965 | BitFieldAndThenOr32 (\r | |
3966 | IN UINT32 Operand,\r | |
3967 | IN UINTN StartBit,\r | |
3968 | IN UINTN EndBit,\r | |
3969 | IN UINT32 AndData,\r | |
3970 | IN UINT32 OrData\r | |
3971 | );\r | |
3972 | \r | |
3973 | \r | |
3974 | /**\r | |
3975 | Returns a bit field from a 64-bit value.\r | |
3976 | \r | |
3977 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
3978 | \r | |
3979 | If 64-bit operations are not supported, then ASSERT().\r | |
3980 | If StartBit is greater than 63, then ASSERT().\r | |
3981 | If EndBit is greater than 63, then ASSERT().\r | |
3982 | If EndBit is less than StartBit, then ASSERT().\r | |
3983 | \r | |
3984 | @param Operand Operand on which to perform the bitfield operation.\r | |
3985 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
3986 | Range 0..63.\r | |
3987 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
3988 | Range 0..63.\r | |
3989 | \r | |
3990 | @return The bit field read.\r | |
3991 | \r | |
3992 | **/\r | |
3993 | UINT64\r | |
3994 | EFIAPI\r | |
3995 | BitFieldRead64 (\r | |
3996 | IN UINT64 Operand,\r | |
3997 | IN UINTN StartBit,\r | |
3998 | IN UINTN EndBit\r | |
3999 | );\r | |
4000 | \r | |
4001 | \r | |
4002 | /**\r | |
4003 | Writes a bit field to a 64-bit value, and returns the result.\r | |
4004 | \r | |
4005 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
4006 | Operand. All other bits in Operand are preserved. The new 64-bit value is\r | |
4007 | returned.\r | |
4008 | \r | |
4009 | If 64-bit operations are not supported, then ASSERT().\r | |
4010 | If StartBit is greater than 63, then ASSERT().\r | |
4011 | If EndBit is greater than 63, then ASSERT().\r | |
4012 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 4013 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 4014 | \r |
4015 | @param Operand Operand on which to perform the bitfield operation.\r | |
4016 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
4017 | Range 0..63.\r | |
4018 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
4019 | Range 0..63.\r | |
4020 | @param Value New value of the bit field.\r | |
4021 | \r | |
4022 | @return The new 64-bit value.\r | |
4023 | \r | |
4024 | **/\r | |
4025 | UINT64\r | |
4026 | EFIAPI\r | |
4027 | BitFieldWrite64 (\r | |
4028 | IN UINT64 Operand,\r | |
4029 | IN UINTN StartBit,\r | |
4030 | IN UINTN EndBit,\r | |
4031 | IN UINT64 Value\r | |
4032 | );\r | |
4033 | \r | |
4034 | \r | |
4035 | /**\r | |
4036 | Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the\r | |
4037 | result.\r | |
4038 | \r | |
62991af2 | 4039 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 4040 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
4041 | Operand are preserved. The new 64-bit value is returned.\r | |
4042 | \r | |
4043 | If 64-bit operations are not supported, then ASSERT().\r | |
4044 | If StartBit is greater than 63, then ASSERT().\r | |
4045 | If EndBit is greater than 63, then ASSERT().\r | |
4046 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 4047 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 4048 | \r |
4049 | @param Operand Operand on which to perform the bitfield operation.\r | |
4050 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
4051 | Range 0..63.\r | |
4052 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
4053 | Range 0..63.\r | |
4054 | @param OrData The value to OR with the read value from the value\r | |
4055 | \r | |
4056 | @return The new 64-bit value.\r | |
4057 | \r | |
4058 | **/\r | |
4059 | UINT64\r | |
4060 | EFIAPI\r | |
4061 | BitFieldOr64 (\r | |
4062 | IN UINT64 Operand,\r | |
4063 | IN UINTN StartBit,\r | |
4064 | IN UINTN EndBit,\r | |
4065 | IN UINT64 OrData\r | |
4066 | );\r | |
4067 | \r | |
4068 | \r | |
4069 | /**\r | |
4070 | Reads a bit field from a 64-bit value, performs a bitwise AND, and returns\r | |
4071 | the result.\r | |
4072 | \r | |
4073 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
4074 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
4075 | preserved. The new 64-bit value is returned.\r | |
4076 | \r | |
4077 | If 64-bit operations are not supported, then ASSERT().\r | |
4078 | If StartBit is greater than 63, then ASSERT().\r | |
4079 | If EndBit is greater than 63, then ASSERT().\r | |
4080 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 4081 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 4082 | \r |
4083 | @param Operand Operand on which to perform the bitfield operation.\r | |
4084 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
4085 | Range 0..63.\r | |
4086 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
4087 | Range 0..63.\r | |
4088 | @param AndData The value to AND with the read value from the value\r | |
4089 | \r | |
4090 | @return The new 64-bit value.\r | |
4091 | \r | |
4092 | **/\r | |
4093 | UINT64\r | |
4094 | EFIAPI\r | |
4095 | BitFieldAnd64 (\r | |
4096 | IN UINT64 Operand,\r | |
4097 | IN UINTN StartBit,\r | |
4098 | IN UINTN EndBit,\r | |
4099 | IN UINT64 AndData\r | |
4100 | );\r | |
4101 | \r | |
4102 | \r | |
4103 | /**\r | |
4104 | Reads a bit field from a 64-bit value, performs a bitwise AND followed by a\r | |
4105 | bitwise OR, and returns the result.\r | |
4106 | \r | |
4107 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 4108 | in Operand and the value specified by AndData, followed by a bitwise \r |
4109 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 4110 | preserved. The new 64-bit value is returned.\r |
4111 | \r | |
4112 | If 64-bit operations are not supported, then ASSERT().\r | |
4113 | If StartBit is greater than 63, then ASSERT().\r | |
4114 | If EndBit is greater than 63, then ASSERT().\r | |
4115 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
4116 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
4117 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 4118 | \r |
4119 | @param Operand Operand on which to perform the bitfield operation.\r | |
4120 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
4121 | Range 0..63.\r | |
4122 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
4123 | Range 0..63.\r | |
4124 | @param AndData The value to AND with the read value from the value.\r | |
4125 | @param OrData The value to OR with the result of the AND operation.\r | |
4126 | \r | |
4127 | @return The new 64-bit value.\r | |
4128 | \r | |
4129 | **/\r | |
4130 | UINT64\r | |
4131 | EFIAPI\r | |
4132 | BitFieldAndThenOr64 (\r | |
4133 | IN UINT64 Operand,\r | |
4134 | IN UINTN StartBit,\r | |
4135 | IN UINTN EndBit,\r | |
4136 | IN UINT64 AndData,\r | |
4137 | IN UINT64 OrData\r | |
4138 | );\r | |
4139 | \r | |
ac644614 | 4140 | //\r |
4141 | // Base Library Checksum Functions\r | |
4142 | //\r | |
4143 | \r | |
4144 | /**\r | |
17f695ed | 4145 | Returns the sum of all elements in a buffer in unit of UINT8.\r |
ac644614 | 4146 | During calculation, the carry bits are dropped.\r |
4147 | \r | |
4148 | This function calculates the sum of all elements in a buffer\r | |
4149 | in unit of UINT8. The carry bits in result of addition are dropped.\r | |
4150 | The result is returned as UINT8. If Length is Zero, then Zero is\r | |
4151 | returned.\r | |
4152 | \r | |
4153 | If Buffer is NULL, then ASSERT().\r | |
4154 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4155 | \r | |
af2dc6a7 | 4156 | @param Buffer The pointer to the buffer to carry out the sum operation.\r |
17f695ed | 4157 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4158 | \r |
4159 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
4160 | \r | |
4161 | **/\r | |
4162 | UINT8\r | |
4163 | EFIAPI\r | |
4164 | CalculateSum8 (\r | |
ee6c452c | 4165 | IN CONST UINT8 *Buffer,\r |
4166 | IN UINTN Length\r | |
ac644614 | 4167 | );\r |
4168 | \r | |
4169 | \r | |
4170 | /**\r | |
4171 | Returns the two's complement checksum of all elements in a buffer\r | |
4172 | of 8-bit values.\r | |
4173 | \r | |
4174 | This function first calculates the sum of the 8-bit values in the\r | |
4175 | buffer specified by Buffer and Length. The carry bits in the result\r | |
4176 | of addition are dropped. Then, the two's complement of the sum is\r | |
4177 | returned. If Length is 0, then 0 is returned.\r | |
4178 | \r | |
4179 | If Buffer is NULL, then ASSERT().\r | |
4180 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4181 | \r | |
af2dc6a7 | 4182 | @param Buffer The pointer to the buffer to carry out the checksum operation.\r |
1106ffe1 | 4183 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4184 | \r |
af2dc6a7 | 4185 | @return Checksum The two's complement checksum of Buffer.\r |
ac644614 | 4186 | \r |
4187 | **/\r | |
4188 | UINT8\r | |
4189 | EFIAPI\r | |
4190 | CalculateCheckSum8 (\r | |
ee6c452c | 4191 | IN CONST UINT8 *Buffer,\r |
4192 | IN UINTN Length\r | |
ac644614 | 4193 | );\r |
4194 | \r | |
4195 | \r | |
4196 | /**\r | |
4197 | Returns the sum of all elements in a buffer of 16-bit values. During\r | |
4198 | calculation, the carry bits are dropped.\r | |
4199 | \r | |
4200 | This function calculates the sum of the 16-bit values in the buffer\r | |
4201 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
4202 | The 16-bit result is returned. If Length is 0, then 0 is returned.\r | |
4203 | \r | |
4204 | If Buffer is NULL, then ASSERT().\r | |
4205 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
4206 | If Length is not aligned on a 16-bit boundary, then ASSERT().\r | |
4207 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4208 | \r | |
af2dc6a7 | 4209 | @param Buffer The pointer to the buffer to carry out the sum operation.\r |
1106ffe1 | 4210 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4211 | \r |
4212 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
4213 | \r | |
4214 | **/\r | |
4215 | UINT16\r | |
4216 | EFIAPI\r | |
4217 | CalculateSum16 (\r | |
ee6c452c | 4218 | IN CONST UINT16 *Buffer,\r |
4219 | IN UINTN Length\r | |
ac644614 | 4220 | );\r |
4221 | \r | |
4222 | \r | |
4223 | /**\r | |
4224 | Returns the two's complement checksum of all elements in a buffer of\r | |
4225 | 16-bit values.\r | |
4226 | \r | |
4227 | This function first calculates the sum of the 16-bit values in the buffer\r | |
4228 | specified by Buffer and Length. The carry bits in the result of addition\r | |
4229 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
4230 | is 0, then 0 is returned.\r | |
4231 | \r | |
4232 | If Buffer is NULL, then ASSERT().\r | |
4233 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
4234 | If Length is not aligned on a 16-bit boundary, then ASSERT().\r | |
4235 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4236 | \r | |
af2dc6a7 | 4237 | @param Buffer The pointer to the buffer to carry out the checksum operation.\r |
1106ffe1 | 4238 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4239 | \r |
af2dc6a7 | 4240 | @return Checksum The two's complement checksum of Buffer.\r |
ac644614 | 4241 | \r |
4242 | **/\r | |
4243 | UINT16\r | |
4244 | EFIAPI\r | |
4245 | CalculateCheckSum16 (\r | |
ee6c452c | 4246 | IN CONST UINT16 *Buffer,\r |
4247 | IN UINTN Length\r | |
ac644614 | 4248 | );\r |
4249 | \r | |
4250 | \r | |
4251 | /**\r | |
17f695ed | 4252 | Returns the sum of all elements in a buffer of 32-bit values. During\r |
ac644614 | 4253 | calculation, the carry bits are dropped.\r |
4254 | \r | |
4255 | This function calculates the sum of the 32-bit values in the buffer\r | |
4256 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
17f695ed | 4257 | The 32-bit result is returned. If Length is 0, then 0 is returned.\r |
ac644614 | 4258 | \r |
4259 | If Buffer is NULL, then ASSERT().\r | |
4260 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
4261 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
4262 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4263 | \r | |
af2dc6a7 | 4264 | @param Buffer The pointer to the buffer to carry out the sum operation.\r |
1106ffe1 | 4265 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4266 | \r |
4267 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
4268 | \r | |
4269 | **/\r | |
4270 | UINT32\r | |
4271 | EFIAPI\r | |
4272 | CalculateSum32 (\r | |
ee6c452c | 4273 | IN CONST UINT32 *Buffer,\r |
4274 | IN UINTN Length\r | |
ac644614 | 4275 | );\r |
4276 | \r | |
4277 | \r | |
4278 | /**\r | |
4279 | Returns the two's complement checksum of all elements in a buffer of\r | |
4280 | 32-bit values.\r | |
4281 | \r | |
4282 | This function first calculates the sum of the 32-bit values in the buffer\r | |
4283 | specified by Buffer and Length. The carry bits in the result of addition\r | |
4284 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
4285 | is 0, then 0 is returned.\r | |
4286 | \r | |
4287 | If Buffer is NULL, then ASSERT().\r | |
4288 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
4289 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
4290 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4291 | \r | |
af2dc6a7 | 4292 | @param Buffer The pointer to the buffer to carry out the checksum operation.\r |
1106ffe1 | 4293 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4294 | \r |
af2dc6a7 | 4295 | @return Checksum The two's complement checksum of Buffer.\r |
ac644614 | 4296 | \r |
4297 | **/\r | |
4298 | UINT32\r | |
4299 | EFIAPI\r | |
4300 | CalculateCheckSum32 (\r | |
ee6c452c | 4301 | IN CONST UINT32 *Buffer,\r |
4302 | IN UINTN Length\r | |
ac644614 | 4303 | );\r |
4304 | \r | |
4305 | \r | |
4306 | /**\r | |
4307 | Returns the sum of all elements in a buffer of 64-bit values. During\r | |
4308 | calculation, the carry bits are dropped.\r | |
4309 | \r | |
4310 | This function calculates the sum of the 64-bit values in the buffer\r | |
4311 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
4312 | The 64-bit result is returned. If Length is 0, then 0 is returned.\r | |
4313 | \r | |
4314 | If Buffer is NULL, then ASSERT().\r | |
4315 | If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r | |
4316 | If Length is not aligned on a 64-bit boundary, then ASSERT().\r | |
4317 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4318 | \r | |
af2dc6a7 | 4319 | @param Buffer The pointer to the buffer to carry out the sum operation.\r |
1106ffe1 | 4320 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4321 | \r |
4322 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
4323 | \r | |
4324 | **/\r | |
4325 | UINT64\r | |
4326 | EFIAPI\r | |
4327 | CalculateSum64 (\r | |
ee6c452c | 4328 | IN CONST UINT64 *Buffer,\r |
4329 | IN UINTN Length\r | |
ac644614 | 4330 | );\r |
4331 | \r | |
4332 | \r | |
4333 | /**\r | |
4334 | Returns the two's complement checksum of all elements in a buffer of\r | |
4335 | 64-bit values.\r | |
4336 | \r | |
4337 | This function first calculates the sum of the 64-bit values in the buffer\r | |
4338 | specified by Buffer and Length. The carry bits in the result of addition\r | |
4339 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
4340 | is 0, then 0 is returned.\r | |
4341 | \r | |
4342 | If Buffer is NULL, then ASSERT().\r | |
4343 | If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r | |
4344 | If Length is not aligned on a 64-bit boundary, then ASSERT().\r | |
4345 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
4346 | \r | |
af2dc6a7 | 4347 | @param Buffer The pointer to the buffer to carry out the checksum operation.\r |
1106ffe1 | 4348 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 4349 | \r |
af2dc6a7 | 4350 | @return Checksum The two's complement checksum of Buffer.\r |
ac644614 | 4351 | \r |
4352 | **/\r | |
4353 | UINT64\r | |
4354 | EFIAPI\r | |
4355 | CalculateCheckSum64 (\r | |
ee6c452c | 4356 | IN CONST UINT64 *Buffer,\r |
4357 | IN UINTN Length\r | |
ac644614 | 4358 | );\r |
4359 | \r | |
4360 | \r | |
d75f9fc2 | 4361 | //\r |
4362 | // Base Library CPU Functions\r | |
4363 | //\r | |
4364 | \r | |
4365 | /**\r | |
4366 | Function entry point used when a stack switch is requested with SwitchStack()\r | |
4367 | \r | |
4368 | @param Context1 Context1 parameter passed into SwitchStack().\r | |
4369 | @param Context2 Context2 parameter passed into SwitchStack().\r | |
4370 | \r | |
4371 | **/\r | |
ac644614 | 4372 | typedef\r |
4373 | VOID\r | |
9810cdd8 | 4374 | (EFIAPI *SWITCH_STACK_ENTRY_POINT)(\r |
ac644614 | 4375 | IN VOID *Context1, OPTIONAL\r |
4376 | IN VOID *Context2 OPTIONAL\r | |
4377 | );\r | |
4378 | \r | |
4379 | \r | |
4380 | /**\r | |
4381 | Used to serialize load and store operations.\r | |
4382 | \r | |
4383 | All loads and stores that proceed calls to this function are guaranteed to be\r | |
4384 | globally visible when this function returns.\r | |
4385 | \r | |
4386 | **/\r | |
4387 | VOID\r | |
4388 | EFIAPI\r | |
4389 | MemoryFence (\r | |
4390 | VOID\r | |
4391 | );\r | |
4392 | \r | |
4393 | \r | |
4394 | /**\r | |
4395 | Saves the current CPU context that can be restored with a call to LongJump()\r | |
4396 | and returns 0.\r | |
4397 | \r | |
4398 | Saves the current CPU context in the buffer specified by JumpBuffer and\r | |
4399 | returns 0. The initial call to SetJump() must always return 0. Subsequent\r | |
4400 | calls to LongJump() cause a non-zero value to be returned by SetJump().\r | |
4401 | \r | |
4402 | If JumpBuffer is NULL, then ASSERT().\r | |
1a2f870c | 4403 | For Itanium processors, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r |
17f695ed | 4404 | \r |
4405 | NOTE: The structure BASE_LIBRARY_JUMP_BUFFER is CPU architecture specific.\r | |
4406 | The same structure must never be used for more than one CPU architecture context.\r | |
4407 | For example, a BASE_LIBRARY_JUMP_BUFFER allocated by an IA-32 module must never be used from an x64 module. \r | |
4408 | SetJump()/LongJump() is not currently supported for the EBC processor type. \r | |
ac644614 | 4409 | \r |
4410 | @param JumpBuffer A pointer to CPU context buffer.\r | |
4411 | \r | |
4412 | @retval 0 Indicates a return from SetJump().\r | |
4413 | \r | |
4414 | **/\r | |
4415 | UINTN\r | |
4416 | EFIAPI\r | |
4417 | SetJump (\r | |
4418 | OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r | |
4419 | );\r | |
4420 | \r | |
4421 | \r | |
4422 | /**\r | |
4423 | Restores the CPU context that was saved with SetJump().\r | |
4424 | \r | |
4425 | Restores the CPU context from the buffer specified by JumpBuffer. This\r | |
4426 | function never returns to the caller. Instead is resumes execution based on\r | |
4427 | the state of JumpBuffer.\r | |
4428 | \r | |
4429 | If JumpBuffer is NULL, then ASSERT().\r | |
1a2f870c | 4430 | For Itanium processors, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r |
ac644614 | 4431 | If Value is 0, then ASSERT().\r |
4432 | \r | |
4433 | @param JumpBuffer A pointer to CPU context buffer.\r | |
4434 | @param Value The value to return when the SetJump() context is\r | |
4435 | restored and must be non-zero.\r | |
4436 | \r | |
4437 | **/\r | |
4438 | VOID\r | |
4439 | EFIAPI\r | |
4440 | LongJump (\r | |
4441 | IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,\r | |
4442 | IN UINTN Value\r | |
4443 | );\r | |
4444 | \r | |
4445 | \r | |
4446 | /**\r | |
4447 | Enables CPU interrupts.\r | |
4448 | \r | |
ac644614 | 4449 | **/\r |
4450 | VOID\r | |
4451 | EFIAPI\r | |
4452 | EnableInterrupts (\r | |
4453 | VOID\r | |
4454 | );\r | |
4455 | \r | |
4456 | \r | |
4457 | /**\r | |
4458 | Disables CPU interrupts.\r | |
4459 | \r | |
ac644614 | 4460 | **/\r |
4461 | VOID\r | |
4462 | EFIAPI\r | |
4463 | DisableInterrupts (\r | |
4464 | VOID\r | |
4465 | );\r | |
4466 | \r | |
4467 | \r | |
4468 | /**\r | |
4469 | Disables CPU interrupts and returns the interrupt state prior to the disable\r | |
4470 | operation.\r | |
4471 | \r | |
ac644614 | 4472 | @retval TRUE CPU interrupts were enabled on entry to this call.\r |
4473 | @retval FALSE CPU interrupts were disabled on entry to this call.\r | |
4474 | \r | |
4475 | **/\r | |
4476 | BOOLEAN\r | |
4477 | EFIAPI\r | |
4478 | SaveAndDisableInterrupts (\r | |
4479 | VOID\r | |
4480 | );\r | |
4481 | \r | |
4482 | \r | |
4483 | /**\r | |
4484 | Enables CPU interrupts for the smallest window required to capture any\r | |
4485 | pending interrupts.\r | |
4486 | \r | |
ac644614 | 4487 | **/\r |
4488 | VOID\r | |
4489 | EFIAPI\r | |
4490 | EnableDisableInterrupts (\r | |
4491 | VOID\r | |
4492 | );\r | |
4493 | \r | |
4494 | \r | |
4495 | /**\r | |
4496 | Retrieves the current CPU interrupt state.\r | |
4497 | \r | |
af2dc6a7 | 4498 | Returns TRUE if interrupts are currently enabled. Otherwise\r |
38bbd3d9 | 4499 | returns FALSE.\r |
ac644614 | 4500 | \r |
4501 | @retval TRUE CPU interrupts are enabled.\r | |
4502 | @retval FALSE CPU interrupts are disabled.\r | |
4503 | \r | |
4504 | **/\r | |
4505 | BOOLEAN\r | |
4506 | EFIAPI\r | |
4507 | GetInterruptState (\r | |
4508 | VOID\r | |
4509 | );\r | |
4510 | \r | |
4511 | \r | |
4512 | /**\r | |
4513 | Set the current CPU interrupt state.\r | |
4514 | \r | |
4515 | Sets the current CPU interrupt state to the state specified by\r | |
4516 | InterruptState. If InterruptState is TRUE, then interrupts are enabled. If\r | |
4517 | InterruptState is FALSE, then interrupts are disabled. InterruptState is\r | |
4518 | returned.\r | |
4519 | \r | |
4520 | @param InterruptState TRUE if interrupts should enabled. FALSE if\r | |
4521 | interrupts should be disabled.\r | |
4522 | \r | |
4523 | @return InterruptState\r | |
4524 | \r | |
4525 | **/\r | |
4526 | BOOLEAN\r | |
4527 | EFIAPI\r | |
4528 | SetInterruptState (\r | |
4529 | IN BOOLEAN InterruptState\r | |
4530 | );\r | |
4531 | \r | |
4532 | \r | |
4533 | /**\r | |
4534 | Requests CPU to pause for a short period of time.\r | |
4535 | \r | |
4536 | Requests CPU to pause for a short period of time. Typically used in MP\r | |
4537 | systems to prevent memory starvation while waiting for a spin lock.\r | |
4538 | \r | |
4539 | **/\r | |
4540 | VOID\r | |
4541 | EFIAPI\r | |
4542 | CpuPause (\r | |
4543 | VOID\r | |
4544 | );\r | |
4545 | \r | |
4546 | \r | |
4547 | /**\r | |
4548 | Transfers control to a function starting with a new stack.\r | |
4549 | \r | |
4550 | Transfers control to the function specified by EntryPoint using the\r | |
4551 | new stack specified by NewStack and passing in the parameters specified\r | |
4552 | by Context1 and Context2. Context1 and Context2 are optional and may\r | |
4553 | be NULL. The function EntryPoint must never return. This function\r | |
4554 | supports a variable number of arguments following the NewStack parameter.\r | |
1a2f870c | 4555 | These additional arguments are ignored on IA-32, x64, and EBC architectures.\r |
4556 | Itanium processors expect one additional parameter of type VOID * that specifies\r | |
ac644614 | 4557 | the new backing store pointer.\r |
4558 | \r | |
4559 | If EntryPoint is NULL, then ASSERT().\r | |
4560 | If NewStack is NULL, then ASSERT().\r | |
4561 | \r | |
4562 | @param EntryPoint A pointer to function to call with the new stack.\r | |
4563 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
4564 | function.\r | |
4565 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
4566 | function.\r | |
4567 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
4568 | function.\r | |
af2dc6a7 | 4569 | @param ... This variable argument list is ignored for IA-32, x64, and \r |
4570 | EBC architectures. For Itanium processors, this variable \r | |
4571 | argument list is expected to contain a single parameter of \r | |
4572 | type VOID * that specifies the new backing store pointer.\r | |
42eedea9 | 4573 | \r |
ac644614 | 4574 | \r |
4575 | **/\r | |
4576 | VOID\r | |
4577 | EFIAPI\r | |
4578 | SwitchStack (\r | |
4579 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
4580 | IN VOID *Context1, OPTIONAL\r | |
4581 | IN VOID *Context2, OPTIONAL\r | |
4582 | IN VOID *NewStack,\r | |
4583 | ...\r | |
4584 | );\r | |
4585 | \r | |
4586 | \r | |
4587 | /**\r | |
4588 | Generates a breakpoint on the CPU.\r | |
4589 | \r | |
4590 | Generates a breakpoint on the CPU. The breakpoint must be implemented such\r | |
4591 | that code can resume normal execution after the breakpoint.\r | |
4592 | \r | |
4593 | **/\r | |
4594 | VOID\r | |
4595 | EFIAPI\r | |
4596 | CpuBreakpoint (\r | |
4597 | VOID\r | |
4598 | );\r | |
4599 | \r | |
4600 | \r | |
4601 | /**\r | |
4602 | Executes an infinite loop.\r | |
4603 | \r | |
4604 | Forces the CPU to execute an infinite loop. A debugger may be used to skip\r | |
4605 | past the loop and the code that follows the loop must execute properly. This\r | |
4606 | implies that the infinite loop must not cause the code that follow it to be\r | |
4607 | optimized away.\r | |
4608 | \r | |
4609 | **/\r | |
4610 | VOID\r | |
4611 | EFIAPI\r | |
4612 | CpuDeadLoop (\r | |
4613 | VOID\r | |
4614 | );\r | |
2fe241a2 | 4615 | \r |
ac644614 | 4616 | #if defined (MDE_CPU_IPF)\r |
4617 | \r | |
4618 | /**\r | |
4619 | Flush a range of cache lines in the cache coherency domain of the calling\r | |
4620 | CPU.\r | |
4621 | \r | |
cc39b88b | 4622 | Flushes the cache lines specified by Address and Length. If Address is not aligned \r |
4623 | on a cache line boundary, then entire cache line containing Address is flushed. \r | |
4624 | If Address + Length is not aligned on a cache line boundary, then the entire cache \r | |
4625 | line containing Address + Length - 1 is flushed. This function may choose to flush \r | |
4626 | the entire cache if that is more efficient than flushing the specified range. If \r | |
4627 | Length is 0, the no cache lines are flushed. Address is returned. \r | |
1a2f870c | 4628 | This function is only available on Itanium processors.\r |
ac644614 | 4629 | \r |
4630 | If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r | |
4631 | \r | |
4632 | @param Address The base address of the instruction lines to invalidate. If\r | |
4633 | the CPU is in a physical addressing mode, then Address is a\r | |
4634 | physical address. If the CPU is in a virtual addressing mode,\r | |
4635 | then Address is a virtual address.\r | |
4636 | \r | |
4637 | @param Length The number of bytes to invalidate from the instruction cache.\r | |
4638 | \r | |
cc39b88b | 4639 | @return Address.\r |
ac644614 | 4640 | \r |
4641 | **/\r | |
4642 | VOID *\r | |
4643 | EFIAPI\r | |
cc39b88b | 4644 | AsmFlushCacheRange (\r |
ac644614 | 4645 | IN VOID *Address,\r |
4646 | IN UINTN Length\r | |
4647 | );\r | |
4648 | \r | |
4649 | \r | |
4650 | /**\r | |
af2dc6a7 | 4651 | Executes an FC instruction.\r |
4652 | Executes an FC instruction on the cache line specified by Address.\r | |
ac644614 | 4653 | The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).\r |
1a2f870c | 4654 | An implementation may flush a larger region. This function is only available on Itanium processors.\r |
ac644614 | 4655 | \r |
ee6c452c | 4656 | @param Address The Address of cache line to be flushed.\r |
ac644614 | 4657 | \r |
4658 | @return The address of FC instruction executed.\r | |
4659 | \r | |
4660 | **/\r | |
4661 | UINT64\r | |
4662 | EFIAPI\r | |
4663 | AsmFc (\r | |
4664 | IN UINT64 Address\r | |
4665 | );\r | |
4666 | \r | |
4667 | \r | |
4668 | /**\r | |
af2dc6a7 | 4669 | Executes an FC.I instruction.\r |
4670 | Executes an FC.I instruction on the cache line specified by Address.\r | |
ac644614 | 4671 | The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).\r |
1a2f870c | 4672 | An implementation may flush a larger region. This function is only available on Itanium processors.\r |
ac644614 | 4673 | \r |
ee6c452c | 4674 | @param Address The Address of cache line to be flushed.\r |
ac644614 | 4675 | \r |
af2dc6a7 | 4676 | @return The address of the FC.I instruction executed.\r |
ac644614 | 4677 | \r |
4678 | **/\r | |
4679 | UINT64\r | |
4680 | EFIAPI\r | |
4681 | AsmFci (\r | |
4682 | IN UINT64 Address\r | |
4683 | );\r | |
4684 | \r | |
4685 | \r | |
4686 | /**\r | |
4687 | Reads the current value of a Processor Identifier Register (CPUID).\r | |
17f695ed | 4688 | \r |
4689 | Reads and returns the current value of Processor Identifier Register specified by Index. \r | |
ac644614 | 4690 | The Index of largest implemented CPUID (One less than the number of implemented CPUID\r |
4691 | registers) is determined by CPUID [3] bits {7:0}.\r | |
4692 | No parameter checking is performed on Index. If the Index value is beyond the\r | |
4693 | implemented CPUID register range, a Reserved Register/Field fault may occur. The caller\r | |
4694 | must either guarantee that Index is valid, or the caller must set up fault handlers to\r | |
1a2f870c | 4695 | catch the faults. This function is only available on Itanium processors.\r |
ac644614 | 4696 | \r |
ee6c452c | 4697 | @param Index The 8-bit Processor Identifier Register index to read.\r |
ac644614 | 4698 | \r |
4699 | @return The current value of Processor Identifier Register specified by Index.\r | |
4700 | \r | |
4701 | **/\r | |
4702 | UINT64\r | |
4703 | EFIAPI\r | |
4704 | AsmReadCpuid (\r | |
4705 | IN UINT8 Index\r | |
4706 | );\r | |
4707 | \r | |
4708 | \r | |
4709 | /**\r | |
4710 | Reads the current value of 64-bit Processor Status Register (PSR).\r | |
1a2f870c | 4711 | This function is only available on Itanium processors.\r |
ac644614 | 4712 | \r |
4713 | @return The current value of PSR.\r | |
4714 | \r | |
4715 | **/\r | |
4716 | UINT64\r | |
4717 | EFIAPI\r | |
4718 | AsmReadPsr (\r | |
4719 | VOID\r | |
4720 | );\r | |
4721 | \r | |
4722 | \r | |
4723 | /**\r | |
4724 | Writes the current value of 64-bit Processor Status Register (PSR).\r | |
22388319 | 4725 | \r |
ac644614 | 4726 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
22388319 | 4727 | reserved fields of PSR must be 0 or a Reserved Register/Field fault may occur.\r |
4728 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
1a2f870c | 4729 | fault handlers to catch the faults. This function is only available on Itanium processors.\r |
ac644614 | 4730 | \r |
ee6c452c | 4731 | @param Value The 64-bit value to write to PSR.\r |
ac644614 | 4732 | \r |
4733 | @return The 64-bit value written to the PSR.\r | |
4734 | \r | |
4735 | **/\r | |
4736 | UINT64\r | |
4737 | EFIAPI\r | |
4738 | AsmWritePsr (\r | |
4739 | IN UINT64 Value\r | |
4740 | );\r | |
4741 | \r | |
4742 | \r | |
4743 | /**\r | |
4744 | Reads the current value of 64-bit Kernel Register #0 (KR0).\r | |
2fe241a2 | 4745 | \r |
4746 | Reads and returns the current value of KR0. \r | |
1a2f870c | 4747 | This function is only available on Itanium processors.\r |
ac644614 | 4748 | \r |
4749 | @return The current value of KR0.\r | |
4750 | \r | |
4751 | **/\r | |
4752 | UINT64\r | |
4753 | EFIAPI\r | |
4754 | AsmReadKr0 (\r | |
4755 | VOID\r | |
4756 | );\r | |
4757 | \r | |
4758 | \r | |
4759 | /**\r | |
4760 | Reads the current value of 64-bit Kernel Register #1 (KR1).\r | |
2fe241a2 | 4761 | \r |
4762 | Reads and returns the current value of KR1. \r | |
1a2f870c | 4763 | This function is only available on Itanium processors.\r |
ac644614 | 4764 | \r |
4765 | @return The current value of KR1.\r | |
4766 | \r | |
4767 | **/\r | |
4768 | UINT64\r | |
4769 | EFIAPI\r | |
4770 | AsmReadKr1 (\r | |
4771 | VOID\r | |
4772 | );\r | |
4773 | \r | |
4774 | \r | |
4775 | /**\r | |
4776 | Reads the current value of 64-bit Kernel Register #2 (KR2).\r | |
2fe241a2 | 4777 | \r |
4778 | Reads and returns the current value of KR2. \r | |
1a2f870c | 4779 | This function is only available on Itanium processors.\r |
ac644614 | 4780 | \r |
4781 | @return The current value of KR2.\r | |
4782 | \r | |
4783 | **/\r | |
4784 | UINT64\r | |
4785 | EFIAPI\r | |
4786 | AsmReadKr2 (\r | |
4787 | VOID\r | |
4788 | );\r | |
4789 | \r | |
4790 | \r | |
4791 | /**\r | |
4792 | Reads the current value of 64-bit Kernel Register #3 (KR3).\r | |
2fe241a2 | 4793 | \r |
4794 | Reads and returns the current value of KR3. \r | |
1a2f870c | 4795 | This function is only available on Itanium processors.\r |
ac644614 | 4796 | \r |
4797 | @return The current value of KR3.\r | |
4798 | \r | |
4799 | **/\r | |
4800 | UINT64\r | |
4801 | EFIAPI\r | |
4802 | AsmReadKr3 (\r | |
4803 | VOID\r | |
4804 | );\r | |
4805 | \r | |
4806 | \r | |
4807 | /**\r | |
4808 | Reads the current value of 64-bit Kernel Register #4 (KR4).\r | |
ac644614 | 4809 | \r |
2fe241a2 | 4810 | Reads and returns the current value of KR4. \r |
1a2f870c | 4811 | This function is only available on Itanium processors.\r |
2fe241a2 | 4812 | \r |
ac644614 | 4813 | @return The current value of KR4.\r |
4814 | \r | |
4815 | **/\r | |
4816 | UINT64\r | |
4817 | EFIAPI\r | |
4818 | AsmReadKr4 (\r | |
4819 | VOID\r | |
4820 | );\r | |
4821 | \r | |
4822 | \r | |
4823 | /**\r | |
4824 | Reads the current value of 64-bit Kernel Register #5 (KR5).\r | |
2fe241a2 | 4825 | \r |
4826 | Reads and returns the current value of KR5. \r | |
1a2f870c | 4827 | This function is only available on Itanium processors.\r |
ac644614 | 4828 | \r |
4829 | @return The current value of KR5.\r | |
4830 | \r | |
4831 | **/\r | |
4832 | UINT64\r | |
4833 | EFIAPI\r | |
4834 | AsmReadKr5 (\r | |
4835 | VOID\r | |
4836 | );\r | |
4837 | \r | |
4838 | \r | |
4839 | /**\r | |
4840 | Reads the current value of 64-bit Kernel Register #6 (KR6).\r | |
2fe241a2 | 4841 | \r |
4842 | Reads and returns the current value of KR6. \r | |
1a2f870c | 4843 | This function is only available on Itanium processors.\r |
ac644614 | 4844 | \r |
4845 | @return The current value of KR6.\r | |
4846 | \r | |
4847 | **/\r | |
4848 | UINT64\r | |
4849 | EFIAPI\r | |
4850 | AsmReadKr6 (\r | |
4851 | VOID\r | |
4852 | );\r | |
4853 | \r | |
4854 | \r | |
4855 | /**\r | |
4856 | Reads the current value of 64-bit Kernel Register #7 (KR7).\r | |
2fe241a2 | 4857 | \r |
4858 | Reads and returns the current value of KR7. \r | |
1a2f870c | 4859 | This function is only available on Itanium processors.\r |
ac644614 | 4860 | \r |
4861 | @return The current value of KR7.\r | |
4862 | \r | |
4863 | **/\r | |
4864 | UINT64\r | |
4865 | EFIAPI\r | |
4866 | AsmReadKr7 (\r | |
4867 | VOID\r | |
4868 | );\r | |
4869 | \r | |
4870 | \r | |
4871 | /**\r | |
4872 | Write the current value of 64-bit Kernel Register #0 (KR0).\r | |
2fe241a2 | 4873 | \r |
4874 | Writes the current value of KR0. The 64-bit value written to \r | |
1a2f870c | 4875 | the KR0 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4876 | \r |
ee6c452c | 4877 | @param Value The 64-bit value to write to KR0.\r |
ac644614 | 4878 | \r |
4879 | @return The 64-bit value written to the KR0.\r | |
4880 | \r | |
4881 | **/\r | |
4882 | UINT64\r | |
4883 | EFIAPI\r | |
4884 | AsmWriteKr0 (\r | |
4885 | IN UINT64 Value\r | |
4886 | );\r | |
4887 | \r | |
4888 | \r | |
4889 | /**\r | |
4890 | Write the current value of 64-bit Kernel Register #1 (KR1).\r | |
2fe241a2 | 4891 | \r |
4892 | Writes the current value of KR1. The 64-bit value written to \r | |
1a2f870c | 4893 | the KR1 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4894 | \r |
ee6c452c | 4895 | @param Value The 64-bit value to write to KR1.\r |
ac644614 | 4896 | \r |
4897 | @return The 64-bit value written to the KR1.\r | |
4898 | \r | |
4899 | **/\r | |
4900 | UINT64\r | |
4901 | EFIAPI\r | |
4902 | AsmWriteKr1 (\r | |
4903 | IN UINT64 Value\r | |
4904 | );\r | |
4905 | \r | |
4906 | \r | |
4907 | /**\r | |
4908 | Write the current value of 64-bit Kernel Register #2 (KR2).\r | |
2fe241a2 | 4909 | \r |
4910 | Writes the current value of KR2. The 64-bit value written to \r | |
1a2f870c | 4911 | the KR2 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4912 | \r |
ee6c452c | 4913 | @param Value The 64-bit value to write to KR2.\r |
ac644614 | 4914 | \r |
4915 | @return The 64-bit value written to the KR2.\r | |
4916 | \r | |
4917 | **/\r | |
4918 | UINT64\r | |
4919 | EFIAPI\r | |
4920 | AsmWriteKr2 (\r | |
4921 | IN UINT64 Value\r | |
4922 | );\r | |
4923 | \r | |
4924 | \r | |
4925 | /**\r | |
4926 | Write the current value of 64-bit Kernel Register #3 (KR3).\r | |
2fe241a2 | 4927 | \r |
4928 | Writes the current value of KR3. The 64-bit value written to \r | |
1a2f870c | 4929 | the KR3 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4930 | \r |
ee6c452c | 4931 | @param Value The 64-bit value to write to KR3.\r |
ac644614 | 4932 | \r |
4933 | @return The 64-bit value written to the KR3.\r | |
4934 | \r | |
4935 | **/\r | |
4936 | UINT64\r | |
4937 | EFIAPI\r | |
4938 | AsmWriteKr3 (\r | |
4939 | IN UINT64 Value\r | |
4940 | );\r | |
4941 | \r | |
4942 | \r | |
4943 | /**\r | |
4944 | Write the current value of 64-bit Kernel Register #4 (KR4).\r | |
2fe241a2 | 4945 | \r |
4946 | Writes the current value of KR4. The 64-bit value written to \r | |
1a2f870c | 4947 | the KR4 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4948 | \r |
ee6c452c | 4949 | @param Value The 64-bit value to write to KR4.\r |
ac644614 | 4950 | \r |
4951 | @return The 64-bit value written to the KR4.\r | |
4952 | \r | |
4953 | **/\r | |
4954 | UINT64\r | |
4955 | EFIAPI\r | |
4956 | AsmWriteKr4 (\r | |
4957 | IN UINT64 Value\r | |
4958 | );\r | |
4959 | \r | |
4960 | \r | |
4961 | /**\r | |
4962 | Write the current value of 64-bit Kernel Register #5 (KR5).\r | |
2fe241a2 | 4963 | \r |
4964 | Writes the current value of KR5. The 64-bit value written to \r | |
1a2f870c | 4965 | the KR5 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4966 | \r |
ee6c452c | 4967 | @param Value The 64-bit value to write to KR5.\r |
ac644614 | 4968 | \r |
4969 | @return The 64-bit value written to the KR5.\r | |
4970 | \r | |
4971 | **/\r | |
4972 | UINT64\r | |
4973 | EFIAPI\r | |
4974 | AsmWriteKr5 (\r | |
4975 | IN UINT64 Value\r | |
4976 | );\r | |
4977 | \r | |
4978 | \r | |
4979 | /**\r | |
4980 | Write the current value of 64-bit Kernel Register #6 (KR6).\r | |
2fe241a2 | 4981 | \r |
4982 | Writes the current value of KR6. The 64-bit value written to \r | |
1a2f870c | 4983 | the KR6 is returned. This function is only available on Itanium processors.\r |
ac644614 | 4984 | \r |
ee6c452c | 4985 | @param Value The 64-bit value to write to KR6.\r |
ac644614 | 4986 | \r |
4987 | @return The 64-bit value written to the KR6.\r | |
4988 | \r | |
4989 | **/\r | |
4990 | UINT64\r | |
4991 | EFIAPI\r | |
4992 | AsmWriteKr6 (\r | |
4993 | IN UINT64 Value\r | |
4994 | );\r | |
4995 | \r | |
4996 | \r | |
4997 | /**\r | |
4998 | Write the current value of 64-bit Kernel Register #7 (KR7).\r | |
2fe241a2 | 4999 | \r |
5000 | Writes the current value of KR7. The 64-bit value written to \r | |
1a2f870c | 5001 | the KR7 is returned. This function is only available on Itanium processors.\r |
ac644614 | 5002 | \r |
ee6c452c | 5003 | @param Value The 64-bit value to write to KR7.\r |
ac644614 | 5004 | \r |
5005 | @return The 64-bit value written to the KR7.\r | |
5006 | \r | |
5007 | **/\r | |
5008 | UINT64\r | |
5009 | EFIAPI\r | |
5010 | AsmWriteKr7 (\r | |
5011 | IN UINT64 Value\r | |
5012 | );\r | |
5013 | \r | |
5014 | \r | |
5015 | /**\r | |
5016 | Reads the current value of Interval Timer Counter Register (ITC).\r | |
2fe241a2 | 5017 | \r |
5018 | Reads and returns the current value of ITC.\r | |
1a2f870c | 5019 | This function is only available on Itanium processors.\r |
ac644614 | 5020 | \r |
5021 | @return The current value of ITC.\r | |
5022 | \r | |
5023 | **/\r | |
5024 | UINT64\r | |
5025 | EFIAPI\r | |
5026 | AsmReadItc (\r | |
5027 | VOID\r | |
5028 | );\r | |
5029 | \r | |
5030 | \r | |
5031 | /**\r | |
5032 | Reads the current value of Interval Timer Vector Register (ITV).\r | |
2fe241a2 | 5033 | \r |
5034 | Reads and returns the current value of ITV. \r | |
1a2f870c | 5035 | This function is only available on Itanium processors.\r |
ac644614 | 5036 | \r |
5037 | @return The current value of ITV.\r | |
5038 | \r | |
5039 | **/\r | |
5040 | UINT64\r | |
5041 | EFIAPI\r | |
5042 | AsmReadItv (\r | |
5043 | VOID\r | |
5044 | );\r | |
5045 | \r | |
5046 | \r | |
5047 | /**\r | |
5048 | Reads the current value of Interval Timer Match Register (ITM).\r | |
2fe241a2 | 5049 | \r |
5050 | Reads and returns the current value of ITM.\r | |
1a2f870c | 5051 | This function is only available on Itanium processors.\r |
ac644614 | 5052 | \r |
5053 | @return The current value of ITM.\r | |
5054 | **/\r | |
5055 | UINT64\r | |
5056 | EFIAPI\r | |
5057 | AsmReadItm (\r | |
5058 | VOID\r | |
5059 | );\r | |
5060 | \r | |
5061 | \r | |
5062 | /**\r | |
5063 | Writes the current value of 64-bit Interval Timer Counter Register (ITC).\r | |
2fe241a2 | 5064 | \r |
5065 | Writes the current value of ITC. The 64-bit value written to the ITC is returned. \r | |
1a2f870c | 5066 | This function is only available on Itanium processors.\r |
ac644614 | 5067 | \r |
ee6c452c | 5068 | @param Value The 64-bit value to write to ITC.\r |
ac644614 | 5069 | \r |
5070 | @return The 64-bit value written to the ITC.\r | |
5071 | \r | |
5072 | **/\r | |
5073 | UINT64\r | |
5074 | EFIAPI\r | |
5075 | AsmWriteItc (\r | |
5076 | IN UINT64 Value\r | |
5077 | );\r | |
5078 | \r | |
5079 | \r | |
5080 | /**\r | |
5081 | Writes the current value of 64-bit Interval Timer Match Register (ITM).\r | |
2fe241a2 | 5082 | \r |
5083 | Writes the current value of ITM. The 64-bit value written to the ITM is returned. \r | |
1a2f870c | 5084 | This function is only available on Itanium processors.\r |
ac644614 | 5085 | \r |
ee6c452c | 5086 | @param Value The 64-bit value to write to ITM.\r |
ac644614 | 5087 | \r |
5088 | @return The 64-bit value written to the ITM.\r | |
5089 | \r | |
5090 | **/\r | |
5091 | UINT64\r | |
5092 | EFIAPI\r | |
5093 | AsmWriteItm (\r | |
5094 | IN UINT64 Value\r | |
5095 | );\r | |
5096 | \r | |
5097 | \r | |
5098 | /**\r | |
5099 | Writes the current value of 64-bit Interval Timer Vector Register (ITV).\r | |
2fe241a2 | 5100 | \r |
5101 | Writes the current value of ITV. The 64-bit value written to the ITV is returned. \r | |
ac644614 | 5102 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5103 | reserved fields of ITV must be 0 or a Reserved Register/Field fault may occur.\r | |
5104 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5105 | fault handlers to catch the faults.\r | |
1a2f870c | 5106 | This function is only available on Itanium processors.\r |
ac644614 | 5107 | \r |
ee6c452c | 5108 | @param Value The 64-bit value to write to ITV.\r |
ac644614 | 5109 | \r |
5110 | @return The 64-bit value written to the ITV.\r | |
5111 | \r | |
5112 | **/\r | |
5113 | UINT64\r | |
5114 | EFIAPI\r | |
5115 | AsmWriteItv (\r | |
5116 | IN UINT64 Value\r | |
5117 | );\r | |
5118 | \r | |
5119 | \r | |
5120 | /**\r | |
5121 | Reads the current value of Default Control Register (DCR).\r | |
2fe241a2 | 5122 | \r |
1a2f870c | 5123 | Reads and returns the current value of DCR. This function is only available on Itanium processors.\r |
ac644614 | 5124 | \r |
5125 | @return The current value of DCR.\r | |
5126 | \r | |
5127 | **/\r | |
5128 | UINT64\r | |
5129 | EFIAPI\r | |
5130 | AsmReadDcr (\r | |
5131 | VOID\r | |
5132 | );\r | |
5133 | \r | |
5134 | \r | |
5135 | /**\r | |
5136 | Reads the current value of Interruption Vector Address Register (IVA).\r | |
2fe241a2 | 5137 | \r |
1a2f870c | 5138 | Reads and returns the current value of IVA. This function is only available on Itanium processors.\r |
ac644614 | 5139 | \r |
5140 | @return The current value of IVA.\r | |
5141 | **/\r | |
5142 | UINT64\r | |
5143 | EFIAPI\r | |
5144 | AsmReadIva (\r | |
5145 | VOID\r | |
5146 | );\r | |
5147 | \r | |
5148 | \r | |
5149 | /**\r | |
5150 | Reads the current value of Page Table Address Register (PTA).\r | |
2fe241a2 | 5151 | \r |
1a2f870c | 5152 | Reads and returns the current value of PTA. This function is only available on Itanium processors.\r |
ac644614 | 5153 | \r |
5154 | @return The current value of PTA.\r | |
5155 | \r | |
5156 | **/\r | |
5157 | UINT64\r | |
5158 | EFIAPI\r | |
5159 | AsmReadPta (\r | |
5160 | VOID\r | |
5161 | );\r | |
5162 | \r | |
5163 | \r | |
5164 | /**\r | |
5165 | Writes the current value of 64-bit Default Control Register (DCR).\r | |
2fe241a2 | 5166 | \r |
5167 | Writes the current value of DCR. The 64-bit value written to the DCR is returned. \r | |
ac644614 | 5168 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5169 | reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.\r | |
5170 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5171 | fault handlers to catch the faults.\r | |
1a2f870c | 5172 | This function is only available on Itanium processors.\r |
ac644614 | 5173 | \r |
ee6c452c | 5174 | @param Value The 64-bit value to write to DCR.\r |
ac644614 | 5175 | \r |
5176 | @return The 64-bit value written to the DCR.\r | |
5177 | \r | |
5178 | **/\r | |
5179 | UINT64\r | |
5180 | EFIAPI\r | |
5181 | AsmWriteDcr (\r | |
5182 | IN UINT64 Value\r | |
5183 | );\r | |
5184 | \r | |
5185 | \r | |
5186 | /**\r | |
5187 | Writes the current value of 64-bit Interruption Vector Address Register (IVA).\r | |
2fe241a2 | 5188 | \r |
5189 | Writes the current value of IVA. The 64-bit value written to the IVA is returned. \r | |
ac644614 | 5190 | The size of vector table is 32 K bytes and is 32 K bytes aligned\r |
5191 | the low 15 bits of Value is ignored when written.\r | |
1a2f870c | 5192 | This function is only available on Itanium processors.\r |
ac644614 | 5193 | \r |
ee6c452c | 5194 | @param Value The 64-bit value to write to IVA.\r |
ac644614 | 5195 | \r |
5196 | @return The 64-bit value written to the IVA.\r | |
5197 | \r | |
5198 | **/\r | |
5199 | UINT64\r | |
5200 | EFIAPI\r | |
5201 | AsmWriteIva (\r | |
5202 | IN UINT64 Value\r | |
5203 | );\r | |
5204 | \r | |
5205 | \r | |
5206 | /**\r | |
5207 | Writes the current value of 64-bit Page Table Address Register (PTA).\r | |
2fe241a2 | 5208 | \r |
5209 | Writes the current value of PTA. The 64-bit value written to the PTA is returned. \r | |
ac644614 | 5210 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5211 | reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.\r | |
5212 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5213 | fault handlers to catch the faults.\r | |
1a2f870c | 5214 | This function is only available on Itanium processors.\r |
ac644614 | 5215 | \r |
ee6c452c | 5216 | @param Value The 64-bit value to write to PTA.\r |
ac644614 | 5217 | \r |
5218 | @return The 64-bit value written to the PTA.\r | |
5219 | **/\r | |
5220 | UINT64\r | |
5221 | EFIAPI\r | |
5222 | AsmWritePta (\r | |
5223 | IN UINT64 Value\r | |
5224 | );\r | |
5225 | \r | |
5226 | \r | |
5227 | /**\r | |
5228 | Reads the current value of Local Interrupt ID Register (LID).\r | |
2fe241a2 | 5229 | \r |
1a2f870c | 5230 | Reads and returns the current value of LID. This function is only available on Itanium processors.\r |
ac644614 | 5231 | \r |
5232 | @return The current value of LID.\r | |
5233 | \r | |
5234 | **/\r | |
5235 | UINT64\r | |
5236 | EFIAPI\r | |
5237 | AsmReadLid (\r | |
5238 | VOID\r | |
5239 | );\r | |
5240 | \r | |
5241 | \r | |
5242 | /**\r | |
5243 | Reads the current value of External Interrupt Vector Register (IVR).\r | |
2fe241a2 | 5244 | \r |
1a2f870c | 5245 | Reads and returns the current value of IVR. This function is only available on Itanium processors. \r |
ac644614 | 5246 | \r |
5247 | @return The current value of IVR.\r | |
5248 | \r | |
5249 | **/\r | |
5250 | UINT64\r | |
5251 | EFIAPI\r | |
5252 | AsmReadIvr (\r | |
5253 | VOID\r | |
5254 | );\r | |
5255 | \r | |
5256 | \r | |
5257 | /**\r | |
5258 | Reads the current value of Task Priority Register (TPR).\r | |
2fe241a2 | 5259 | \r |
1a2f870c | 5260 | Reads and returns the current value of TPR. This function is only available on Itanium processors. \r |
ac644614 | 5261 | \r |
5262 | @return The current value of TPR.\r | |
5263 | \r | |
5264 | **/\r | |
5265 | UINT64\r | |
5266 | EFIAPI\r | |
5267 | AsmReadTpr (\r | |
5268 | VOID\r | |
5269 | );\r | |
5270 | \r | |
5271 | \r | |
5272 | /**\r | |
5273 | Reads the current value of External Interrupt Request Register #0 (IRR0).\r | |
2fe241a2 | 5274 | \r |
1a2f870c | 5275 | Reads and returns the current value of IRR0. This function is only available on Itanium processors. \r |
ac644614 | 5276 | \r |
5277 | @return The current value of IRR0.\r | |
5278 | \r | |
5279 | **/\r | |
5280 | UINT64\r | |
5281 | EFIAPI\r | |
5282 | AsmReadIrr0 (\r | |
5283 | VOID\r | |
5284 | );\r | |
5285 | \r | |
5286 | \r | |
5287 | /**\r | |
5288 | Reads the current value of External Interrupt Request Register #1 (IRR1).\r | |
2fe241a2 | 5289 | \r |
1a2f870c | 5290 | Reads and returns the current value of IRR1. This function is only available on Itanium processors. \r |
ac644614 | 5291 | \r |
5292 | @return The current value of IRR1.\r | |
5293 | \r | |
5294 | **/\r | |
5295 | UINT64\r | |
5296 | EFIAPI\r | |
5297 | AsmReadIrr1 (\r | |
5298 | VOID\r | |
5299 | );\r | |
5300 | \r | |
5301 | \r | |
5302 | /**\r | |
5303 | Reads the current value of External Interrupt Request Register #2 (IRR2).\r | |
2fe241a2 | 5304 | \r |
1a2f870c | 5305 | Reads and returns the current value of IRR2. This function is only available on Itanium processors.\r |
ac644614 | 5306 | \r |
5307 | @return The current value of IRR2.\r | |
5308 | \r | |
5309 | **/\r | |
5310 | UINT64\r | |
5311 | EFIAPI\r | |
5312 | AsmReadIrr2 (\r | |
5313 | VOID\r | |
5314 | );\r | |
5315 | \r | |
5316 | \r | |
5317 | /**\r | |
5318 | Reads the current value of External Interrupt Request Register #3 (IRR3).\r | |
2fe241a2 | 5319 | \r |
1a2f870c | 5320 | Reads and returns the current value of IRR3. This function is only available on Itanium processors. \r |
ac644614 | 5321 | \r |
5322 | @return The current value of IRR3.\r | |
5323 | \r | |
5324 | **/\r | |
5325 | UINT64\r | |
5326 | EFIAPI\r | |
5327 | AsmReadIrr3 (\r | |
5328 | VOID\r | |
5329 | );\r | |
5330 | \r | |
5331 | \r | |
5332 | /**\r | |
5333 | Reads the current value of Performance Monitor Vector Register (PMV).\r | |
2fe241a2 | 5334 | \r |
1a2f870c | 5335 | Reads and returns the current value of PMV. This function is only available on Itanium processors. \r |
ac644614 | 5336 | \r |
5337 | @return The current value of PMV.\r | |
5338 | \r | |
5339 | **/\r | |
5340 | UINT64\r | |
5341 | EFIAPI\r | |
5342 | AsmReadPmv (\r | |
5343 | VOID\r | |
5344 | );\r | |
5345 | \r | |
5346 | \r | |
5347 | /**\r | |
5348 | Reads the current value of Corrected Machine Check Vector Register (CMCV).\r | |
2fe241a2 | 5349 | \r |
1a2f870c | 5350 | Reads and returns the current value of CMCV. This function is only available on Itanium processors.\r |
ac644614 | 5351 | \r |
5352 | @return The current value of CMCV.\r | |
5353 | \r | |
5354 | **/\r | |
5355 | UINT64\r | |
5356 | EFIAPI\r | |
5357 | AsmReadCmcv (\r | |
5358 | VOID\r | |
5359 | );\r | |
5360 | \r | |
5361 | \r | |
5362 | /**\r | |
5363 | Reads the current value of Local Redirection Register #0 (LRR0).\r | |
2fe241a2 | 5364 | \r |
1a2f870c | 5365 | Reads and returns the current value of LRR0. This function is only available on Itanium processors. \r |
ac644614 | 5366 | \r |
5367 | @return The current value of LRR0.\r | |
5368 | \r | |
5369 | **/\r | |
5370 | UINT64\r | |
5371 | EFIAPI\r | |
5372 | AsmReadLrr0 (\r | |
5373 | VOID\r | |
5374 | );\r | |
5375 | \r | |
5376 | \r | |
5377 | /**\r | |
5378 | Reads the current value of Local Redirection Register #1 (LRR1).\r | |
2fe241a2 | 5379 | \r |
1a2f870c | 5380 | Reads and returns the current value of LRR1. This function is only available on Itanium processors.\r |
ac644614 | 5381 | \r |
5382 | @return The current value of LRR1.\r | |
5383 | \r | |
5384 | **/\r | |
5385 | UINT64\r | |
5386 | EFIAPI\r | |
5387 | AsmReadLrr1 (\r | |
5388 | VOID\r | |
5389 | );\r | |
5390 | \r | |
5391 | \r | |
5392 | /**\r | |
5393 | Writes the current value of 64-bit Page Local Interrupt ID Register (LID).\r | |
2fe241a2 | 5394 | \r |
5395 | Writes the current value of LID. The 64-bit value written to the LID is returned. \r | |
ac644614 | 5396 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5397 | reserved fields of LID must be 0 or a Reserved Register/Field fault may occur.\r | |
5398 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5399 | fault handlers to catch the faults.\r | |
1a2f870c | 5400 | This function is only available on Itanium processors.\r |
ac644614 | 5401 | \r |
ee6c452c | 5402 | @param Value The 64-bit value to write to LID.\r |
ac644614 | 5403 | \r |
5404 | @return The 64-bit value written to the LID.\r | |
5405 | \r | |
5406 | **/\r | |
5407 | UINT64\r | |
5408 | EFIAPI\r | |
5409 | AsmWriteLid (\r | |
5410 | IN UINT64 Value\r | |
5411 | );\r | |
5412 | \r | |
5413 | \r | |
5414 | /**\r | |
5415 | Writes the current value of 64-bit Task Priority Register (TPR).\r | |
2fe241a2 | 5416 | \r |
5417 | Writes the current value of TPR. The 64-bit value written to the TPR is returned. \r | |
ac644614 | 5418 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
5419 | reserved fields of TPR must be 0 or a Reserved Register/Field fault may occur.\r | |
5420 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5421 | fault handlers to catch the faults.\r | |
1a2f870c | 5422 | This function is only available on Itanium processors.\r |
ac644614 | 5423 | \r |
ee6c452c | 5424 | @param Value The 64-bit value to write to TPR.\r |
ac644614 | 5425 | \r |
5426 | @return The 64-bit value written to the TPR.\r | |
5427 | \r | |
5428 | **/\r | |
5429 | UINT64\r | |
5430 | EFIAPI\r | |
5431 | AsmWriteTpr (\r | |
5432 | IN UINT64 Value\r | |
5433 | );\r | |
5434 | \r | |
5435 | \r | |
5436 | /**\r | |
5437 | Performs a write operation on End OF External Interrupt Register (EOI).\r | |
2fe241a2 | 5438 | \r |
1a2f870c | 5439 | Writes a value of 0 to the EOI Register. This function is only available on Itanium processors.\r |
ac644614 | 5440 | \r |
5441 | **/\r | |
5442 | VOID\r | |
5443 | EFIAPI\r | |
5444 | AsmWriteEoi (\r | |
5445 | VOID\r | |
5446 | );\r | |
5447 | \r | |
5448 | \r | |
5449 | /**\r | |
5450 | Writes the current value of 64-bit Performance Monitor Vector Register (PMV).\r | |
2fe241a2 | 5451 | \r |
5452 | Writes the current value of PMV. The 64-bit value written to the PMV is returned. \r | |
ac644614 | 5453 | No parameter checking is performed on Value. All bits of Value corresponding\r |
5454 | to reserved fields of PMV must be 0 or a Reserved Register/Field fault may occur.\r | |
5455 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5456 | fault handlers to catch the faults.\r | |
1a2f870c | 5457 | This function is only available on Itanium processors.\r |
ac644614 | 5458 | \r |
ee6c452c | 5459 | @param Value The 64-bit value to write to PMV.\r |
ac644614 | 5460 | \r |
5461 | @return The 64-bit value written to the PMV.\r | |
5462 | \r | |
5463 | **/\r | |
5464 | UINT64\r | |
5465 | EFIAPI\r | |
5466 | AsmWritePmv (\r | |
5467 | IN UINT64 Value\r | |
5468 | );\r | |
5469 | \r | |
5470 | \r | |
5471 | /**\r | |
5472 | Writes the current value of 64-bit Corrected Machine Check Vector Register (CMCV).\r | |
2fe241a2 | 5473 | \r |
5474 | Writes the current value of CMCV. The 64-bit value written to the CMCV is returned. \r | |
ac644614 | 5475 | No parameter checking is performed on Value. All bits of Value corresponding\r |
5476 | to reserved fields of CMCV must be 0 or a Reserved Register/Field fault may occur.\r | |
5477 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5478 | fault handlers to catch the faults.\r | |
1a2f870c | 5479 | This function is only available on Itanium processors.\r |
ac644614 | 5480 | \r |
ee6c452c | 5481 | @param Value The 64-bit value to write to CMCV.\r |
ac644614 | 5482 | \r |
5483 | @return The 64-bit value written to the CMCV.\r | |
5484 | \r | |
5485 | **/\r | |
5486 | UINT64\r | |
5487 | EFIAPI\r | |
5488 | AsmWriteCmcv (\r | |
5489 | IN UINT64 Value\r | |
5490 | );\r | |
5491 | \r | |
5492 | \r | |
5493 | /**\r | |
5494 | Writes the current value of 64-bit Local Redirection Register #0 (LRR0).\r | |
2fe241a2 | 5495 | \r |
5496 | Writes the current value of LRR0. The 64-bit value written to the LRR0 is returned. \r | |
ac644614 | 5497 | No parameter checking is performed on Value. All bits of Value corresponding\r |
5498 | to reserved fields of LRR0 must be 0 or a Reserved Register/Field fault may occur.\r | |
5499 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
5500 | fault handlers to catch the faults.\r | |
1a2f870c | 5501 | This function is only available on Itanium processors.\r |
ac644614 | 5502 | \r |
ee6c452c | 5503 | @param Value The 64-bit value to write to LRR0.\r |
ac644614 | 5504 | \r |
5505 | @return The 64-bit value written to the LRR0.\r | |
5506 | \r | |
5507 | **/\r | |
5508 | UINT64\r | |
5509 | EFIAPI\r | |
5510 | AsmWriteLrr0 (\r | |
5511 | IN UINT64 Value\r | |
5512 | );\r | |
5513 | \r | |
5514 | \r | |
5515 | /**\r | |
5516 | Writes the current value of 64-bit Local Redirection Register #1 (LRR1).\r | |
2fe241a2 | 5517 | \r |
5518 | Writes the current value of LRR1. The 64-bit value written to the LRR1 is returned. \r | |
ac644614 | 5519 | No parameter checking is performed on Value. All bits of Value corresponding\r |
5520 | to reserved fields of LRR1 must be 0 or a Reserved Register/Field fault may occur.\r | |
5521 | The caller must either guarantee that Value is valid, or the caller must\r | |
5522 | set up fault handlers to catch the faults.\r | |
1a2f870c | 5523 | This function is only available on Itanium processors.\r |
ac644614 | 5524 | \r |
ee6c452c | 5525 | @param Value The 64-bit value to write to LRR1.\r |
ac644614 | 5526 | \r |
5527 | @return The 64-bit value written to the LRR1.\r | |
5528 | \r | |
5529 | **/\r | |
5530 | UINT64\r | |
5531 | EFIAPI\r | |
5532 | AsmWriteLrr1 (\r | |
5533 | IN UINT64 Value\r | |
5534 | );\r | |
5535 | \r | |
5536 | \r | |
5537 | /**\r | |
5538 | Reads the current value of Instruction Breakpoint Register (IBR).\r | |
5539 | \r | |
5540 | The Instruction Breakpoint Registers are used in pairs. The even numbered\r | |
5541 | registers contain breakpoint addresses, and the odd numbered registers contain\r | |
af2dc6a7 | 5542 | breakpoint mask conditions. At least four instruction registers pairs are implemented\r |
ac644614 | 5543 | on all processor models. Implemented registers are contiguous starting with\r |
5544 | register 0. No parameter checking is performed on Index, and if the Index value\r | |
5545 | is beyond the implemented IBR register range, a Reserved Register/Field fault may\r | |
5546 | occur. The caller must either guarantee that Index is valid, or the caller must\r | |
5547 | set up fault handlers to catch the faults.\r | |
1a2f870c | 5548 | This function is only available on Itanium processors.\r |
ac644614 | 5549 | \r |
ee6c452c | 5550 | @param Index The 8-bit Instruction Breakpoint Register index to read.\r |
ac644614 | 5551 | \r |
5552 | @return The current value of Instruction Breakpoint Register specified by Index.\r | |
5553 | \r | |
5554 | **/\r | |
5555 | UINT64\r | |
5556 | EFIAPI\r | |
5557 | AsmReadIbr (\r | |
5558 | IN UINT8 Index\r | |
5559 | );\r | |
5560 | \r | |
5561 | \r | |
5562 | /**\r | |
5563 | Reads the current value of Data Breakpoint Register (DBR).\r | |
5564 | \r | |
5565 | The Data Breakpoint Registers are used in pairs. The even numbered registers\r | |
5566 | contain breakpoint addresses, and odd numbered registers contain breakpoint\r | |
af2dc6a7 | 5567 | mask conditions. At least four data registers pairs are implemented on all processor\r |
ac644614 | 5568 | models. Implemented registers are contiguous starting with register 0.\r |
5569 | No parameter checking is performed on Index. If the Index value is beyond\r | |
5570 | the implemented DBR register range, a Reserved Register/Field fault may occur.\r | |
5571 | The caller must either guarantee that Index is valid, or the caller must set up\r | |
5572 | fault handlers to catch the faults.\r | |
1a2f870c | 5573 | This function is only available on Itanium processors.\r |
ac644614 | 5574 | \r |
ee6c452c | 5575 | @param Index The 8-bit Data Breakpoint Register index to read.\r |
ac644614 | 5576 | \r |
5577 | @return The current value of Data Breakpoint Register specified by Index.\r | |
5578 | \r | |
5579 | **/\r | |
5580 | UINT64\r | |
5581 | EFIAPI\r | |
5582 | AsmReadDbr (\r | |
5583 | IN UINT8 Index\r | |
5584 | );\r | |
5585 | \r | |
5586 | \r | |
5587 | /**\r | |
5588 | Reads the current value of Performance Monitor Configuration Register (PMC).\r | |
5589 | \r | |
af2dc6a7 | 5590 | All processor implementations provide at least four performance counters\r |
5591 | (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow\r | |
ac644614 | 5592 | status registers (PMC [0]... PMC [3]). Processor implementations may provide\r |
5593 | additional implementation-dependent PMC and PMD to increase the number of\r | |
5594 | 'generic' performance counters (PMC/PMD pairs). The remainder of PMC and PMD\r | |
5595 | register set is implementation dependent. No parameter checking is performed\r | |
5596 | on Index. If the Index value is beyond the implemented PMC register range,\r | |
5597 | zero value will be returned.\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 read.\r |
ac644614 | 5601 | \r |
2fe241a2 | 5602 | @return The current value of Performance Monitor Configuration Register\r |
5603 | specified by Index.\r | |
ac644614 | 5604 | \r |
5605 | **/\r | |
5606 | UINT64\r | |
5607 | EFIAPI\r | |
5608 | AsmReadPmc (\r | |
5609 | IN UINT8 Index\r | |
5610 | );\r | |
5611 | \r | |
5612 | \r | |
5613 | /**\r | |
5614 | Reads the current value of Performance Monitor Data Register (PMD).\r | |
5615 | \r | |
5616 | All processor implementations provide at least 4 performance counters\r | |
5617 | (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter\r | |
5618 | overflow status registers (PMC [0]... PMC [3]). Processor implementations may\r | |
5619 | provide additional implementation-dependent PMC and PMD to increase the number\r | |
5620 | of 'generic' performance counters (PMC/PMD pairs). The remainder of PMC and PMD\r | |
5621 | register set is implementation dependent. No parameter checking is performed\r | |
5622 | on Index. If the Index value is beyond the implemented PMD register range,\r | |
5623 | zero value will be returned.\r | |
1a2f870c | 5624 | This function is only available on Itanium processors.\r |
ac644614 | 5625 | \r |
ee6c452c | 5626 | @param Index The 8-bit Performance Monitor Data Register index to read.\r |
ac644614 | 5627 | \r |
5628 | @return The current value of Performance Monitor Data Register specified by Index.\r | |
5629 | \r | |
5630 | **/\r | |
5631 | UINT64\r | |
5632 | EFIAPI\r | |
5633 | AsmReadPmd (\r | |
5634 | IN UINT8 Index\r | |
5635 | );\r | |
5636 | \r | |
5637 | \r | |
5638 | /**\r | |
5639 | Writes the current value of 64-bit Instruction Breakpoint Register (IBR).\r | |
5640 | \r | |
5641 | Writes current value of Instruction Breakpoint Register specified by Index.\r | |
5642 | The Instruction Breakpoint Registers are used in pairs. The even numbered\r | |
5643 | registers contain breakpoint addresses, and odd numbered registers contain\r | |
af2dc6a7 | 5644 | breakpoint mask conditions. At least four instruction registers pairs are implemented\r |
ac644614 | 5645 | on all processor models. Implemented registers are contiguous starting with\r |
5646 | register 0. No parameter checking is performed on Index. If the Index value\r | |
5647 | is beyond the implemented IBR register range, a Reserved Register/Field fault may\r | |
5648 | occur. The caller must either guarantee that Index is valid, or the caller must\r | |
5649 | set up fault handlers to catch the faults.\r | |
1a2f870c | 5650 | This function is only available on Itanium processors.\r |
ac644614 | 5651 | \r |
ee6c452c | 5652 | @param Index The 8-bit Instruction Breakpoint Register index to write.\r |
5653 | @param Value The 64-bit value to write to IBR.\r | |
ac644614 | 5654 | \r |
5655 | @return The 64-bit value written to the IBR.\r | |
5656 | \r | |
5657 | **/\r | |
5658 | UINT64\r | |
5659 | EFIAPI\r | |
5660 | AsmWriteIbr (\r | |
5661 | IN UINT8 Index,\r | |
5662 | IN UINT64 Value\r | |
5663 | );\r | |
5664 | \r | |
5665 | \r | |
5666 | /**\r | |
5667 | Writes the current value of 64-bit Data Breakpoint Register (DBR).\r | |
5668 | \r | |
5669 | Writes current value of Data Breakpoint Register specified by Index.\r | |
5670 | The Data Breakpoint Registers are used in pairs. The even numbered registers\r | |
5671 | contain breakpoint addresses, and odd numbered registers contain breakpoint\r | |
af2dc6a7 | 5672 | mask conditions. At least four data registers pairs are implemented on all processor\r |
ac644614 | 5673 | models. Implemented registers are contiguous starting with register 0. No parameter\r |
5674 | checking is performed on Index. If the Index value is beyond the implemented\r | |
5675 | DBR register range, a Reserved Register/Field fault may occur. The caller must\r | |
5676 | either guarantee that Index is valid, or the caller must set up fault handlers to\r | |
5677 | catch the faults.\r | |
1a2f870c | 5678 | This function is only available on Itanium processors.\r |
ac644614 | 5679 | \r |
ee6c452c | 5680 | @param Index The 8-bit Data Breakpoint Register index to write.\r |
5681 | @param Value The 64-bit value to write to DBR.\r | |
ac644614 | 5682 | \r |
5683 | @return The 64-bit value written to the DBR.\r | |
5684 | \r | |
5685 | **/\r | |
5686 | UINT64\r | |
5687 | EFIAPI\r | |
5688 | AsmWriteDbr (\r | |
5689 | IN UINT8 Index,\r | |
5690 | IN UINT64 Value\r | |
5691 | );\r | |
5692 | \r | |
5693 | \r | |
5694 | /**\r | |
5695 | Writes the current value of 64-bit Performance Monitor Configuration Register (PMC).\r | |
5696 | \r | |
5697 | Writes current value of Performance Monitor Configuration Register specified by Index.\r | |
af2dc6a7 | 5698 | All processor implementations provide at least four performance counters\r |
5699 | (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow status\r | |
ac644614 | 5700 | registers (PMC [0]... PMC [3]). Processor implementations may provide additional\r |
5701 | implementation-dependent PMC and PMD to increase the number of 'generic' performance\r | |
5702 | counters (PMC/PMD pairs). The remainder of PMC and PMD register set is implementation\r | |
5703 | dependent. No parameter checking is performed on Index. If the Index value is\r | |
5704 | beyond the implemented PMC register range, the write is ignored.\r | |
1a2f870c | 5705 | This function is only available on Itanium processors.\r |
ac644614 | 5706 | \r |
ee6c452c | 5707 | @param Index The 8-bit Performance Monitor Configuration Register index to write.\r |
5708 | @param Value The 64-bit value to write to PMC.\r | |
ac644614 | 5709 | \r |
5710 | @return The 64-bit value written to the PMC.\r | |
5711 | \r | |
5712 | **/\r | |
5713 | UINT64\r | |
5714 | EFIAPI\r | |
5715 | AsmWritePmc (\r | |
5716 | IN UINT8 Index,\r | |
5717 | IN UINT64 Value\r | |
5718 | );\r | |
5719 | \r | |
5720 | \r | |
5721 | /**\r | |
5722 | Writes the current value of 64-bit Performance Monitor Data Register (PMD).\r | |
5723 | \r | |
5724 | Writes current value of Performance Monitor Data Register specified by Index.\r | |
af2dc6a7 | 5725 | All processor implementations provide at least four performance counters\r |
5726 | (PMC/PMD [4]...PMC/PMD [7] pairs), and four performance monitor counter overflow\r | |
ac644614 | 5727 | status registers (PMC [0]... PMC [3]). Processor implementations may provide\r |
5728 | additional implementation-dependent PMC and PMD to increase the number of 'generic'\r | |
5729 | performance counters (PMC/PMD pairs). The remainder of PMC and PMD register set\r | |
5730 | is implementation dependent. No parameter checking is performed on Index. If the\r | |
5731 | Index value is beyond the implemented PMD register range, the write is ignored.\r | |
1a2f870c | 5732 | This function is only available on Itanium processors.\r |
ac644614 | 5733 | \r |
ee6c452c | 5734 | @param Index The 8-bit Performance Monitor Data Register index to write.\r |
5735 | @param Value The 64-bit value to write to PMD.\r | |
ac644614 | 5736 | \r |
5737 | @return The 64-bit value written to the PMD.\r | |
5738 | \r | |
5739 | **/\r | |
5740 | UINT64\r | |
5741 | EFIAPI\r | |
5742 | AsmWritePmd (\r | |
5743 | IN UINT8 Index,\r | |
5744 | IN UINT64 Value\r | |
5745 | );\r | |
5746 | \r | |
5747 | \r | |
5748 | /**\r | |
5749 | Reads the current value of 64-bit Global Pointer (GP).\r | |
5750 | \r | |
5751 | Reads and returns the current value of GP.\r | |
1a2f870c | 5752 | This function is only available on Itanium processors.\r |
ac644614 | 5753 | \r |
5754 | @return The current value of GP.\r | |
5755 | \r | |
5756 | **/\r | |
5757 | UINT64\r | |
5758 | EFIAPI\r | |
5759 | AsmReadGp (\r | |
5760 | VOID\r | |
5761 | );\r | |
5762 | \r | |
5763 | \r | |
5764 | /**\r | |
5765 | Write the current value of 64-bit Global Pointer (GP).\r | |
5766 | \r | |
5767 | Writes the current value of GP. The 64-bit value written to the GP is returned.\r | |
5768 | No parameter checking is performed on Value.\r | |
1a2f870c | 5769 | This function is only available on Itanium processors.\r |
ac644614 | 5770 | \r |
5771 | @param Value The 64-bit value to write to GP.\r | |
5772 | \r | |
5773 | @return The 64-bit value written to the GP.\r | |
5774 | \r | |
5775 | **/\r | |
5776 | UINT64\r | |
5777 | EFIAPI\r | |
5778 | AsmWriteGp (\r | |
5779 | IN UINT64 Value\r | |
5780 | );\r | |
5781 | \r | |
5782 | \r | |
5783 | /**\r | |
5784 | Reads the current value of 64-bit Stack Pointer (SP).\r | |
5785 | \r | |
5786 | Reads and returns the current value of SP.\r | |
1a2f870c | 5787 | This function is only available on Itanium processors.\r |
ac644614 | 5788 | \r |
5789 | @return The current value of SP.\r | |
5790 | \r | |
5791 | **/\r | |
5792 | UINT64\r | |
5793 | EFIAPI\r | |
5794 | AsmReadSp (\r | |
5795 | VOID\r | |
5796 | );\r | |
5797 | \r | |
5798 | \r | |
aad6137d | 5799 | ///\r |
af2dc6a7 | 5800 | /// Valid Index value for AsmReadControlRegister().\r |
aad6137d | 5801 | ///\r |
5802 | #define IPF_CONTROL_REGISTER_DCR 0\r | |
5803 | #define IPF_CONTROL_REGISTER_ITM 1\r | |
5804 | #define IPF_CONTROL_REGISTER_IVA 2\r | |
5805 | #define IPF_CONTROL_REGISTER_PTA 8\r | |
5806 | #define IPF_CONTROL_REGISTER_IPSR 16\r | |
5807 | #define IPF_CONTROL_REGISTER_ISR 17\r | |
5808 | #define IPF_CONTROL_REGISTER_IIP 19\r | |
5809 | #define IPF_CONTROL_REGISTER_IFA 20\r | |
5810 | #define IPF_CONTROL_REGISTER_ITIR 21\r | |
5811 | #define IPF_CONTROL_REGISTER_IIPA 22\r | |
5812 | #define IPF_CONTROL_REGISTER_IFS 23\r | |
5813 | #define IPF_CONTROL_REGISTER_IIM 24\r | |
5814 | #define IPF_CONTROL_REGISTER_IHA 25\r | |
5815 | #define IPF_CONTROL_REGISTER_LID 64\r | |
5816 | #define IPF_CONTROL_REGISTER_IVR 65\r | |
5817 | #define IPF_CONTROL_REGISTER_TPR 66\r | |
5818 | #define IPF_CONTROL_REGISTER_EOI 67\r | |
5819 | #define IPF_CONTROL_REGISTER_IRR0 68\r | |
5820 | #define IPF_CONTROL_REGISTER_IRR1 69\r | |
5821 | #define IPF_CONTROL_REGISTER_IRR2 70\r | |
5822 | #define IPF_CONTROL_REGISTER_IRR3 71\r | |
5823 | #define IPF_CONTROL_REGISTER_ITV 72\r | |
5824 | #define IPF_CONTROL_REGISTER_PMV 73\r | |
5825 | #define IPF_CONTROL_REGISTER_CMCV 74\r | |
5826 | #define IPF_CONTROL_REGISTER_LRR0 80\r | |
5827 | #define IPF_CONTROL_REGISTER_LRR1 81\r | |
5828 | \r | |
5829 | /**\r | |
5830 | Reads a 64-bit control register.\r | |
5831 | \r | |
af2dc6a7 | 5832 | Reads and returns the control register specified by Index. The valid Index valued \r |
5833 | are defined above in "Related Definitions".\r | |
5834 | If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only \r | |
5835 | available on Itanium processors.\r | |
aad6137d | 5836 | \r |
5837 | @param Index The index of the control register to read.\r | |
5838 | \r | |
5839 | @return The control register specified by Index.\r | |
5840 | \r | |
5841 | **/\r | |
5842 | UINT64\r | |
5843 | EFIAPI\r | |
5844 | AsmReadControlRegister (\r | |
5845 | IN UINT64 Index\r | |
5846 | );\r | |
5847 | \r | |
5848 | \r | |
5849 | ///\r | |
af2dc6a7 | 5850 | /// Valid Index value for AsmReadApplicationRegister().\r |
aad6137d | 5851 | ///\r |
5852 | #define IPF_APPLICATION_REGISTER_K0 0\r | |
5853 | #define IPF_APPLICATION_REGISTER_K1 1\r | |
5854 | #define IPF_APPLICATION_REGISTER_K2 2\r | |
5855 | #define IPF_APPLICATION_REGISTER_K3 3\r | |
5856 | #define IPF_APPLICATION_REGISTER_K4 4\r | |
5857 | #define IPF_APPLICATION_REGISTER_K5 5\r | |
5858 | #define IPF_APPLICATION_REGISTER_K6 6\r | |
5859 | #define IPF_APPLICATION_REGISTER_K7 7\r | |
5860 | #define IPF_APPLICATION_REGISTER_RSC 16\r | |
5861 | #define IPF_APPLICATION_REGISTER_BSP 17\r | |
5862 | #define IPF_APPLICATION_REGISTER_BSPSTORE 18\r | |
5863 | #define IPF_APPLICATION_REGISTER_RNAT 19\r | |
5864 | #define IPF_APPLICATION_REGISTER_FCR 21\r | |
5865 | #define IPF_APPLICATION_REGISTER_EFLAG 24\r | |
5866 | #define IPF_APPLICATION_REGISTER_CSD 25\r | |
5867 | #define IPF_APPLICATION_REGISTER_SSD 26\r | |
5868 | #define IPF_APPLICATION_REGISTER_CFLG 27\r | |
5869 | #define IPF_APPLICATION_REGISTER_FSR 28\r | |
5870 | #define IPF_APPLICATION_REGISTER_FIR 29\r | |
5871 | #define IPF_APPLICATION_REGISTER_FDR 30\r | |
5872 | #define IPF_APPLICATION_REGISTER_CCV 32\r | |
5873 | #define IPF_APPLICATION_REGISTER_UNAT 36\r | |
5874 | #define IPF_APPLICATION_REGISTER_FPSR 40\r | |
5875 | #define IPF_APPLICATION_REGISTER_ITC 44\r | |
5876 | #define IPF_APPLICATION_REGISTER_PFS 64\r | |
5877 | #define IPF_APPLICATION_REGISTER_LC 65\r | |
5878 | #define IPF_APPLICATION_REGISTER_EC 66\r | |
5879 | \r | |
5880 | /**\r | |
5881 | Reads a 64-bit application register.\r | |
5882 | \r | |
af2dc6a7 | 5883 | Reads and returns the application register specified by Index. The valid Index \r |
5884 | valued are defined above in "Related Definitions".\r | |
5885 | If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only \r | |
5886 | available on Itanium processors.\r | |
aad6137d | 5887 | \r |
5888 | @param Index The index of the application register to read.\r | |
5889 | \r | |
5890 | @return The application register specified by Index.\r | |
5891 | \r | |
5892 | **/\r | |
5893 | UINT64\r | |
5894 | EFIAPI\r | |
5895 | AsmReadApplicationRegister (\r | |
5896 | IN UINT64 Index\r | |
5897 | );\r | |
5898 | \r | |
5899 | \r | |
59e0bb0c | 5900 | /**\r |
5901 | Reads the current value of a Machine Specific Register (MSR).\r | |
5902 | \r | |
5903 | Reads and returns the current value of the Machine Specific Register specified by Index. No\r | |
5904 | parameter checking is performed on Index, and if the Index value is beyond the implemented MSR\r | |
5905 | register range, a Reserved Register/Field fault may occur. The caller must either guarantee that\r | |
5906 | Index is valid, or the caller must set up fault handlers to catch the faults. This function is\r | |
1a2f870c | 5907 | only available on Itanium processors.\r |
59e0bb0c | 5908 | \r |
5909 | @param Index The 8-bit Machine Specific Register index to read.\r | |
5910 | \r | |
5911 | @return The current value of the Machine Specific Register specified by Index. \r | |
5912 | \r | |
5913 | **/\r | |
5914 | UINT64\r | |
5915 | EFIAPI\r | |
5916 | AsmReadMsr (\r | |
5917 | IN UINT8 Index \r | |
5918 | );\r | |
5919 | \r | |
5920 | \r | |
5921 | /**\r | |
5922 | Writes the current value of a Machine Specific Register (MSR).\r | |
5923 | \r | |
5924 | Writes Value to the Machine Specific Register specified by Index. Value is returned. No\r | |
5925 | parameter checking is performed on Index, and if the Index value is beyond the implemented MSR\r | |
5926 | register range, a Reserved Register/Field fault may occur. The caller must either guarantee that\r | |
5927 | Index is valid, or the caller must set up fault handlers to catch the faults. This function is\r | |
1a2f870c | 5928 | only available on Itanium processors.\r |
59e0bb0c | 5929 | \r |
5930 | @param Index The 8-bit Machine Specific Register index to write.\r | |
5931 | @param Value The 64-bit value to write to the Machine Specific Register.\r | |
5932 | \r | |
5933 | @return The 64-bit value to write to the Machine Specific Register. \r | |
5934 | \r | |
5935 | **/\r | |
5936 | UINT64\r | |
5937 | EFIAPI\r | |
5938 | AsmWriteMsr (\r | |
5939 | IN UINT8 Index, \r | |
5940 | IN UINT64 Value \r | |
5941 | );\r | |
5942 | \r | |
5943 | \r | |
ac644614 | 5944 | /**\r |
5945 | Determines if the CPU is currently executing in virtual, physical, or mixed mode.\r | |
5946 | \r | |
5947 | Determines the current execution mode of the CPU.\r | |
5948 | If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.\r | |
5949 | If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.\r | |
5950 | If the CPU is not in physical mode or virtual mode, then it is in mixed mode,\r | |
5951 | and -1 is returned.\r | |
1a2f870c | 5952 | This function is only available on Itanium processors.\r |
ac644614 | 5953 | \r |
17f695ed | 5954 | @retval 1 The CPU is in virtual mode.\r |
5955 | @retval 0 The CPU is in physical mode.\r | |
5956 | @retval -1 The CPU is in mixed mode.\r | |
ac644614 | 5957 | \r |
5958 | **/\r | |
5959 | INT64\r | |
5960 | EFIAPI\r | |
5961 | AsmCpuVirtual (\r | |
5962 | VOID\r | |
5963 | );\r | |
5964 | \r | |
5965 | \r | |
5966 | /**\r | |
5967 | Makes a PAL procedure call.\r | |
5968 | \r | |
5969 | This is a wrapper function to make a PAL procedure call. Based on the Index\r | |
5970 | value this API will make static or stacked PAL call. The following table\r | |
5971 | describes the usage of PAL Procedure Index Assignment. Architected procedures\r | |
5972 | may be designated as required or optional. If a PAL procedure is specified\r | |
5973 | as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the\r | |
5974 | Status field of the PAL_CALL_RETURN structure.\r | |
5975 | This indicates that the procedure is not present in this PAL implementation.\r | |
5976 | It is the caller's responsibility to check for this return code after calling\r | |
5977 | any optional PAL procedure.\r | |
5978 | No parameter checking is performed on the 5 input parameters, but there are\r | |
5979 | some common rules that the caller should follow when making a PAL call. Any\r | |
5980 | address passed to PAL as buffers for return parameters must be 8-byte aligned.\r | |
5981 | Unaligned addresses may cause undefined results. For those parameters defined\r | |
5982 | as reserved or some fields defined as reserved must be zero filled or the invalid\r | |
5983 | argument return value may be returned or undefined result may occur during the\r | |
5984 | execution of the procedure. If the PalEntryPoint does not point to a valid\r | |
5985 | PAL entry point then the system behavior is undefined. This function is only\r | |
1a2f870c | 5986 | available on Itanium processors.\r |
ac644614 | 5987 | \r |
ee6c452c | 5988 | @param PalEntryPoint The PAL procedure calls entry point.\r |
5989 | @param Index The PAL procedure Index number.\r | |
5990 | @param Arg2 The 2nd parameter for PAL procedure calls.\r | |
5991 | @param Arg3 The 3rd parameter for PAL procedure calls.\r | |
5992 | @param Arg4 The 4th parameter for PAL procedure calls.\r | |
ac644614 | 5993 | \r |
5994 | @return structure returned from the PAL Call procedure, including the status and return value.\r | |
5995 | \r | |
5996 | **/\r | |
5997 | PAL_CALL_RETURN\r | |
5998 | EFIAPI\r | |
5999 | AsmPalCall (\r | |
6000 | IN UINT64 PalEntryPoint,\r | |
6001 | IN UINT64 Index,\r | |
6002 | IN UINT64 Arg2,\r | |
6003 | IN UINT64 Arg3,\r | |
6004 | IN UINT64 Arg4\r | |
6005 | );\r | |
fd163050 | 6006 | #endif\r |
ac644614 | 6007 | \r |
fd163050 | 6008 | #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)\r |
1106ffe1 | 6009 | ///\r |
af2dc6a7 | 6010 | /// IA32 and x64 Specific Functions.\r |
6011 | /// Byte packed structure for 16-bit Real Mode EFLAGS.\r | |
1106ffe1 | 6012 | ///\r |
ac644614 | 6013 | typedef union {\r |
6014 | struct {\r | |
af2dc6a7 | 6015 | UINT32 CF:1; ///< Carry Flag.\r |
6016 | UINT32 Reserved_0:1; ///< Reserved.\r | |
6017 | UINT32 PF:1; ///< Parity Flag.\r | |
6018 | UINT32 Reserved_1:1; ///< Reserved.\r | |
6019 | UINT32 AF:1; ///< Auxiliary Carry Flag.\r | |
6020 | UINT32 Reserved_2:1; ///< Reserved.\r | |
6021 | UINT32 ZF:1; ///< Zero Flag.\r | |
6022 | UINT32 SF:1; ///< Sign Flag.\r | |
6023 | UINT32 TF:1; ///< Trap Flag.\r | |
6024 | UINT32 IF:1; ///< Interrupt Enable Flag.\r | |
6025 | UINT32 DF:1; ///< Direction Flag.\r | |
6026 | UINT32 OF:1; ///< Overflow Flag.\r | |
6027 | UINT32 IOPL:2; ///< I/O Privilege Level.\r | |
6028 | UINT32 NT:1; ///< Nested Task.\r | |
6029 | UINT32 Reserved_3:1; ///< Reserved.\r | |
ac644614 | 6030 | } Bits;\r |
6031 | UINT16 Uint16;\r | |
6032 | } IA32_FLAGS16;\r | |
6033 | \r | |
1106ffe1 | 6034 | ///\r |
af2dc6a7 | 6035 | /// Byte packed structure for EFLAGS/RFLAGS.\r |
6036 | /// 32-bits on IA-32.\r | |
6037 | /// 64-bits on x64. The upper 32-bits on x64 are reserved.\r | |
1106ffe1 | 6038 | ///\r |
ac644614 | 6039 | typedef union {\r |
6040 | struct {\r | |
af2dc6a7 | 6041 | UINT32 CF:1; ///< Carry Flag.\r |
6042 | UINT32 Reserved_0:1; ///< Reserved.\r | |
6043 | UINT32 PF:1; ///< Parity Flag.\r | |
6044 | UINT32 Reserved_1:1; ///< Reserved.\r | |
6045 | UINT32 AF:1; ///< Auxiliary Carry Flag.\r | |
6046 | UINT32 Reserved_2:1; ///< Reserved.\r | |
6047 | UINT32 ZF:1; ///< Zero Flag.\r | |
6048 | UINT32 SF:1; ///< Sign Flag.\r | |
6049 | UINT32 TF:1; ///< Trap Flag.\r | |
6050 | UINT32 IF:1; ///< Interrupt Enable Flag.\r | |
6051 | UINT32 DF:1; ///< Direction Flag.\r | |
6052 | UINT32 OF:1; ///< Overflow Flag.\r | |
6053 | UINT32 IOPL:2; ///< I/O Privilege Level.\r | |
6054 | UINT32 NT:1; ///< Nested Task.\r | |
6055 | UINT32 Reserved_3:1; ///< Reserved.\r | |
6056 | UINT32 RF:1; ///< Resume Flag.\r | |
6057 | UINT32 VM:1; ///< Virtual 8086 Mode.\r | |
6058 | UINT32 AC:1; ///< Alignment Check.\r | |
6059 | UINT32 VIF:1; ///< Virtual Interrupt Flag.\r | |
6060 | UINT32 VIP:1; ///< Virtual Interrupt Pending.\r | |
6061 | UINT32 ID:1; ///< ID Flag.\r | |
6062 | UINT32 Reserved_4:10; ///< Reserved.\r | |
ac644614 | 6063 | } Bits;\r |
6064 | UINTN UintN;\r | |
6065 | } IA32_EFLAGS32;\r | |
6066 | \r | |
1106ffe1 | 6067 | ///\r |
af2dc6a7 | 6068 | /// Byte packed structure for Control Register 0 (CR0).\r |
6069 | /// 32-bits on IA-32.\r | |
6070 | /// 64-bits on x64. The upper 32-bits on x64 are reserved.\r | |
1106ffe1 | 6071 | ///\r |
ac644614 | 6072 | typedef union {\r |
6073 | struct {\r | |
af2dc6a7 | 6074 | UINT32 PE:1; ///< Protection Enable.\r |
6075 | UINT32 MP:1; ///< Monitor Coprocessor.\r | |
6076 | UINT32 EM:1; ///< Emulation.\r | |
6077 | UINT32 TS:1; ///< Task Switched.\r | |
6078 | UINT32 ET:1; ///< Extension Type.\r | |
6079 | UINT32 NE:1; ///< Numeric Error.\r | |
6080 | UINT32 Reserved_0:10; ///< Reserved.\r | |
6081 | UINT32 WP:1; ///< Write Protect.\r | |
6082 | UINT32 Reserved_1:1; ///< Reserved.\r | |
6083 | UINT32 AM:1; ///< Alignment Mask.\r | |
6084 | UINT32 Reserved_2:10; ///< Reserved.\r | |
6085 | UINT32 NW:1; ///< Mot Write-through.\r | |
6086 | UINT32 CD:1; ///< Cache Disable.\r | |
6087 | UINT32 PG:1; ///< Paging.\r | |
ac644614 | 6088 | } Bits;\r |
6089 | UINTN UintN;\r | |
6090 | } IA32_CR0;\r | |
6091 | \r | |
1106ffe1 | 6092 | ///\r |
af2dc6a7 | 6093 | /// Byte packed structure for Control Register 4 (CR4).\r |
6094 | /// 32-bits on IA-32.\r | |
6095 | /// 64-bits on x64. The upper 32-bits on x64 are reserved.\r | |
1106ffe1 | 6096 | ///\r |
ac644614 | 6097 | typedef union {\r |
6098 | struct {\r | |
af2dc6a7 | 6099 | UINT32 VME:1; ///< Virtual-8086 Mode Extensions.\r |
6100 | UINT32 PVI:1; ///< Protected-Mode Virtual Interrupts.\r | |
6101 | UINT32 TSD:1; ///< Time Stamp Disable.\r | |
6102 | UINT32 DE:1; ///< Debugging Extensions.\r | |
6103 | UINT32 PSE:1; ///< Page Size Extensions.\r | |
6104 | UINT32 PAE:1; ///< Physical Address Extension.\r | |
6105 | UINT32 MCE:1; ///< Machine Check Enable.\r | |
6106 | UINT32 PGE:1; ///< Page Global Enable.\r | |
2a53dabf | 6107 | UINT32 PCE:1; ///< Performance Monitoring Counter\r |
af2dc6a7 | 6108 | ///< Enable.\r |
2a53dabf LG |
6109 | UINT32 OSFXSR:1; ///< Operating System Support for\r |
6110 | ///< FXSAVE and FXRSTOR instructions\r | |
6111 | UINT32 OSXMMEXCPT:1; ///< Operating System Support for\r | |
6112 | ///< Unmasked SIMD Floating Point\r | |
af2dc6a7 | 6113 | ///< Exceptions.\r |
6114 | UINT32 Reserved_0:2; ///< Reserved.\r | |
2a53dabf | 6115 | UINT32 VMXE:1; ///< VMX Enable\r |
af2dc6a7 | 6116 | UINT32 Reserved_1:18; ///< Reserved.\r |
ac644614 | 6117 | } Bits;\r |
6118 | UINTN UintN;\r | |
6119 | } IA32_CR4;\r | |
6120 | \r | |
6088db38 | 6121 | ///\r |
6122 | /// Byte packed structure for a segment descriptor in a GDT/LDT.\r | |
6123 | ///\r | |
6124 | typedef union {\r | |
6125 | struct {\r | |
6126 | UINT32 LimitLow:16;\r | |
6127 | UINT32 BaseLow:16;\r | |
6128 | UINT32 BaseMid:8;\r | |
6129 | UINT32 Type:4;\r | |
6130 | UINT32 S:1;\r | |
6131 | UINT32 DPL:2;\r | |
6132 | UINT32 P:1;\r | |
6133 | UINT32 LimitHigh:4;\r | |
6134 | UINT32 AVL:1;\r | |
6135 | UINT32 L:1;\r | |
6136 | UINT32 DB:1;\r | |
6137 | UINT32 G:1;\r | |
6138 | UINT32 BaseHigh:8;\r | |
6139 | } Bits;\r | |
6140 | UINT64 Uint64;\r | |
6141 | } IA32_SEGMENT_DESCRIPTOR;\r | |
6142 | \r | |
1106ffe1 | 6143 | ///\r |
af2dc6a7 | 6144 | /// Byte packed structure for an IDTR, GDTR, LDTR descriptor.\r |
1106ffe1 | 6145 | ///\r |
ac644614 | 6146 | #pragma pack (1)\r |
6147 | typedef struct {\r | |
6148 | UINT16 Limit;\r | |
6149 | UINTN Base;\r | |
6150 | } IA32_DESCRIPTOR;\r | |
6151 | #pragma pack ()\r | |
6152 | \r | |
6153 | #define IA32_IDT_GATE_TYPE_TASK 0x85\r | |
6154 | #define IA32_IDT_GATE_TYPE_INTERRUPT_16 0x86\r | |
6155 | #define IA32_IDT_GATE_TYPE_TRAP_16 0x87\r | |
6156 | #define IA32_IDT_GATE_TYPE_INTERRUPT_32 0x8E\r | |
6157 | #define IA32_IDT_GATE_TYPE_TRAP_32 0x8F\r | |
6158 | \r | |
6f4aad3b | 6159 | \r |
6160 | #if defined (MDE_CPU_IA32)\r | |
1106ffe1 | 6161 | ///\r |
af2dc6a7 | 6162 | /// Byte packed structure for an IA-32 Interrupt Gate Descriptor.\r |
1106ffe1 | 6163 | ///\r |
dc317713 | 6164 | typedef union {\r |
6165 | struct {\r | |
af2dc6a7 | 6166 | UINT32 OffsetLow:16; ///< Offset bits 15..0.\r |
6167 | UINT32 Selector:16; ///< Selector.\r | |
6168 | UINT32 Reserved_0:8; ///< Reserved.\r | |
6169 | UINT32 GateType:8; ///< Gate Type. See #defines above.\r | |
6170 | UINT32 OffsetHigh:16; ///< Offset bits 31..16.\r | |
dc317713 | 6171 | } Bits;\r |
6172 | UINT64 Uint64;\r | |
6173 | } IA32_IDT_GATE_DESCRIPTOR;\r | |
6174 | \r | |
6175 | #endif\r | |
6176 | \r | |
6177 | #if defined (MDE_CPU_X64)\r | |
6f4aad3b | 6178 | ///\r |
af2dc6a7 | 6179 | /// Byte packed structure for an x64 Interrupt Gate Descriptor.\r |
6f4aad3b | 6180 | ///\r |
ac644614 | 6181 | typedef union {\r |
6182 | struct {\r | |
af2dc6a7 | 6183 | UINT32 OffsetLow:16; ///< Offset bits 15..0.\r |
6184 | UINT32 Selector:16; ///< Selector.\r | |
6185 | UINT32 Reserved_0:8; ///< Reserved.\r | |
6186 | UINT32 GateType:8; ///< Gate Type. See #defines above.\r | |
6187 | UINT32 OffsetHigh:16; ///< Offset bits 31..16.\r | |
6188 | UINT32 OffsetUpper:32; ///< Offset bits 63..32.\r | |
6189 | UINT32 Reserved_1:32; ///< Reserved.\r | |
ac644614 | 6190 | } Bits;\r |
6f4aad3b | 6191 | struct {\r |
6192 | UINT64 Uint64;\r | |
6193 | UINT64 Uint64_1;\r | |
6194 | } Uint128; \r | |
ac644614 | 6195 | } IA32_IDT_GATE_DESCRIPTOR;\r |
6196 | \r | |
dc317713 | 6197 | #endif\r |
6198 | \r | |
1106ffe1 | 6199 | ///\r |
af2dc6a7 | 6200 | /// Byte packed structure for an FP/SSE/SSE2 context.\r |
1106ffe1 | 6201 | ///\r |
ac644614 | 6202 | typedef struct {\r |
6203 | UINT8 Buffer[512];\r | |
6204 | } IA32_FX_BUFFER;\r | |
6205 | \r | |
1106ffe1 | 6206 | ///\r |
af2dc6a7 | 6207 | /// Structures for the 16-bit real mode thunks.\r |
1106ffe1 | 6208 | ///\r |
ac644614 | 6209 | typedef struct {\r |
6210 | UINT32 Reserved1;\r | |
6211 | UINT32 Reserved2;\r | |
6212 | UINT32 Reserved3;\r | |
6213 | UINT32 Reserved4;\r | |
6214 | UINT8 BL;\r | |
6215 | UINT8 BH;\r | |
6216 | UINT16 Reserved5;\r | |
6217 | UINT8 DL;\r | |
6218 | UINT8 DH;\r | |
6219 | UINT16 Reserved6;\r | |
6220 | UINT8 CL;\r | |
6221 | UINT8 CH;\r | |
6222 | UINT16 Reserved7;\r | |
6223 | UINT8 AL;\r | |
6224 | UINT8 AH;\r | |
6225 | UINT16 Reserved8;\r | |
6226 | } IA32_BYTE_REGS;\r | |
6227 | \r | |
6228 | typedef struct {\r | |
6229 | UINT16 DI;\r | |
6230 | UINT16 Reserved1;\r | |
6231 | UINT16 SI;\r | |
6232 | UINT16 Reserved2;\r | |
6233 | UINT16 BP;\r | |
6234 | UINT16 Reserved3;\r | |
6235 | UINT16 SP;\r | |
6236 | UINT16 Reserved4;\r | |
6237 | UINT16 BX;\r | |
6238 | UINT16 Reserved5;\r | |
6239 | UINT16 DX;\r | |
6240 | UINT16 Reserved6;\r | |
6241 | UINT16 CX;\r | |
6242 | UINT16 Reserved7;\r | |
6243 | UINT16 AX;\r | |
6244 | UINT16 Reserved8;\r | |
6245 | } IA32_WORD_REGS;\r | |
6246 | \r | |
6247 | typedef struct {\r | |
6248 | UINT32 EDI;\r | |
6249 | UINT32 ESI;\r | |
6250 | UINT32 EBP;\r | |
6251 | UINT32 ESP;\r | |
6252 | UINT32 EBX;\r | |
6253 | UINT32 EDX;\r | |
6254 | UINT32 ECX;\r | |
6255 | UINT32 EAX;\r | |
6256 | UINT16 DS;\r | |
6257 | UINT16 ES;\r | |
6258 | UINT16 FS;\r | |
6259 | UINT16 GS;\r | |
6260 | IA32_EFLAGS32 EFLAGS;\r | |
6261 | UINT32 Eip;\r | |
6262 | UINT16 CS;\r | |
6263 | UINT16 SS;\r | |
6264 | } IA32_DWORD_REGS;\r | |
6265 | \r | |
6266 | typedef union {\r | |
6267 | IA32_DWORD_REGS E;\r | |
6268 | IA32_WORD_REGS X;\r | |
6269 | IA32_BYTE_REGS H;\r | |
6270 | } IA32_REGISTER_SET;\r | |
6271 | \r | |
1106ffe1 | 6272 | ///\r |
af2dc6a7 | 6273 | /// Byte packed structure for an 16-bit real mode thunks.\r |
1106ffe1 | 6274 | ///\r |
ac644614 | 6275 | typedef struct {\r |
6276 | IA32_REGISTER_SET *RealModeState;\r | |
6277 | VOID *RealModeBuffer;\r | |
6278 | UINT32 RealModeBufferSize;\r | |
6279 | UINT32 ThunkAttributes;\r | |
6280 | } THUNK_CONTEXT;\r | |
6281 | \r | |
6282 | #define THUNK_ATTRIBUTE_BIG_REAL_MODE 0x00000001\r | |
6283 | #define THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 0x00000002\r | |
6284 | #define THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL 0x00000004\r | |
6285 | \r | |
6286 | /**\r | |
6287 | Retrieves CPUID information.\r | |
6288 | \r | |
6289 | Executes the CPUID instruction with EAX set to the value specified by Index.\r | |
6290 | This function always returns Index.\r | |
6291 | If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.\r | |
6292 | If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.\r | |
6293 | If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.\r | |
6294 | If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.\r | |
030cd1a2 | 6295 | This function is only available on IA-32 and x64.\r |
ac644614 | 6296 | \r |
6297 | @param Index The 32-bit value to load into EAX prior to invoking the CPUID\r | |
6298 | instruction.\r | |
af2dc6a7 | 6299 | @param Eax The pointer to the 32-bit EAX value returned by the CPUID\r |
ac644614 | 6300 | instruction. This is an optional parameter that may be NULL.\r |
af2dc6a7 | 6301 | @param Ebx The pointer to the 32-bit EBX value returned by the CPUID\r |
ac644614 | 6302 | instruction. This is an optional parameter that may be NULL.\r |
af2dc6a7 | 6303 | @param Ecx The pointer to the 32-bit ECX value returned by the CPUID\r |
ac644614 | 6304 | instruction. This is an optional parameter that may be NULL.\r |
af2dc6a7 | 6305 | @param Edx The pointer to the 32-bit EDX value returned by the CPUID\r |
ac644614 | 6306 | instruction. This is an optional parameter that may be NULL.\r |
6307 | \r | |
2fe241a2 | 6308 | @return Index.\r |
ac644614 | 6309 | \r |
6310 | **/\r | |
6311 | UINT32\r | |
6312 | EFIAPI\r | |
6313 | AsmCpuid (\r | |
6314 | IN UINT32 Index,\r | |
6315 | OUT UINT32 *Eax, OPTIONAL\r | |
6316 | OUT UINT32 *Ebx, OPTIONAL\r | |
6317 | OUT UINT32 *Ecx, OPTIONAL\r | |
6318 | OUT UINT32 *Edx OPTIONAL\r | |
6319 | );\r | |
6320 | \r | |
6321 | \r | |
6322 | /**\r | |
6323 | Retrieves CPUID information using an extended leaf identifier.\r | |
6324 | \r | |
6325 | Executes the CPUID instruction with EAX set to the value specified by Index\r | |
6326 | and ECX set to the value specified by SubIndex. This function always returns\r | |
6327 | Index. This function is only available on IA-32 and x64.\r | |
6328 | \r | |
6329 | If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.\r | |
6330 | If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.\r | |
6331 | If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.\r | |
6332 | If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.\r | |
6333 | \r | |
6334 | @param Index The 32-bit value to load into EAX prior to invoking the\r | |
6335 | CPUID instruction.\r | |
6336 | @param SubIndex The 32-bit value to load into ECX prior to invoking the\r | |
6337 | CPUID instruction.\r | |
af2dc6a7 | 6338 | @param Eax The pointer to the 32-bit EAX value returned by the CPUID\r |
ac644614 | 6339 | instruction. This is an optional parameter that may be\r |
6340 | NULL.\r | |
af2dc6a7 | 6341 | @param Ebx The pointer to the 32-bit EBX value returned by the CPUID\r |
ac644614 | 6342 | instruction. This is an optional parameter that may be\r |
6343 | NULL.\r | |
af2dc6a7 | 6344 | @param Ecx The pointer to the 32-bit ECX value returned by the CPUID\r |
ac644614 | 6345 | instruction. This is an optional parameter that may be\r |
6346 | NULL.\r | |
af2dc6a7 | 6347 | @param Edx The pointer to the 32-bit EDX value returned by the CPUID\r |
ac644614 | 6348 | instruction. This is an optional parameter that may be\r |
6349 | NULL.\r | |
6350 | \r | |
2fe241a2 | 6351 | @return Index.\r |
ac644614 | 6352 | \r |
6353 | **/\r | |
6354 | UINT32\r | |
6355 | EFIAPI\r | |
6356 | AsmCpuidEx (\r | |
6357 | IN UINT32 Index,\r | |
6358 | IN UINT32 SubIndex,\r | |
6359 | OUT UINT32 *Eax, OPTIONAL\r | |
6360 | OUT UINT32 *Ebx, OPTIONAL\r | |
6361 | OUT UINT32 *Ecx, OPTIONAL\r | |
6362 | OUT UINT32 *Edx OPTIONAL\r | |
6363 | );\r | |
6364 | \r | |
6365 | \r | |
be5f1614 | 6366 | /**\r |
6367 | Set CD bit and clear NW bit of CR0 followed by a WBINVD.\r | |
6368 | \r | |
6369 | Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0,\r | |
6370 | and executing a WBINVD instruction. This function is only available on IA-32 and x64.\r | |
6371 | \r | |
6372 | **/\r | |
6373 | VOID\r | |
6374 | EFIAPI\r | |
6375 | AsmDisableCache (\r | |
6376 | VOID\r | |
6377 | );\r | |
6378 | \r | |
6379 | \r | |
6380 | /**\r | |
6381 | Perform a WBINVD and clear both the CD and NW bits of CR0.\r | |
6382 | \r | |
6383 | Enables the caches by executing a WBINVD instruction and then clear both the CD and NW\r | |
6384 | bits of CR0 to 0. This function is only available on IA-32 and x64.\r | |
6385 | \r | |
6386 | **/\r | |
6387 | VOID\r | |
6388 | EFIAPI\r | |
6389 | AsmEnableCache (\r | |
6390 | VOID\r | |
6391 | );\r | |
6392 | \r | |
6393 | \r | |
ac644614 | 6394 | /**\r |
6395 | Returns the lower 32-bits of a Machine Specific Register(MSR).\r | |
6396 | \r | |
6397 | Reads and returns the lower 32-bits of the MSR specified by Index.\r | |
6398 | No parameter checking is performed on Index, and some Index values may cause\r | |
6399 | CPU exceptions. The caller must either guarantee that Index is valid, or the\r | |
6400 | caller must set up exception handlers to catch the exceptions. This function\r | |
030cd1a2 | 6401 | is only available on IA-32 and x64.\r |
ac644614 | 6402 | \r |
6403 | @param Index The 32-bit MSR index to read.\r | |
6404 | \r | |
6405 | @return The lower 32 bits of the MSR identified by Index.\r | |
6406 | \r | |
6407 | **/\r | |
6408 | UINT32\r | |
6409 | EFIAPI\r | |
6410 | AsmReadMsr32 (\r | |
6411 | IN UINT32 Index\r | |
6412 | );\r | |
6413 | \r | |
6414 | \r | |
6415 | /**\r | |
17f695ed | 6416 | Writes a 32-bit value to a Machine Specific Register(MSR), and returns the value.\r |
6417 | The upper 32-bits of the MSR are set to zero.\r | |
ac644614 | 6418 | \r |
6419 | Writes the 32-bit value specified by Value to the MSR specified by Index. The\r | |
6420 | upper 32-bits of the MSR write are set to zero. The 32-bit value written to\r | |
6421 | the MSR is returned. No parameter checking is performed on Index or Value,\r | |
6422 | and some of these may cause CPU exceptions. The caller must either guarantee\r | |
6423 | that Index and Value are valid, or the caller must establish proper exception\r | |
030cd1a2 | 6424 | handlers. This function is only available on IA-32 and x64.\r |
ac644614 | 6425 | \r |
6426 | @param Index The 32-bit MSR index to write.\r | |
6427 | @param Value The 32-bit value to write to the MSR.\r | |
6428 | \r | |
6429 | @return Value\r | |
6430 | \r | |
6431 | **/\r | |
6432 | UINT32\r | |
6433 | EFIAPI\r | |
6434 | AsmWriteMsr32 (\r | |
6435 | IN UINT32 Index,\r | |
6436 | IN UINT32 Value\r | |
6437 | );\r | |
6438 | \r | |
6439 | \r | |
6440 | /**\r | |
62991af2 | 6441 | Reads a 64-bit MSR, performs a bitwise OR on the lower 32-bits, and\r |
ac644614 | 6442 | writes the result back to the 64-bit MSR.\r |
6443 | \r | |
62991af2 | 6444 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 6445 | between the lower 32-bits of the read result and the value specified by\r |
6446 | OrData, and writes the result to the 64-bit MSR specified by Index. The lower\r | |
6447 | 32-bits of the value written to the MSR is returned. No parameter checking is\r | |
6448 | performed on Index or OrData, and some of these may cause CPU exceptions. The\r | |
6449 | caller must either guarantee that Index and OrData are valid, or the caller\r | |
6450 | must establish proper exception handlers. This function is only available on\r | |
030cd1a2 | 6451 | IA-32 and x64.\r |
ac644614 | 6452 | \r |
6453 | @param Index The 32-bit MSR index to write.\r | |
6454 | @param OrData The value to OR with the read value from the MSR.\r | |
6455 | \r | |
6456 | @return The lower 32-bit value written to the MSR.\r | |
6457 | \r | |
6458 | **/\r | |
6459 | UINT32\r | |
6460 | EFIAPI\r | |
6461 | AsmMsrOr32 (\r | |
6462 | IN UINT32 Index,\r | |
6463 | IN UINT32 OrData\r | |
6464 | );\r | |
6465 | \r | |
6466 | \r | |
6467 | /**\r | |
6468 | Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes\r | |
6469 | the result back to the 64-bit MSR.\r | |
6470 | \r | |
6471 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6472 | lower 32-bits of the read result and the value specified by AndData, and\r | |
6473 | writes the result to the 64-bit MSR specified by Index. The lower 32-bits of\r | |
6474 | the value written to the MSR is returned. No parameter checking is performed\r | |
6475 | on Index or AndData, and some of these may cause CPU exceptions. The caller\r | |
6476 | must either guarantee that Index and AndData are valid, or the caller must\r | |
6477 | establish proper exception handlers. This function is only available on IA-32\r | |
030cd1a2 | 6478 | and x64.\r |
ac644614 | 6479 | \r |
6480 | @param Index The 32-bit MSR index to write.\r | |
6481 | @param AndData The value to AND with the read value from the MSR.\r | |
6482 | \r | |
6483 | @return The lower 32-bit value written to the MSR.\r | |
6484 | \r | |
6485 | **/\r | |
6486 | UINT32\r | |
6487 | EFIAPI\r | |
6488 | AsmMsrAnd32 (\r | |
6489 | IN UINT32 Index,\r | |
6490 | IN UINT32 AndData\r | |
6491 | );\r | |
6492 | \r | |
6493 | \r | |
6494 | /**\r | |
62991af2 | 6495 | Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise OR\r |
ac644614 | 6496 | on the lower 32-bits, and writes the result back to the 64-bit MSR.\r |
6497 | \r | |
6498 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6499 | lower 32-bits of the read result and the value specified by AndData\r | |
62991af2 | 6500 | preserving the upper 32-bits, performs a bitwise OR between the\r |
ac644614 | 6501 | result of the AND operation and the value specified by OrData, and writes the\r |
6502 | result to the 64-bit MSR specified by Address. The lower 32-bits of the value\r | |
6503 | written to the MSR is returned. No parameter checking is performed on Index,\r | |
6504 | AndData, or OrData, and some of these may cause CPU exceptions. The caller\r | |
6505 | must either guarantee that Index, AndData, and OrData are valid, or the\r | |
6506 | caller must establish proper exception handlers. This function is only\r | |
030cd1a2 | 6507 | available on IA-32 and x64.\r |
ac644614 | 6508 | \r |
6509 | @param Index The 32-bit MSR index to write.\r | |
6510 | @param AndData The value to AND with the read value from the MSR.\r | |
6511 | @param OrData The value to OR with the result of the AND operation.\r | |
6512 | \r | |
6513 | @return The lower 32-bit value written to the MSR.\r | |
6514 | \r | |
6515 | **/\r | |
6516 | UINT32\r | |
6517 | EFIAPI\r | |
6518 | AsmMsrAndThenOr32 (\r | |
6519 | IN UINT32 Index,\r | |
6520 | IN UINT32 AndData,\r | |
6521 | IN UINT32 OrData\r | |
6522 | );\r | |
6523 | \r | |
6524 | \r | |
6525 | /**\r | |
6526 | Reads a bit field of an MSR.\r | |
6527 | \r | |
6528 | Reads the bit field in the lower 32-bits of a 64-bit MSR. The bit field is\r | |
6529 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
6530 | returned. The caller must either guarantee that Index is valid, or the caller\r | |
6531 | must set up exception handlers to catch the exceptions. This function is only\r | |
030cd1a2 | 6532 | available on IA-32 and x64.\r |
ac644614 | 6533 | \r |
6534 | If StartBit is greater than 31, then ASSERT().\r | |
6535 | If EndBit is greater than 31, then ASSERT().\r | |
6536 | If EndBit is less than StartBit, then ASSERT().\r | |
6537 | \r | |
6538 | @param Index The 32-bit MSR index to read.\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 | \r | |
6544 | @return The bit field read from the MSR.\r | |
6545 | \r | |
6546 | **/\r | |
6547 | UINT32\r | |
6548 | EFIAPI\r | |
6549 | AsmMsrBitFieldRead32 (\r | |
6550 | IN UINT32 Index,\r | |
6551 | IN UINTN StartBit,\r | |
6552 | IN UINTN EndBit\r | |
6553 | );\r | |
6554 | \r | |
6555 | \r | |
6556 | /**\r | |
6557 | Writes a bit field to an MSR.\r | |
6558 | \r | |
2fe241a2 | 6559 | Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit\r |
ac644614 | 6560 | field is specified by the StartBit and the EndBit. All other bits in the\r |
6561 | destination MSR are preserved. The lower 32-bits of the MSR written is\r | |
62991af2 | 6562 | returned. The caller must either guarantee that Index and the data written \r |
6563 | is valid, or the caller must set up exception handlers to catch the exceptions. \r | |
6564 | This function is only available on IA-32 and x64.\r | |
ac644614 | 6565 | \r |
6566 | If StartBit is greater than 31, then ASSERT().\r | |
6567 | If EndBit is greater than 31, then ASSERT().\r | |
6568 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6569 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6570 | \r |
6571 | @param Index The 32-bit MSR index to write.\r | |
6572 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6573 | Range 0..31.\r | |
6574 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6575 | Range 0..31.\r | |
6576 | @param Value New value of the bit field.\r | |
6577 | \r | |
6578 | @return The lower 32-bit of the value written to the MSR.\r | |
6579 | \r | |
6580 | **/\r | |
6581 | UINT32\r | |
6582 | EFIAPI\r | |
6583 | AsmMsrBitFieldWrite32 (\r | |
6584 | IN UINT32 Index,\r | |
6585 | IN UINTN StartBit,\r | |
6586 | IN UINTN EndBit,\r | |
6587 | IN UINT32 Value\r | |
6588 | );\r | |
6589 | \r | |
6590 | \r | |
6591 | /**\r | |
6592 | Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the\r | |
6593 | result back to the bit field in the 64-bit MSR.\r | |
6594 | \r | |
62991af2 | 6595 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 6596 | between the read result and the value specified by OrData, and writes the\r |
6597 | result to the 64-bit MSR specified by Index. The lower 32-bits of the value\r | |
6598 | written to the MSR are returned. Extra left bits in OrData are stripped. The\r | |
6599 | caller must either guarantee that Index and the data written is valid, or\r | |
6600 | the caller must set up exception handlers to catch the exceptions. This\r | |
030cd1a2 | 6601 | function is only available on IA-32 and x64.\r |
ac644614 | 6602 | \r |
6603 | If StartBit is greater than 31, then ASSERT().\r | |
6604 | If EndBit is greater than 31, then ASSERT().\r | |
6605 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6606 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6607 | \r |
6608 | @param Index The 32-bit MSR index to write.\r | |
6609 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6610 | Range 0..31.\r | |
6611 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6612 | Range 0..31.\r | |
6613 | @param OrData The value to OR with the read value from the MSR.\r | |
6614 | \r | |
6615 | @return The lower 32-bit of the value written to the MSR.\r | |
6616 | \r | |
6617 | **/\r | |
6618 | UINT32\r | |
6619 | EFIAPI\r | |
6620 | AsmMsrBitFieldOr32 (\r | |
6621 | IN UINT32 Index,\r | |
6622 | IN UINTN StartBit,\r | |
6623 | IN UINTN EndBit,\r | |
6624 | IN UINT32 OrData\r | |
6625 | );\r | |
6626 | \r | |
6627 | \r | |
6628 | /**\r | |
6629 | Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r | |
6630 | result back to the bit field in the 64-bit MSR.\r | |
6631 | \r | |
6632 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6633 | read result and the value specified by AndData, and writes the result to the\r | |
6634 | 64-bit MSR specified by Index. The lower 32-bits of the value written to the\r | |
6635 | MSR are returned. Extra left bits in AndData are stripped. The caller must\r | |
6636 | either guarantee that Index and the data written is valid, or the caller must\r | |
6637 | set up exception handlers to catch the exceptions. This function is only\r | |
030cd1a2 | 6638 | available on IA-32 and x64.\r |
ac644614 | 6639 | \r |
6640 | If StartBit is greater than 31, then ASSERT().\r | |
6641 | If EndBit is greater than 31, then ASSERT().\r | |
6642 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6643 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6644 | \r |
6645 | @param Index The 32-bit MSR index to write.\r | |
6646 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6647 | Range 0..31.\r | |
6648 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6649 | Range 0..31.\r | |
6650 | @param AndData The value to AND with the read value from the MSR.\r | |
6651 | \r | |
6652 | @return The lower 32-bit of the value written to the MSR.\r | |
6653 | \r | |
6654 | **/\r | |
6655 | UINT32\r | |
6656 | EFIAPI\r | |
6657 | AsmMsrBitFieldAnd32 (\r | |
6658 | IN UINT32 Index,\r | |
6659 | IN UINTN StartBit,\r | |
6660 | IN UINTN EndBit,\r | |
6661 | IN UINT32 AndData\r | |
6662 | );\r | |
6663 | \r | |
6664 | \r | |
6665 | /**\r | |
6666 | Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r | |
62991af2 | 6667 | bitwise OR, and writes the result back to the bit field in the\r |
ac644614 | 6668 | 64-bit MSR.\r |
6669 | \r | |
6670 | Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by a\r | |
62991af2 | 6671 | bitwise OR between the read result and the value specified by\r |
ac644614 | 6672 | AndData, and writes the result to the 64-bit MSR specified by Index. The\r |
6673 | lower 32-bits of the value written to the MSR are returned. Extra left bits\r | |
6674 | in both AndData and OrData are stripped. The caller must either guarantee\r | |
6675 | that Index and the data written is valid, or the caller must set up exception\r | |
6676 | handlers to catch the exceptions. This function is only available on IA-32\r | |
030cd1a2 | 6677 | and x64.\r |
ac644614 | 6678 | \r |
6679 | If StartBit is greater than 31, then ASSERT().\r | |
6680 | If EndBit is greater than 31, then ASSERT().\r | |
6681 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
6682 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
6683 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 6684 | \r |
6685 | @param Index The 32-bit MSR index to write.\r | |
6686 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6687 | Range 0..31.\r | |
6688 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6689 | Range 0..31.\r | |
6690 | @param AndData The value to AND with the read value from the MSR.\r | |
6691 | @param OrData The value to OR with the result of the AND operation.\r | |
6692 | \r | |
6693 | @return The lower 32-bit of the value written to the MSR.\r | |
6694 | \r | |
6695 | **/\r | |
6696 | UINT32\r | |
6697 | EFIAPI\r | |
6698 | AsmMsrBitFieldAndThenOr32 (\r | |
6699 | IN UINT32 Index,\r | |
6700 | IN UINTN StartBit,\r | |
6701 | IN UINTN EndBit,\r | |
6702 | IN UINT32 AndData,\r | |
6703 | IN UINT32 OrData\r | |
6704 | );\r | |
6705 | \r | |
6706 | \r | |
6707 | /**\r | |
6708 | Returns a 64-bit Machine Specific Register(MSR).\r | |
6709 | \r | |
6710 | Reads and returns the 64-bit MSR specified by Index. No parameter checking is\r | |
6711 | performed on Index, and some Index values may cause CPU exceptions. The\r | |
6712 | caller must either guarantee that Index is valid, or the caller must set up\r | |
6713 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 6714 | on IA-32 and x64.\r |
ac644614 | 6715 | \r |
6716 | @param Index The 32-bit MSR index to read.\r | |
6717 | \r | |
6718 | @return The value of the MSR identified by Index.\r | |
6719 | \r | |
6720 | **/\r | |
6721 | UINT64\r | |
6722 | EFIAPI\r | |
6723 | AsmReadMsr64 (\r | |
6724 | IN UINT32 Index\r | |
6725 | );\r | |
6726 | \r | |
6727 | \r | |
6728 | /**\r | |
6729 | Writes a 64-bit value to a Machine Specific Register(MSR), and returns the\r | |
6730 | value.\r | |
6731 | \r | |
6732 | Writes the 64-bit value specified by Value to the MSR specified by Index. The\r | |
6733 | 64-bit value written to the MSR is returned. No parameter checking is\r | |
6734 | performed on Index or Value, and some of these may cause CPU exceptions. The\r | |
6735 | caller must either guarantee that Index and Value are valid, or the caller\r | |
6736 | must establish proper exception handlers. This function is only available on\r | |
030cd1a2 | 6737 | IA-32 and x64.\r |
ac644614 | 6738 | \r |
6739 | @param Index The 32-bit MSR index to write.\r | |
6740 | @param Value The 64-bit value to write to the MSR.\r | |
6741 | \r | |
6742 | @return Value\r | |
6743 | \r | |
6744 | **/\r | |
6745 | UINT64\r | |
6746 | EFIAPI\r | |
6747 | AsmWriteMsr64 (\r | |
6748 | IN UINT32 Index,\r | |
6749 | IN UINT64 Value\r | |
6750 | );\r | |
6751 | \r | |
6752 | \r | |
6753 | /**\r | |
62991af2 | 6754 | Reads a 64-bit MSR, performs a bitwise OR, and writes the result\r |
ac644614 | 6755 | back to the 64-bit MSR.\r |
6756 | \r | |
62991af2 | 6757 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 6758 | between the read result and the value specified by OrData, and writes the\r |
6759 | result to the 64-bit MSR specified by Index. The value written to the MSR is\r | |
6760 | returned. No parameter checking is performed on Index or OrData, and some of\r | |
6761 | these may cause CPU exceptions. The caller must either guarantee that Index\r | |
6762 | and OrData are valid, or the caller must establish proper exception handlers.\r | |
030cd1a2 | 6763 | This function is only available on IA-32 and x64.\r |
ac644614 | 6764 | \r |
6765 | @param Index The 32-bit MSR index to write.\r | |
6766 | @param OrData The value to OR with the read value from the MSR.\r | |
6767 | \r | |
6768 | @return The value written back to the MSR.\r | |
6769 | \r | |
6770 | **/\r | |
6771 | UINT64\r | |
6772 | EFIAPI\r | |
6773 | AsmMsrOr64 (\r | |
6774 | IN UINT32 Index,\r | |
6775 | IN UINT64 OrData\r | |
6776 | );\r | |
6777 | \r | |
6778 | \r | |
6779 | /**\r | |
6780 | Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the\r | |
6781 | 64-bit MSR.\r | |
6782 | \r | |
6783 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6784 | read result and the value specified by OrData, and writes the result to the\r | |
6785 | 64-bit MSR specified by Index. The value written to the MSR is returned. No\r | |
6786 | parameter checking is performed on Index or OrData, and some of these may\r | |
6787 | cause CPU exceptions. The caller must either guarantee that Index and OrData\r | |
6788 | are valid, or the caller must establish proper exception handlers. This\r | |
030cd1a2 | 6789 | function is only available on IA-32 and x64.\r |
ac644614 | 6790 | \r |
6791 | @param Index The 32-bit MSR index to write.\r | |
6792 | @param AndData The value to AND with the read value from the MSR.\r | |
6793 | \r | |
6794 | @return The value written back to the MSR.\r | |
6795 | \r | |
6796 | **/\r | |
6797 | UINT64\r | |
6798 | EFIAPI\r | |
6799 | AsmMsrAnd64 (\r | |
6800 | IN UINT32 Index,\r | |
6801 | IN UINT64 AndData\r | |
6802 | );\r | |
6803 | \r | |
6804 | \r | |
6805 | /**\r | |
62991af2 | 6806 | Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise \r |
ac644614 | 6807 | OR, and writes the result back to the 64-bit MSR.\r |
6808 | \r | |
6809 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between read\r | |
62991af2 | 6810 | result and the value specified by AndData, performs a bitwise OR\r |
ac644614 | 6811 | between the result of the AND operation and the value specified by OrData,\r |
6812 | and writes the result to the 64-bit MSR specified by Index. The value written\r | |
6813 | to the MSR is returned. No parameter checking is performed on Index, AndData,\r | |
6814 | or OrData, and some of these may cause CPU exceptions. The caller must either\r | |
6815 | guarantee that Index, AndData, and OrData are valid, or the caller must\r | |
6816 | establish proper exception handlers. This function is only available on IA-32\r | |
030cd1a2 | 6817 | and x64.\r |
ac644614 | 6818 | \r |
6819 | @param Index The 32-bit MSR index to write.\r | |
6820 | @param AndData The value to AND with the read value from the MSR.\r | |
6821 | @param OrData The value to OR with the result of the AND operation.\r | |
6822 | \r | |
6823 | @return The value written back to the MSR.\r | |
6824 | \r | |
6825 | **/\r | |
6826 | UINT64\r | |
6827 | EFIAPI\r | |
6828 | AsmMsrAndThenOr64 (\r | |
6829 | IN UINT32 Index,\r | |
6830 | IN UINT64 AndData,\r | |
6831 | IN UINT64 OrData\r | |
6832 | );\r | |
6833 | \r | |
6834 | \r | |
6835 | /**\r | |
6836 | Reads a bit field of an MSR.\r | |
6837 | \r | |
6838 | Reads the bit field in the 64-bit MSR. The bit field is specified by the\r | |
6839 | StartBit and the EndBit. The value of the bit field is returned. The caller\r | |
6840 | must either guarantee that Index is valid, or the caller must set up\r | |
6841 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 6842 | on IA-32 and x64.\r |
ac644614 | 6843 | \r |
6844 | If StartBit is greater than 63, then ASSERT().\r | |
6845 | If EndBit is greater than 63, then ASSERT().\r | |
6846 | If EndBit is less than StartBit, then ASSERT().\r | |
6847 | \r | |
6848 | @param Index The 32-bit MSR index to read.\r | |
6849 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6850 | Range 0..63.\r | |
6851 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6852 | Range 0..63.\r | |
6853 | \r | |
6854 | @return The value read from the MSR.\r | |
6855 | \r | |
6856 | **/\r | |
6857 | UINT64\r | |
6858 | EFIAPI\r | |
6859 | AsmMsrBitFieldRead64 (\r | |
6860 | IN UINT32 Index,\r | |
6861 | IN UINTN StartBit,\r | |
6862 | IN UINTN EndBit\r | |
6863 | );\r | |
6864 | \r | |
6865 | \r | |
6866 | /**\r | |
6867 | Writes a bit field to an MSR.\r | |
6868 | \r | |
6869 | Writes Value to a bit field in a 64-bit MSR. The bit field is specified by\r | |
6870 | the StartBit and the EndBit. All other bits in the destination MSR are\r | |
62991af2 | 6871 | preserved. The MSR written is returned. The caller must either guarantee \r |
6872 | that Index and the data written is valid, or the caller must set up exception \r | |
6873 | handlers to catch the exceptions. This function is only available on IA-32 and x64.\r | |
ac644614 | 6874 | \r |
6875 | If StartBit is greater than 63, then ASSERT().\r | |
6876 | If EndBit is greater than 63, then ASSERT().\r | |
6877 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6878 | If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6879 | \r |
6880 | @param Index The 32-bit MSR index to write.\r | |
6881 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6882 | Range 0..63.\r | |
6883 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6884 | Range 0..63.\r | |
6885 | @param Value New value of the bit field.\r | |
6886 | \r | |
6887 | @return The value written back to the MSR.\r | |
6888 | \r | |
6889 | **/\r | |
6890 | UINT64\r | |
6891 | EFIAPI\r | |
6892 | AsmMsrBitFieldWrite64 (\r | |
6893 | IN UINT32 Index,\r | |
6894 | IN UINTN StartBit,\r | |
6895 | IN UINTN EndBit,\r | |
6896 | IN UINT64 Value\r | |
6897 | );\r | |
6898 | \r | |
6899 | \r | |
6900 | /**\r | |
62991af2 | 6901 | Reads a bit field in a 64-bit MSR, performs a bitwise OR, and\r |
ac644614 | 6902 | writes the result back to the bit field in the 64-bit MSR.\r |
6903 | \r | |
62991af2 | 6904 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 6905 | between the read result and the value specified by OrData, and writes the\r |
6906 | result to the 64-bit MSR specified by Index. The value written to the MSR is\r | |
6907 | returned. Extra left bits in OrData are stripped. The caller must either\r | |
6908 | guarantee that Index and the data written is valid, or the caller must set up\r | |
6909 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 6910 | on IA-32 and x64.\r |
ac644614 | 6911 | \r |
6912 | If StartBit is greater than 63, then ASSERT().\r | |
6913 | If EndBit is greater than 63, then ASSERT().\r | |
6914 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6915 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6916 | \r |
6917 | @param Index The 32-bit MSR index to write.\r | |
6918 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6919 | Range 0..63.\r | |
6920 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6921 | Range 0..63.\r | |
6922 | @param OrData The value to OR with the read value from the bit field.\r | |
6923 | \r | |
6924 | @return The value written back to the MSR.\r | |
6925 | \r | |
6926 | **/\r | |
6927 | UINT64\r | |
6928 | EFIAPI\r | |
6929 | AsmMsrBitFieldOr64 (\r | |
6930 | IN UINT32 Index,\r | |
6931 | IN UINTN StartBit,\r | |
6932 | IN UINTN EndBit,\r | |
6933 | IN UINT64 OrData\r | |
6934 | );\r | |
6935 | \r | |
6936 | \r | |
6937 | /**\r | |
6938 | Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r | |
6939 | result back to the bit field in the 64-bit MSR.\r | |
6940 | \r | |
6941 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
6942 | read result and the value specified by AndData, and writes the result to the\r | |
6943 | 64-bit MSR specified by Index. The value written to the MSR is returned.\r | |
6944 | Extra left bits in AndData are stripped. The caller must either guarantee\r | |
6945 | that Index and the data written is valid, or the caller must set up exception\r | |
6946 | handlers to catch the exceptions. This function is only available on IA-32\r | |
030cd1a2 | 6947 | and x64.\r |
ac644614 | 6948 | \r |
6949 | If StartBit is greater than 63, then ASSERT().\r | |
6950 | If EndBit is greater than 63, then ASSERT().\r | |
6951 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 | 6952 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
ac644614 | 6953 | \r |
6954 | @param Index The 32-bit MSR index to write.\r | |
6955 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6956 | Range 0..63.\r | |
6957 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6958 | Range 0..63.\r | |
6959 | @param AndData The value to AND with the read value from the bit field.\r | |
6960 | \r | |
6961 | @return The value written back to the MSR.\r | |
6962 | \r | |
6963 | **/\r | |
6964 | UINT64\r | |
6965 | EFIAPI\r | |
6966 | AsmMsrBitFieldAnd64 (\r | |
6967 | IN UINT32 Index,\r | |
6968 | IN UINTN StartBit,\r | |
6969 | IN UINTN EndBit,\r | |
6970 | IN UINT64 AndData\r | |
6971 | );\r | |
6972 | \r | |
6973 | \r | |
6974 | /**\r | |
6975 | Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r | |
62991af2 | 6976 | bitwise OR, and writes the result back to the bit field in the\r |
ac644614 | 6977 | 64-bit MSR.\r |
6978 | \r | |
6979 | Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by\r | |
62991af2 | 6980 | a bitwise OR between the read result and the value specified by\r |
ac644614 | 6981 | AndData, and writes the result to the 64-bit MSR specified by Index. The\r |
6982 | value written to the MSR is returned. Extra left bits in both AndData and\r | |
6983 | OrData are stripped. The caller must either guarantee that Index and the data\r | |
6984 | written is valid, or the caller must set up exception handlers to catch the\r | |
030cd1a2 | 6985 | exceptions. This function is only available on IA-32 and x64.\r |
ac644614 | 6986 | \r |
6987 | If StartBit is greater than 63, then ASSERT().\r | |
6988 | If EndBit is greater than 63, then ASSERT().\r | |
6989 | If EndBit is less than StartBit, then ASSERT().\r | |
94952554 LG |
6990 | If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r |
6991 | If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r | |
ac644614 | 6992 | \r |
6993 | @param Index The 32-bit MSR index to write.\r | |
6994 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
6995 | Range 0..63.\r | |
6996 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
6997 | Range 0..63.\r | |
6998 | @param AndData The value to AND with the read value from the bit field.\r | |
6999 | @param OrData The value to OR with the result of the AND operation.\r | |
7000 | \r | |
7001 | @return The value written back to the MSR.\r | |
7002 | \r | |
7003 | **/\r | |
7004 | UINT64\r | |
7005 | EFIAPI\r | |
7006 | AsmMsrBitFieldAndThenOr64 (\r | |
7007 | IN UINT32 Index,\r | |
7008 | IN UINTN StartBit,\r | |
7009 | IN UINTN EndBit,\r | |
7010 | IN UINT64 AndData,\r | |
7011 | IN UINT64 OrData\r | |
7012 | );\r | |
7013 | \r | |
7014 | \r | |
7015 | /**\r | |
7016 | Reads the current value of the EFLAGS register.\r | |
7017 | \r | |
7018 | Reads and returns the current value of the EFLAGS register. This function is\r | |
030cd1a2 | 7019 | only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a\r |
7020 | 64-bit value on x64.\r | |
ac644614 | 7021 | \r |
030cd1a2 | 7022 | @return EFLAGS on IA-32 or RFLAGS on x64.\r |
ac644614 | 7023 | \r |
7024 | **/\r | |
7025 | UINTN\r | |
7026 | EFIAPI\r | |
7027 | AsmReadEflags (\r | |
7028 | VOID\r | |
7029 | );\r | |
7030 | \r | |
7031 | \r | |
7032 | /**\r | |
7033 | Reads the current value of the Control Register 0 (CR0).\r | |
7034 | \r | |
7035 | Reads and returns the current value of CR0. This function is only available\r | |
030cd1a2 | 7036 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7037 | x64.\r | |
ac644614 | 7038 | \r |
7039 | @return The value of the Control Register 0 (CR0).\r | |
7040 | \r | |
7041 | **/\r | |
7042 | UINTN\r | |
7043 | EFIAPI\r | |
7044 | AsmReadCr0 (\r | |
7045 | VOID\r | |
7046 | );\r | |
7047 | \r | |
7048 | \r | |
7049 | /**\r | |
7050 | Reads the current value of the Control Register 2 (CR2).\r | |
7051 | \r | |
7052 | Reads and returns the current value of CR2. This function is only available\r | |
030cd1a2 | 7053 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7054 | x64.\r | |
ac644614 | 7055 | \r |
7056 | @return The value of the Control Register 2 (CR2).\r | |
7057 | \r | |
7058 | **/\r | |
7059 | UINTN\r | |
7060 | EFIAPI\r | |
7061 | AsmReadCr2 (\r | |
7062 | VOID\r | |
7063 | );\r | |
7064 | \r | |
7065 | \r | |
7066 | /**\r | |
7067 | Reads the current value of the Control Register 3 (CR3).\r | |
7068 | \r | |
7069 | Reads and returns the current value of CR3. This function is only available\r | |
030cd1a2 | 7070 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7071 | x64.\r | |
ac644614 | 7072 | \r |
7073 | @return The value of the Control Register 3 (CR3).\r | |
7074 | \r | |
7075 | **/\r | |
7076 | UINTN\r | |
7077 | EFIAPI\r | |
7078 | AsmReadCr3 (\r | |
7079 | VOID\r | |
7080 | );\r | |
7081 | \r | |
7082 | \r | |
7083 | /**\r | |
7084 | Reads the current value of the Control Register 4 (CR4).\r | |
7085 | \r | |
7086 | Reads and returns the current value of CR4. This function is only available\r | |
030cd1a2 | 7087 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7088 | x64.\r | |
ac644614 | 7089 | \r |
7090 | @return The value of the Control Register 4 (CR4).\r | |
7091 | \r | |
7092 | **/\r | |
7093 | UINTN\r | |
7094 | EFIAPI\r | |
7095 | AsmReadCr4 (\r | |
7096 | VOID\r | |
7097 | );\r | |
7098 | \r | |
7099 | \r | |
7100 | /**\r | |
7101 | Writes a value to Control Register 0 (CR0).\r | |
7102 | \r | |
7103 | Writes and returns a new value to CR0. This function is only available on\r | |
030cd1a2 | 7104 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7105 | \r |
7106 | @param Cr0 The value to write to CR0.\r | |
7107 | \r | |
7108 | @return The value written to CR0.\r | |
7109 | \r | |
7110 | **/\r | |
7111 | UINTN\r | |
7112 | EFIAPI\r | |
7113 | AsmWriteCr0 (\r | |
7114 | UINTN Cr0\r | |
7115 | );\r | |
7116 | \r | |
7117 | \r | |
7118 | /**\r | |
7119 | Writes a value to Control Register 2 (CR2).\r | |
7120 | \r | |
7121 | Writes and returns a new value to CR2. This function is only available on\r | |
030cd1a2 | 7122 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7123 | \r |
7124 | @param Cr2 The value to write to CR2.\r | |
7125 | \r | |
7126 | @return The value written to CR2.\r | |
7127 | \r | |
7128 | **/\r | |
7129 | UINTN\r | |
7130 | EFIAPI\r | |
7131 | AsmWriteCr2 (\r | |
7132 | UINTN Cr2\r | |
7133 | );\r | |
7134 | \r | |
7135 | \r | |
7136 | /**\r | |
7137 | Writes a value to Control Register 3 (CR3).\r | |
7138 | \r | |
7139 | Writes and returns a new value to CR3. This function is only available on\r | |
030cd1a2 | 7140 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7141 | \r |
7142 | @param Cr3 The value to write to CR3.\r | |
7143 | \r | |
7144 | @return The value written to CR3.\r | |
7145 | \r | |
7146 | **/\r | |
7147 | UINTN\r | |
7148 | EFIAPI\r | |
7149 | AsmWriteCr3 (\r | |
7150 | UINTN Cr3\r | |
7151 | );\r | |
7152 | \r | |
7153 | \r | |
7154 | /**\r | |
7155 | Writes a value to Control Register 4 (CR4).\r | |
7156 | \r | |
7157 | Writes and returns a new value to CR4. This function is only available on\r | |
030cd1a2 | 7158 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7159 | \r |
7160 | @param Cr4 The value to write to CR4.\r | |
7161 | \r | |
7162 | @return The value written to CR4.\r | |
7163 | \r | |
7164 | **/\r | |
7165 | UINTN\r | |
7166 | EFIAPI\r | |
7167 | AsmWriteCr4 (\r | |
7168 | UINTN Cr4\r | |
7169 | );\r | |
7170 | \r | |
7171 | \r | |
7172 | /**\r | |
7173 | Reads the current value of Debug Register 0 (DR0).\r | |
7174 | \r | |
7175 | Reads and returns the current value of DR0. This function is only available\r | |
030cd1a2 | 7176 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7177 | x64.\r | |
ac644614 | 7178 | \r |
7179 | @return The value of Debug Register 0 (DR0).\r | |
7180 | \r | |
7181 | **/\r | |
7182 | UINTN\r | |
7183 | EFIAPI\r | |
7184 | AsmReadDr0 (\r | |
7185 | VOID\r | |
7186 | );\r | |
7187 | \r | |
7188 | \r | |
7189 | /**\r | |
7190 | Reads the current value of Debug Register 1 (DR1).\r | |
7191 | \r | |
7192 | Reads and returns the current value of DR1. This function is only available\r | |
030cd1a2 | 7193 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7194 | x64.\r | |
ac644614 | 7195 | \r |
7196 | @return The value of Debug Register 1 (DR1).\r | |
7197 | \r | |
7198 | **/\r | |
7199 | UINTN\r | |
7200 | EFIAPI\r | |
7201 | AsmReadDr1 (\r | |
7202 | VOID\r | |
7203 | );\r | |
7204 | \r | |
7205 | \r | |
7206 | /**\r | |
7207 | Reads the current value of Debug Register 2 (DR2).\r | |
7208 | \r | |
7209 | Reads and returns the current value of DR2. This function is only available\r | |
030cd1a2 | 7210 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7211 | x64.\r | |
ac644614 | 7212 | \r |
7213 | @return The value of Debug Register 2 (DR2).\r | |
7214 | \r | |
7215 | **/\r | |
7216 | UINTN\r | |
7217 | EFIAPI\r | |
7218 | AsmReadDr2 (\r | |
7219 | VOID\r | |
7220 | );\r | |
7221 | \r | |
7222 | \r | |
7223 | /**\r | |
7224 | Reads the current value of Debug Register 3 (DR3).\r | |
7225 | \r | |
7226 | Reads and returns the current value of DR3. This function is only available\r | |
030cd1a2 | 7227 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7228 | x64.\r | |
ac644614 | 7229 | \r |
7230 | @return The value of Debug Register 3 (DR3).\r | |
7231 | \r | |
7232 | **/\r | |
7233 | UINTN\r | |
7234 | EFIAPI\r | |
7235 | AsmReadDr3 (\r | |
7236 | VOID\r | |
7237 | );\r | |
7238 | \r | |
7239 | \r | |
7240 | /**\r | |
7241 | Reads the current value of Debug Register 4 (DR4).\r | |
7242 | \r | |
7243 | Reads and returns the current value of DR4. This function is only available\r | |
030cd1a2 | 7244 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7245 | x64.\r | |
ac644614 | 7246 | \r |
7247 | @return The value of Debug Register 4 (DR4).\r | |
7248 | \r | |
7249 | **/\r | |
7250 | UINTN\r | |
7251 | EFIAPI\r | |
7252 | AsmReadDr4 (\r | |
7253 | VOID\r | |
7254 | );\r | |
7255 | \r | |
7256 | \r | |
7257 | /**\r | |
7258 | Reads the current value of Debug Register 5 (DR5).\r | |
7259 | \r | |
7260 | Reads and returns the current value of DR5. This function is only available\r | |
030cd1a2 | 7261 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7262 | x64.\r | |
ac644614 | 7263 | \r |
7264 | @return The value of Debug Register 5 (DR5).\r | |
7265 | \r | |
7266 | **/\r | |
7267 | UINTN\r | |
7268 | EFIAPI\r | |
7269 | AsmReadDr5 (\r | |
7270 | VOID\r | |
7271 | );\r | |
7272 | \r | |
7273 | \r | |
7274 | /**\r | |
7275 | Reads the current value of Debug Register 6 (DR6).\r | |
7276 | \r | |
7277 | Reads and returns the current value of DR6. This function is only available\r | |
030cd1a2 | 7278 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7279 | x64.\r | |
ac644614 | 7280 | \r |
7281 | @return The value of Debug Register 6 (DR6).\r | |
7282 | \r | |
7283 | **/\r | |
7284 | UINTN\r | |
7285 | EFIAPI\r | |
7286 | AsmReadDr6 (\r | |
7287 | VOID\r | |
7288 | );\r | |
7289 | \r | |
7290 | \r | |
7291 | /**\r | |
7292 | Reads the current value of Debug Register 7 (DR7).\r | |
7293 | \r | |
7294 | Reads and returns the current value of DR7. This function is only available\r | |
030cd1a2 | 7295 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
7296 | x64.\r | |
ac644614 | 7297 | \r |
7298 | @return The value of Debug Register 7 (DR7).\r | |
7299 | \r | |
7300 | **/\r | |
7301 | UINTN\r | |
7302 | EFIAPI\r | |
7303 | AsmReadDr7 (\r | |
7304 | VOID\r | |
7305 | );\r | |
7306 | \r | |
7307 | \r | |
7308 | /**\r | |
7309 | Writes a value to Debug Register 0 (DR0).\r | |
7310 | \r | |
7311 | Writes and returns a new value to DR0. This function is only available on\r | |
030cd1a2 | 7312 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7313 | \r |
7314 | @param Dr0 The value to write to Dr0.\r | |
7315 | \r | |
7316 | @return The value written to Debug Register 0 (DR0).\r | |
7317 | \r | |
7318 | **/\r | |
7319 | UINTN\r | |
7320 | EFIAPI\r | |
7321 | AsmWriteDr0 (\r | |
7322 | UINTN Dr0\r | |
7323 | );\r | |
7324 | \r | |
7325 | \r | |
7326 | /**\r | |
7327 | Writes a value to Debug Register 1 (DR1).\r | |
7328 | \r | |
7329 | Writes and returns a new value to DR1. This function is only available on\r | |
030cd1a2 | 7330 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7331 | \r |
7332 | @param Dr1 The value to write to Dr1.\r | |
7333 | \r | |
7334 | @return The value written to Debug Register 1 (DR1).\r | |
7335 | \r | |
7336 | **/\r | |
7337 | UINTN\r | |
7338 | EFIAPI\r | |
7339 | AsmWriteDr1 (\r | |
7340 | UINTN Dr1\r | |
7341 | );\r | |
7342 | \r | |
7343 | \r | |
7344 | /**\r | |
7345 | Writes a value to Debug Register 2 (DR2).\r | |
7346 | \r | |
7347 | Writes and returns a new value to DR2. This function is only available on\r | |
030cd1a2 | 7348 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7349 | \r |
7350 | @param Dr2 The value to write to Dr2.\r | |
7351 | \r | |
7352 | @return The value written to Debug Register 2 (DR2).\r | |
7353 | \r | |
7354 | **/\r | |
7355 | UINTN\r | |
7356 | EFIAPI\r | |
7357 | AsmWriteDr2 (\r | |
7358 | UINTN Dr2\r | |
7359 | );\r | |
7360 | \r | |
7361 | \r | |
7362 | /**\r | |
7363 | Writes a value to Debug Register 3 (DR3).\r | |
7364 | \r | |
7365 | Writes and returns a new value to DR3. This function is only available on\r | |
030cd1a2 | 7366 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7367 | \r |
7368 | @param Dr3 The value to write to Dr3.\r | |
7369 | \r | |
7370 | @return The value written to Debug Register 3 (DR3).\r | |
7371 | \r | |
7372 | **/\r | |
7373 | UINTN\r | |
7374 | EFIAPI\r | |
7375 | AsmWriteDr3 (\r | |
7376 | UINTN Dr3\r | |
7377 | );\r | |
7378 | \r | |
7379 | \r | |
7380 | /**\r | |
7381 | Writes a value to Debug Register 4 (DR4).\r | |
7382 | \r | |
7383 | Writes and returns a new value to DR4. This function is only available on\r | |
030cd1a2 | 7384 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7385 | \r |
7386 | @param Dr4 The value to write to Dr4.\r | |
7387 | \r | |
7388 | @return The value written to Debug Register 4 (DR4).\r | |
7389 | \r | |
7390 | **/\r | |
7391 | UINTN\r | |
7392 | EFIAPI\r | |
7393 | AsmWriteDr4 (\r | |
7394 | UINTN Dr4\r | |
7395 | );\r | |
7396 | \r | |
7397 | \r | |
7398 | /**\r | |
7399 | Writes a value to Debug Register 5 (DR5).\r | |
7400 | \r | |
7401 | Writes and returns a new value to DR5. This function is only available on\r | |
030cd1a2 | 7402 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7403 | \r |
7404 | @param Dr5 The value to write to Dr5.\r | |
7405 | \r | |
7406 | @return The value written to Debug Register 5 (DR5).\r | |
7407 | \r | |
7408 | **/\r | |
7409 | UINTN\r | |
7410 | EFIAPI\r | |
7411 | AsmWriteDr5 (\r | |
7412 | UINTN Dr5\r | |
7413 | );\r | |
7414 | \r | |
7415 | \r | |
7416 | /**\r | |
7417 | Writes a value to Debug Register 6 (DR6).\r | |
7418 | \r | |
7419 | Writes and returns a new value to DR6. This function is only available on\r | |
030cd1a2 | 7420 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7421 | \r |
7422 | @param Dr6 The value to write to Dr6.\r | |
7423 | \r | |
7424 | @return The value written to Debug Register 6 (DR6).\r | |
7425 | \r | |
7426 | **/\r | |
7427 | UINTN\r | |
7428 | EFIAPI\r | |
7429 | AsmWriteDr6 (\r | |
7430 | UINTN Dr6\r | |
7431 | );\r | |
7432 | \r | |
7433 | \r | |
7434 | /**\r | |
7435 | Writes a value to Debug Register 7 (DR7).\r | |
7436 | \r | |
7437 | Writes and returns a new value to DR7. This function is only available on\r | |
030cd1a2 | 7438 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 7439 | \r |
7440 | @param Dr7 The value to write to Dr7.\r | |
7441 | \r | |
7442 | @return The value written to Debug Register 7 (DR7).\r | |
7443 | \r | |
7444 | **/\r | |
7445 | UINTN\r | |
7446 | EFIAPI\r | |
7447 | AsmWriteDr7 (\r | |
7448 | UINTN Dr7\r | |
7449 | );\r | |
7450 | \r | |
7451 | \r | |
7452 | /**\r | |
7453 | Reads the current value of Code Segment Register (CS).\r | |
7454 | \r | |
7455 | Reads and returns the current value of CS. This function is only available on\r | |
030cd1a2 | 7456 | IA-32 and x64.\r |
ac644614 | 7457 | \r |
7458 | @return The current value of CS.\r | |
7459 | \r | |
7460 | **/\r | |
7461 | UINT16\r | |
7462 | EFIAPI\r | |
7463 | AsmReadCs (\r | |
7464 | VOID\r | |
7465 | );\r | |
7466 | \r | |
7467 | \r | |
7468 | /**\r | |
7469 | Reads the current value of Data Segment Register (DS).\r | |
7470 | \r | |
7471 | Reads and returns the current value of DS. This function is only available on\r | |
030cd1a2 | 7472 | IA-32 and x64.\r |
ac644614 | 7473 | \r |
7474 | @return The current value of DS.\r | |
7475 | \r | |
7476 | **/\r | |
7477 | UINT16\r | |
7478 | EFIAPI\r | |
7479 | AsmReadDs (\r | |
7480 | VOID\r | |
7481 | );\r | |
7482 | \r | |
7483 | \r | |
7484 | /**\r | |
7485 | Reads the current value of Extra Segment Register (ES).\r | |
7486 | \r | |
7487 | Reads and returns the current value of ES. This function is only available on\r | |
030cd1a2 | 7488 | IA-32 and x64.\r |
ac644614 | 7489 | \r |
7490 | @return The current value of ES.\r | |
7491 | \r | |
7492 | **/\r | |
7493 | UINT16\r | |
7494 | EFIAPI\r | |
7495 | AsmReadEs (\r | |
7496 | VOID\r | |
7497 | );\r | |
7498 | \r | |
7499 | \r | |
7500 | /**\r | |
7501 | Reads the current value of FS Data Segment Register (FS).\r | |
7502 | \r | |
7503 | Reads and returns the current value of FS. This function is only available on\r | |
030cd1a2 | 7504 | IA-32 and x64.\r |
ac644614 | 7505 | \r |
7506 | @return The current value of FS.\r | |
7507 | \r | |
7508 | **/\r | |
7509 | UINT16\r | |
7510 | EFIAPI\r | |
7511 | AsmReadFs (\r | |
7512 | VOID\r | |
7513 | );\r | |
7514 | \r | |
7515 | \r | |
7516 | /**\r | |
7517 | Reads the current value of GS Data Segment Register (GS).\r | |
7518 | \r | |
7519 | Reads and returns the current value of GS. This function is only available on\r | |
030cd1a2 | 7520 | IA-32 and x64.\r |
ac644614 | 7521 | \r |
7522 | @return The current value of GS.\r | |
7523 | \r | |
7524 | **/\r | |
7525 | UINT16\r | |
7526 | EFIAPI\r | |
7527 | AsmReadGs (\r | |
7528 | VOID\r | |
7529 | );\r | |
7530 | \r | |
7531 | \r | |
7532 | /**\r | |
7533 | Reads the current value of Stack Segment Register (SS).\r | |
7534 | \r | |
7535 | Reads and returns the current value of SS. This function is only available on\r | |
030cd1a2 | 7536 | IA-32 and x64.\r |
ac644614 | 7537 | \r |
7538 | @return The current value of SS.\r | |
7539 | \r | |
7540 | **/\r | |
7541 | UINT16\r | |
7542 | EFIAPI\r | |
7543 | AsmReadSs (\r | |
7544 | VOID\r | |
7545 | );\r | |
7546 | \r | |
7547 | \r | |
7548 | /**\r | |
7549 | Reads the current value of Task Register (TR).\r | |
7550 | \r | |
7551 | Reads and returns the current value of TR. This function is only available on\r | |
030cd1a2 | 7552 | IA-32 and x64.\r |
ac644614 | 7553 | \r |
7554 | @return The current value of TR.\r | |
7555 | \r | |
7556 | **/\r | |
7557 | UINT16\r | |
7558 | EFIAPI\r | |
7559 | AsmReadTr (\r | |
7560 | VOID\r | |
7561 | );\r | |
7562 | \r | |
7563 | \r | |
7564 | /**\r | |
7565 | Reads the current Global Descriptor Table Register(GDTR) descriptor.\r | |
7566 | \r | |
7567 | Reads and returns the current GDTR descriptor and returns it in Gdtr. This\r | |
030cd1a2 | 7568 | function is only available on IA-32 and x64.\r |
ac644614 | 7569 | \r |
7570 | If Gdtr is NULL, then ASSERT().\r | |
7571 | \r | |
af2dc6a7 | 7572 | @param Gdtr The pointer to a GDTR descriptor.\r |
ac644614 | 7573 | \r |
7574 | **/\r | |
7575 | VOID\r | |
7576 | EFIAPI\r | |
7577 | AsmReadGdtr (\r | |
7578 | OUT IA32_DESCRIPTOR *Gdtr\r | |
7579 | );\r | |
7580 | \r | |
7581 | \r | |
7582 | /**\r | |
7583 | Writes the current Global Descriptor Table Register (GDTR) descriptor.\r | |
7584 | \r | |
7585 | Writes and the current GDTR descriptor specified by Gdtr. This function is\r | |
030cd1a2 | 7586 | only available on IA-32 and x64.\r |
ac644614 | 7587 | \r |
7588 | If Gdtr is NULL, then ASSERT().\r | |
7589 | \r | |
af2dc6a7 | 7590 | @param Gdtr The pointer to a GDTR descriptor.\r |
ac644614 | 7591 | \r |
7592 | **/\r | |
7593 | VOID\r | |
7594 | EFIAPI\r | |
7595 | AsmWriteGdtr (\r | |
7596 | IN CONST IA32_DESCRIPTOR *Gdtr\r | |
7597 | );\r | |
7598 | \r | |
7599 | \r | |
7600 | /**\r | |
17f695ed | 7601 | Reads the current Interrupt Descriptor Table Register(IDTR) descriptor.\r |
ac644614 | 7602 | \r |
7603 | Reads and returns the current IDTR descriptor and returns it in Idtr. This\r | |
030cd1a2 | 7604 | function is only available on IA-32 and x64.\r |
ac644614 | 7605 | \r |
7606 | If Idtr is NULL, then ASSERT().\r | |
7607 | \r | |
af2dc6a7 | 7608 | @param Idtr The pointer to a IDTR descriptor.\r |
ac644614 | 7609 | \r |
7610 | **/\r | |
7611 | VOID\r | |
7612 | EFIAPI\r | |
7613 | AsmReadIdtr (\r | |
7614 | OUT IA32_DESCRIPTOR *Idtr\r | |
7615 | );\r | |
7616 | \r | |
7617 | \r | |
7618 | /**\r | |
17f695ed | 7619 | Writes the current Interrupt Descriptor Table Register(IDTR) descriptor.\r |
ac644614 | 7620 | \r |
7621 | Writes the current IDTR descriptor and returns it in Idtr. This function is\r | |
030cd1a2 | 7622 | only available on IA-32 and x64.\r |
ac644614 | 7623 | \r |
7624 | If Idtr is NULL, then ASSERT().\r | |
7625 | \r | |
af2dc6a7 | 7626 | @param Idtr The pointer to a IDTR descriptor.\r |
ac644614 | 7627 | \r |
7628 | **/\r | |
7629 | VOID\r | |
7630 | EFIAPI\r | |
7631 | AsmWriteIdtr (\r | |
7632 | IN CONST IA32_DESCRIPTOR *Idtr\r | |
7633 | );\r | |
7634 | \r | |
7635 | \r | |
7636 | /**\r | |
7637 | Reads the current Local Descriptor Table Register(LDTR) selector.\r | |
7638 | \r | |
7639 | Reads and returns the current 16-bit LDTR descriptor value. This function is\r | |
030cd1a2 | 7640 | only available on IA-32 and x64.\r |
ac644614 | 7641 | \r |
7642 | @return The current selector of LDT.\r | |
7643 | \r | |
7644 | **/\r | |
7645 | UINT16\r | |
7646 | EFIAPI\r | |
7647 | AsmReadLdtr (\r | |
7648 | VOID\r | |
7649 | );\r | |
7650 | \r | |
7651 | \r | |
7652 | /**\r | |
17f695ed | 7653 | Writes the current Local Descriptor Table Register (LDTR) selector.\r |
ac644614 | 7654 | \r |
7655 | Writes and the current LDTR descriptor specified by Ldtr. This function is\r | |
030cd1a2 | 7656 | only available on IA-32 and x64.\r |
ac644614 | 7657 | \r |
7658 | @param Ldtr 16-bit LDTR selector value.\r | |
7659 | \r | |
7660 | **/\r | |
7661 | VOID\r | |
7662 | EFIAPI\r | |
7663 | AsmWriteLdtr (\r | |
7664 | IN UINT16 Ldtr\r | |
7665 | );\r | |
7666 | \r | |
7667 | \r | |
7668 | /**\r | |
7669 | Save the current floating point/SSE/SSE2 context to a buffer.\r | |
7670 | \r | |
7671 | Saves the current floating point/SSE/SSE2 state to the buffer specified by\r | |
7672 | Buffer. Buffer must be aligned on a 16-byte boundary. This function is only\r | |
030cd1a2 | 7673 | available on IA-32 and x64.\r |
ac644614 | 7674 | \r |
7675 | If Buffer is NULL, then ASSERT().\r | |
7676 | If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
7677 | \r | |
af2dc6a7 | 7678 | @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.\r |
ac644614 | 7679 | \r |
7680 | **/\r | |
7681 | VOID\r | |
7682 | EFIAPI\r | |
7683 | AsmFxSave (\r | |
7684 | OUT IA32_FX_BUFFER *Buffer\r | |
7685 | );\r | |
7686 | \r | |
7687 | \r | |
7688 | /**\r | |
7689 | Restores the current floating point/SSE/SSE2 context from a buffer.\r | |
7690 | \r | |
7691 | Restores the current floating point/SSE/SSE2 state from the buffer specified\r | |
7692 | by Buffer. Buffer must be aligned on a 16-byte boundary. This function is\r | |
030cd1a2 | 7693 | only available on IA-32 and x64.\r |
ac644614 | 7694 | \r |
7695 | If Buffer is NULL, then ASSERT().\r | |
7696 | If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
7697 | If Buffer was not saved with AsmFxSave(), then ASSERT().\r | |
7698 | \r | |
af2dc6a7 | 7699 | @param Buffer The pointer to a buffer to save the floating point/SSE/SSE2 context.\r |
ac644614 | 7700 | \r |
7701 | **/\r | |
7702 | VOID\r | |
7703 | EFIAPI\r | |
7704 | AsmFxRestore (\r | |
7705 | IN CONST IA32_FX_BUFFER *Buffer\r | |
7706 | );\r | |
7707 | \r | |
7708 | \r | |
7709 | /**\r | |
7710 | Reads the current value of 64-bit MMX Register #0 (MM0).\r | |
7711 | \r | |
7712 | Reads and returns the current value of MM0. This function is only available\r | |
030cd1a2 | 7713 | on IA-32 and x64.\r |
ac644614 | 7714 | \r |
7715 | @return The current value of MM0.\r | |
7716 | \r | |
7717 | **/\r | |
7718 | UINT64\r | |
7719 | EFIAPI\r | |
7720 | AsmReadMm0 (\r | |
7721 | VOID\r | |
7722 | );\r | |
7723 | \r | |
7724 | \r | |
7725 | /**\r | |
7726 | Reads the current value of 64-bit MMX Register #1 (MM1).\r | |
7727 | \r | |
7728 | Reads and returns the current value of MM1. This function is only available\r | |
030cd1a2 | 7729 | on IA-32 and x64.\r |
ac644614 | 7730 | \r |
7731 | @return The current value of MM1.\r | |
7732 | \r | |
7733 | **/\r | |
7734 | UINT64\r | |
7735 | EFIAPI\r | |
7736 | AsmReadMm1 (\r | |
7737 | VOID\r | |
7738 | );\r | |
7739 | \r | |
7740 | \r | |
7741 | /**\r | |
7742 | Reads the current value of 64-bit MMX Register #2 (MM2).\r | |
7743 | \r | |
7744 | Reads and returns the current value of MM2. This function is only available\r | |
030cd1a2 | 7745 | on IA-32 and x64.\r |
ac644614 | 7746 | \r |
7747 | @return The current value of MM2.\r | |
7748 | \r | |
7749 | **/\r | |
7750 | UINT64\r | |
7751 | EFIAPI\r | |
7752 | AsmReadMm2 (\r | |
7753 | VOID\r | |
7754 | );\r | |
7755 | \r | |
7756 | \r | |
7757 | /**\r | |
7758 | Reads the current value of 64-bit MMX Register #3 (MM3).\r | |
7759 | \r | |
7760 | Reads and returns the current value of MM3. This function is only available\r | |
030cd1a2 | 7761 | on IA-32 and x64.\r |
ac644614 | 7762 | \r |
7763 | @return The current value of MM3.\r | |
7764 | \r | |
7765 | **/\r | |
7766 | UINT64\r | |
7767 | EFIAPI\r | |
7768 | AsmReadMm3 (\r | |
7769 | VOID\r | |
7770 | );\r | |
7771 | \r | |
7772 | \r | |
7773 | /**\r | |
7774 | Reads the current value of 64-bit MMX Register #4 (MM4).\r | |
7775 | \r | |
7776 | Reads and returns the current value of MM4. This function is only available\r | |
030cd1a2 | 7777 | on IA-32 and x64.\r |
ac644614 | 7778 | \r |
7779 | @return The current value of MM4.\r | |
7780 | \r | |
7781 | **/\r | |
7782 | UINT64\r | |
7783 | EFIAPI\r | |
7784 | AsmReadMm4 (\r | |
7785 | VOID\r | |
7786 | );\r | |
7787 | \r | |
7788 | \r | |
7789 | /**\r | |
7790 | Reads the current value of 64-bit MMX Register #5 (MM5).\r | |
7791 | \r | |
7792 | Reads and returns the current value of MM5. This function is only available\r | |
030cd1a2 | 7793 | on IA-32 and x64.\r |
ac644614 | 7794 | \r |
7795 | @return The current value of MM5.\r | |
7796 | \r | |
7797 | **/\r | |
7798 | UINT64\r | |
7799 | EFIAPI\r | |
7800 | AsmReadMm5 (\r | |
7801 | VOID\r | |
7802 | );\r | |
7803 | \r | |
7804 | \r | |
7805 | /**\r | |
7806 | Reads the current value of 64-bit MMX Register #6 (MM6).\r | |
7807 | \r | |
7808 | Reads and returns the current value of MM6. This function is only available\r | |
030cd1a2 | 7809 | on IA-32 and x64.\r |
ac644614 | 7810 | \r |
7811 | @return The current value of MM6.\r | |
7812 | \r | |
7813 | **/\r | |
7814 | UINT64\r | |
7815 | EFIAPI\r | |
7816 | AsmReadMm6 (\r | |
7817 | VOID\r | |
7818 | );\r | |
7819 | \r | |
7820 | \r | |
7821 | /**\r | |
7822 | Reads the current value of 64-bit MMX Register #7 (MM7).\r | |
7823 | \r | |
7824 | Reads and returns the current value of MM7. This function is only available\r | |
030cd1a2 | 7825 | on IA-32 and x64.\r |
ac644614 | 7826 | \r |
7827 | @return The current value of MM7.\r | |
7828 | \r | |
7829 | **/\r | |
7830 | UINT64\r | |
7831 | EFIAPI\r | |
7832 | AsmReadMm7 (\r | |
7833 | VOID\r | |
7834 | );\r | |
7835 | \r | |
7836 | \r | |
7837 | /**\r | |
7838 | Writes the current value of 64-bit MMX Register #0 (MM0).\r | |
7839 | \r | |
7840 | Writes the current value of MM0. This function is only available on IA32 and\r | |
030cd1a2 | 7841 | x64.\r |
ac644614 | 7842 | \r |
7843 | @param Value The 64-bit value to write to MM0.\r | |
7844 | \r | |
7845 | **/\r | |
7846 | VOID\r | |
7847 | EFIAPI\r | |
7848 | AsmWriteMm0 (\r | |
7849 | IN UINT64 Value\r | |
7850 | );\r | |
7851 | \r | |
7852 | \r | |
7853 | /**\r | |
7854 | Writes the current value of 64-bit MMX Register #1 (MM1).\r | |
7855 | \r | |
7856 | Writes the current value of MM1. This function is only available on IA32 and\r | |
030cd1a2 | 7857 | x64.\r |
ac644614 | 7858 | \r |
7859 | @param Value The 64-bit value to write to MM1.\r | |
7860 | \r | |
7861 | **/\r | |
7862 | VOID\r | |
7863 | EFIAPI\r | |
7864 | AsmWriteMm1 (\r | |
7865 | IN UINT64 Value\r | |
7866 | );\r | |
7867 | \r | |
7868 | \r | |
7869 | /**\r | |
7870 | Writes the current value of 64-bit MMX Register #2 (MM2).\r | |
7871 | \r | |
7872 | Writes the current value of MM2. This function is only available on IA32 and\r | |
030cd1a2 | 7873 | x64.\r |
ac644614 | 7874 | \r |
7875 | @param Value The 64-bit value to write to MM2.\r | |
7876 | \r | |
7877 | **/\r | |
7878 | VOID\r | |
7879 | EFIAPI\r | |
7880 | AsmWriteMm2 (\r | |
7881 | IN UINT64 Value\r | |
7882 | );\r | |
7883 | \r | |
7884 | \r | |
7885 | /**\r | |
7886 | Writes the current value of 64-bit MMX Register #3 (MM3).\r | |
7887 | \r | |
7888 | Writes the current value of MM3. This function is only available on IA32 and\r | |
030cd1a2 | 7889 | x64.\r |
ac644614 | 7890 | \r |
7891 | @param Value The 64-bit value to write to MM3.\r | |
7892 | \r | |
7893 | **/\r | |
7894 | VOID\r | |
7895 | EFIAPI\r | |
7896 | AsmWriteMm3 (\r | |
7897 | IN UINT64 Value\r | |
7898 | );\r | |
7899 | \r | |
7900 | \r | |
7901 | /**\r | |
7902 | Writes the current value of 64-bit MMX Register #4 (MM4).\r | |
7903 | \r | |
7904 | Writes the current value of MM4. This function is only available on IA32 and\r | |
030cd1a2 | 7905 | x64.\r |
ac644614 | 7906 | \r |
7907 | @param Value The 64-bit value to write to MM4.\r | |
7908 | \r | |
7909 | **/\r | |
7910 | VOID\r | |
7911 | EFIAPI\r | |
7912 | AsmWriteMm4 (\r | |
7913 | IN UINT64 Value\r | |
7914 | );\r | |
7915 | \r | |
7916 | \r | |
7917 | /**\r | |
7918 | Writes the current value of 64-bit MMX Register #5 (MM5).\r | |
7919 | \r | |
7920 | Writes the current value of MM5. This function is only available on IA32 and\r | |
030cd1a2 | 7921 | x64.\r |
ac644614 | 7922 | \r |
7923 | @param Value The 64-bit value to write to MM5.\r | |
7924 | \r | |
7925 | **/\r | |
7926 | VOID\r | |
7927 | EFIAPI\r | |
7928 | AsmWriteMm5 (\r | |
7929 | IN UINT64 Value\r | |
7930 | );\r | |
7931 | \r | |
7932 | \r | |
7933 | /**\r | |
7934 | Writes the current value of 64-bit MMX Register #6 (MM6).\r | |
7935 | \r | |
7936 | Writes the current value of MM6. This function is only available on IA32 and\r | |
030cd1a2 | 7937 | x64.\r |
ac644614 | 7938 | \r |
7939 | @param Value The 64-bit value to write to MM6.\r | |
7940 | \r | |
7941 | **/\r | |
7942 | VOID\r | |
7943 | EFIAPI\r | |
7944 | AsmWriteMm6 (\r | |
7945 | IN UINT64 Value\r | |
7946 | );\r | |
7947 | \r | |
7948 | \r | |
7949 | /**\r | |
7950 | Writes the current value of 64-bit MMX Register #7 (MM7).\r | |
7951 | \r | |
7952 | Writes the current value of MM7. This function is only available on IA32 and\r | |
030cd1a2 | 7953 | x64.\r |
ac644614 | 7954 | \r |
7955 | @param Value The 64-bit value to write to MM7.\r | |
7956 | \r | |
7957 | **/\r | |
7958 | VOID\r | |
7959 | EFIAPI\r | |
7960 | AsmWriteMm7 (\r | |
7961 | IN UINT64 Value\r | |
7962 | );\r | |
7963 | \r | |
7964 | \r | |
7965 | /**\r | |
7966 | Reads the current value of Time Stamp Counter (TSC).\r | |
7967 | \r | |
7968 | Reads and returns the current value of TSC. This function is only available\r | |
030cd1a2 | 7969 | on IA-32 and x64.\r |
ac644614 | 7970 | \r |
7971 | @return The current value of TSC\r | |
7972 | \r | |
7973 | **/\r | |
7974 | UINT64\r | |
7975 | EFIAPI\r | |
7976 | AsmReadTsc (\r | |
7977 | VOID\r | |
7978 | );\r | |
7979 | \r | |
7980 | \r | |
7981 | /**\r | |
7982 | Reads the current value of a Performance Counter (PMC).\r | |
7983 | \r | |
7984 | Reads and returns the current value of performance counter specified by\r | |
030cd1a2 | 7985 | Index. This function is only available on IA-32 and x64.\r |
ac644614 | 7986 | \r |
7987 | @param Index The 32-bit Performance Counter index to read.\r | |
7988 | \r | |
7989 | @return The value of the PMC specified by Index.\r | |
7990 | \r | |
7991 | **/\r | |
7992 | UINT64\r | |
7993 | EFIAPI\r | |
7994 | AsmReadPmc (\r | |
7995 | IN UINT32 Index\r | |
7996 | );\r | |
7997 | \r | |
7998 | \r | |
7999 | /**\r | |
8000 | Sets up a monitor buffer that is used by AsmMwait().\r | |
8001 | \r | |
8002 | Executes a MONITOR instruction with the register state specified by Eax, Ecx\r | |
030cd1a2 | 8003 | and Edx. Returns Eax. This function is only available on IA-32 and x64.\r |
ac644614 | 8004 | \r |
8005 | @param Eax The value to load into EAX or RAX before executing the MONITOR\r | |
8006 | instruction.\r | |
8007 | @param Ecx The value to load into ECX or RCX before executing the MONITOR\r | |
8008 | instruction.\r | |
8009 | @param Edx The value to load into EDX or RDX before executing the MONITOR\r | |
8010 | instruction.\r | |
8011 | \r | |
8012 | @return Eax\r | |
8013 | \r | |
8014 | **/\r | |
8015 | UINTN\r | |
8016 | EFIAPI\r | |
8017 | AsmMonitor (\r | |
8018 | IN UINTN Eax,\r | |
8019 | IN UINTN Ecx,\r | |
8020 | IN UINTN Edx\r | |
8021 | );\r | |
8022 | \r | |
8023 | \r | |
8024 | /**\r | |
8025 | Executes an MWAIT instruction.\r | |
8026 | \r | |
8027 | Executes an MWAIT instruction with the register state specified by Eax and\r | |
030cd1a2 | 8028 | Ecx. Returns Eax. This function is only available on IA-32 and x64.\r |
ac644614 | 8029 | \r |
8030 | @param Eax The value to load into EAX or RAX before executing the MONITOR\r | |
8031 | instruction.\r | |
8032 | @param Ecx The value to load into ECX or RCX before executing the MONITOR\r | |
8033 | instruction.\r | |
8034 | \r | |
8035 | @return Eax\r | |
8036 | \r | |
8037 | **/\r | |
8038 | UINTN\r | |
8039 | EFIAPI\r | |
8040 | AsmMwait (\r | |
8041 | IN UINTN Eax,\r | |
8042 | IN UINTN Ecx\r | |
8043 | );\r | |
8044 | \r | |
8045 | \r | |
8046 | /**\r | |
8047 | Executes a WBINVD instruction.\r | |
8048 | \r | |
8049 | Executes a WBINVD instruction. This function is only available on IA-32 and\r | |
030cd1a2 | 8050 | x64.\r |
ac644614 | 8051 | \r |
8052 | **/\r | |
8053 | VOID\r | |
8054 | EFIAPI\r | |
8055 | AsmWbinvd (\r | |
8056 | VOID\r | |
8057 | );\r | |
8058 | \r | |
8059 | \r | |
8060 | /**\r | |
8061 | Executes a INVD instruction.\r | |
8062 | \r | |
8063 | Executes a INVD instruction. This function is only available on IA-32 and\r | |
030cd1a2 | 8064 | x64.\r |
ac644614 | 8065 | \r |
8066 | **/\r | |
8067 | VOID\r | |
8068 | EFIAPI\r | |
8069 | AsmInvd (\r | |
8070 | VOID\r | |
8071 | );\r | |
8072 | \r | |
8073 | \r | |
8074 | /**\r | |
8075 | Flushes a cache line from all the instruction and data caches within the\r | |
8076 | coherency domain of the CPU.\r | |
8077 | \r | |
8078 | Flushed the cache line specified by LinearAddress, and returns LinearAddress.\r | |
030cd1a2 | 8079 | This function is only available on IA-32 and x64.\r |
ac644614 | 8080 | \r |
8081 | @param LinearAddress The address of the cache line to flush. If the CPU is\r | |
8082 | in a physical addressing mode, then LinearAddress is a\r | |
8083 | physical address. If the CPU is in a virtual\r | |
8084 | addressing mode, then LinearAddress is a virtual\r | |
8085 | address.\r | |
8086 | \r | |
af2dc6a7 | 8087 | @return LinearAddress.\r |
ac644614 | 8088 | **/\r |
8089 | VOID *\r | |
8090 | EFIAPI\r | |
8091 | AsmFlushCacheLine (\r | |
8092 | IN VOID *LinearAddress\r | |
8093 | );\r | |
8094 | \r | |
8095 | \r | |
8096 | /**\r | |
8097 | Enables the 32-bit paging mode on the CPU.\r | |
8098 | \r | |
8099 | Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
8100 | must be properly initialized prior to calling this service. This function\r | |
8101 | assumes the current execution mode is 32-bit protected mode. This function is\r | |
8102 | only available on IA-32. After the 32-bit paging mode is enabled, control is\r | |
8103 | transferred to the function specified by EntryPoint using the new stack\r | |
8104 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
8105 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
8106 | EntryPoint must never return.\r | |
8107 | \r | |
8108 | If the current execution mode is not 32-bit protected mode, then ASSERT().\r | |
8109 | If EntryPoint is NULL, then ASSERT().\r | |
8110 | If NewStack is NULL, then ASSERT().\r | |
8111 | \r | |
8112 | There are a number of constraints that must be followed before calling this\r | |
8113 | function:\r | |
8114 | 1) Interrupts must be disabled.\r | |
8115 | 2) The caller must be in 32-bit protected mode with flat descriptors. This\r | |
8116 | means all descriptors must have a base of 0 and a limit of 4GB.\r | |
8117 | 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat\r | |
8118 | descriptors.\r | |
8119 | 4) CR3 must point to valid page tables that will be used once the transition\r | |
8120 | is complete, and those page tables must guarantee that the pages for this\r | |
8121 | function and the stack are identity mapped.\r | |
8122 | \r | |
8123 | @param EntryPoint A pointer to function to call with the new stack after\r | |
8124 | paging is enabled.\r | |
8125 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
8126 | function as the first parameter after paging is enabled.\r | |
8127 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
8128 | function as the second parameter after paging is enabled.\r | |
8129 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
8130 | function after paging is enabled.\r | |
8131 | \r | |
8132 | **/\r | |
8133 | VOID\r | |
8134 | EFIAPI\r | |
8135 | AsmEnablePaging32 (\r | |
8136 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
8137 | IN VOID *Context1, OPTIONAL\r | |
8138 | IN VOID *Context2, OPTIONAL\r | |
8139 | IN VOID *NewStack\r | |
8140 | );\r | |
8141 | \r | |
8142 | \r | |
8143 | /**\r | |
8144 | Disables the 32-bit paging mode on the CPU.\r | |
8145 | \r | |
8146 | Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r | |
8147 | mode. This function assumes the current execution mode is 32-paged protected\r | |
8148 | mode. This function is only available on IA-32. After the 32-bit paging mode\r | |
8149 | is disabled, control is transferred to the function specified by EntryPoint\r | |
8150 | using the new stack specified by NewStack and passing in the parameters\r | |
8151 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
8152 | may be NULL. The function EntryPoint must never return.\r | |
8153 | \r | |
8154 | If the current execution mode is not 32-bit paged mode, then ASSERT().\r | |
8155 | If EntryPoint is NULL, then ASSERT().\r | |
8156 | If NewStack is NULL, then ASSERT().\r | |
8157 | \r | |
8158 | There are a number of constraints that must be followed before calling this\r | |
8159 | function:\r | |
8160 | 1) Interrupts must be disabled.\r | |
8161 | 2) The caller must be in 32-bit paged mode.\r | |
8162 | 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r | |
8163 | 4) CR3 must point to valid page tables that guarantee that the pages for\r | |
8164 | this function and the stack are identity mapped.\r | |
8165 | \r | |
8166 | @param EntryPoint A pointer to function to call with the new stack after\r | |
8167 | paging is disabled.\r | |
8168 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
8169 | function as the first parameter after paging is disabled.\r | |
8170 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
8171 | function as the second parameter after paging is\r | |
8172 | disabled.\r | |
8173 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
8174 | function after paging is disabled.\r | |
8175 | \r | |
8176 | **/\r | |
8177 | VOID\r | |
8178 | EFIAPI\r | |
8179 | AsmDisablePaging32 (\r | |
8180 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
8181 | IN VOID *Context1, OPTIONAL\r | |
8182 | IN VOID *Context2, OPTIONAL\r | |
8183 | IN VOID *NewStack\r | |
8184 | );\r | |
8185 | \r | |
8186 | \r | |
8187 | /**\r | |
8188 | Enables the 64-bit paging mode on the CPU.\r | |
8189 | \r | |
8190 | Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
8191 | must be properly initialized prior to calling this service. This function\r | |
8192 | assumes the current execution mode is 32-bit protected mode with flat\r | |
8193 | descriptors. This function is only available on IA-32. After the 64-bit\r | |
8194 | paging mode is enabled, control is transferred to the function specified by\r | |
8195 | EntryPoint using the new stack specified by NewStack and passing in the\r | |
8196 | parameters specified by Context1 and Context2. Context1 and Context2 are\r | |
8197 | optional and may be 0. The function EntryPoint must never return.\r | |
8198 | \r | |
8199 | If the current execution mode is not 32-bit protected mode with flat\r | |
8200 | descriptors, then ASSERT().\r | |
8201 | If EntryPoint is 0, then ASSERT().\r | |
8202 | If NewStack is 0, then ASSERT().\r | |
8203 | \r | |
17f695ed | 8204 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r |
ac644614 | 8205 | is called. The descriptor in the GDT that this selector\r |
8206 | references must be setup for long mode.\r | |
8207 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
8208 | the new stack after paging is enabled.\r | |
8209 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
8210 | the EntryPoint function as the first parameter after\r | |
8211 | paging is enabled.\r | |
8212 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
8213 | the EntryPoint function as the second parameter after\r | |
8214 | paging is enabled.\r | |
8215 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
8216 | the EntryPoint function after paging is enabled.\r | |
8217 | \r | |
8218 | **/\r | |
8219 | VOID\r | |
8220 | EFIAPI\r | |
8221 | AsmEnablePaging64 (\r | |
17f695ed | 8222 | IN UINT16 Cs,\r |
ac644614 | 8223 | IN UINT64 EntryPoint,\r |
8224 | IN UINT64 Context1, OPTIONAL\r | |
8225 | IN UINT64 Context2, OPTIONAL\r | |
8226 | IN UINT64 NewStack\r | |
8227 | );\r | |
8228 | \r | |
8229 | \r | |
8230 | /**\r | |
8231 | Disables the 64-bit paging mode on the CPU.\r | |
8232 | \r | |
8233 | Disables the 64-bit paging mode on the CPU and returns to 32-bit protected\r | |
8234 | mode. This function assumes the current execution mode is 64-paging mode.\r | |
030cd1a2 | 8235 | This function is only available on x64. After the 64-bit paging mode is\r |
ac644614 | 8236 | disabled, control is transferred to the function specified by EntryPoint\r |
8237 | using the new stack specified by NewStack and passing in the parameters\r | |
8238 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
8239 | may be 0. The function EntryPoint must never return.\r | |
8240 | \r | |
8241 | If the current execution mode is not 64-bit paged mode, then ASSERT().\r | |
8242 | If EntryPoint is 0, then ASSERT().\r | |
8243 | If NewStack is 0, then ASSERT().\r | |
8244 | \r | |
17f695ed | 8245 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r |
ac644614 | 8246 | is called. The descriptor in the GDT that this selector\r |
8247 | references must be setup for 32-bit protected mode.\r | |
8248 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
8249 | the new stack after paging is disabled.\r | |
8250 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
8251 | the EntryPoint function as the first parameter after\r | |
8252 | paging is disabled.\r | |
8253 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
8254 | the EntryPoint function as the second parameter after\r | |
8255 | paging is disabled.\r | |
8256 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
8257 | the EntryPoint function after paging is disabled.\r | |
8258 | \r | |
8259 | **/\r | |
8260 | VOID\r | |
8261 | EFIAPI\r | |
8262 | AsmDisablePaging64 (\r | |
17f695ed | 8263 | IN UINT16 Cs,\r |
ac644614 | 8264 | IN UINT32 EntryPoint,\r |
8265 | IN UINT32 Context1, OPTIONAL\r | |
8266 | IN UINT32 Context2, OPTIONAL\r | |
8267 | IN UINT32 NewStack\r | |
8268 | );\r | |
8269 | \r | |
8270 | \r | |
8271 | //\r | |
8272 | // 16-bit thunking services\r | |
8273 | //\r | |
8274 | \r | |
8275 | /**\r | |
8276 | Retrieves the properties for 16-bit thunk functions.\r | |
8277 | \r | |
8278 | Computes the size of the buffer and stack below 1MB required to use the\r | |
8279 | AsmPrepareThunk16(), AsmThunk16() and AsmPrepareAndThunk16() functions. This\r | |
8280 | buffer size is returned in RealModeBufferSize, and the stack size is returned\r | |
8281 | in ExtraStackSize. If parameters are passed to the 16-bit real mode code,\r | |
8282 | then the actual minimum stack size is ExtraStackSize plus the maximum number\r | |
8283 | of bytes that need to be passed to the 16-bit real mode code.\r | |
52fa075c | 8284 | \r |
ac644614 | 8285 | If RealModeBufferSize is NULL, then ASSERT().\r |
8286 | If ExtraStackSize is NULL, then ASSERT().\r | |
8287 | \r | |
8288 | @param RealModeBufferSize A pointer to the size of the buffer below 1MB\r | |
8289 | required to use the 16-bit thunk functions.\r | |
8290 | @param ExtraStackSize A pointer to the extra size of stack below 1MB\r | |
8291 | that the 16-bit thunk functions require for\r | |
8292 | temporary storage in the transition to and from\r | |
8293 | 16-bit real mode.\r | |
8294 | \r | |
8295 | **/\r | |
8296 | VOID\r | |
8297 | EFIAPI\r | |
8298 | AsmGetThunk16Properties (\r | |
8299 | OUT UINT32 *RealModeBufferSize,\r | |
8300 | OUT UINT32 *ExtraStackSize\r | |
8301 | );\r | |
8302 | \r | |
8303 | \r | |
8304 | /**\r | |
8305 | Prepares all structures a code required to use AsmThunk16().\r | |
8306 | \r | |
8307 | Prepares all structures and code required to use AsmThunk16().\r | |
52fa075c | 8308 | \r |
8243b089 | 8309 | This interface is limited to be used in either physical mode or virtual modes with paging enabled where the\r |
8310 | virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.\r | |
ac644614 | 8311 | \r |
8312 | If ThunkContext is NULL, then ASSERT().\r | |
8313 | \r | |
8314 | @param ThunkContext A pointer to the context structure that describes the\r | |
8315 | 16-bit real mode code to call.\r | |
8316 | \r | |
8317 | **/\r | |
8318 | VOID\r | |
8319 | EFIAPI\r | |
8320 | AsmPrepareThunk16 (\r | |
1445300f | 8321 | IN OUT THUNK_CONTEXT *ThunkContext\r |
ac644614 | 8322 | );\r |
8323 | \r | |
8324 | \r | |
8325 | /**\r | |
8326 | Transfers control to a 16-bit real mode entry point and returns the results.\r | |
8327 | \r | |
8328 | Transfers control to a 16-bit real mode entry point and returns the results.\r | |
17f695ed | 8329 | AsmPrepareThunk16() must be called with ThunkContext before this function is used.\r |
8330 | This function must be called with interrupts disabled.\r | |
8331 | \r | |
8332 | The register state from the RealModeState field of ThunkContext is restored just prior \r | |
8333 | to calling the 16-bit real mode entry point. This includes the EFLAGS field of RealModeState, \r | |
8334 | which is used to set the interrupt state when a 16-bit real mode entry point is called.\r | |
8335 | Control is transferred to the 16-bit real mode entry point specified by the CS and Eip fields of RealModeState.\r | |
8336 | The stack is initialized to the SS and ESP fields of RealModeState. Any parameters passed to \r | |
8337 | the 16-bit real mode code must be populated by the caller at SS:ESP prior to calling this function. \r | |
8338 | The 16-bit real mode entry point is invoked with a 16-bit CALL FAR instruction,\r | |
8339 | so when accessing stack contents, the 16-bit real mode code must account for the 16-bit segment \r | |
8340 | and 16-bit offset of the return address that were pushed onto the stack. The 16-bit real mode entry \r | |
8341 | point must exit with a RETF instruction. The register state is captured into RealModeState immediately \r | |
8342 | after the RETF instruction is executed.\r | |
8343 | \r | |
8344 | If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts, \r | |
8345 | or any of the 16-bit real mode code makes a SW interrupt, then the caller is responsible for making sure \r | |
8346 | the IDT at address 0 is initialized to handle any HW or SW interrupts that may occur while in 16-bit real mode. \r | |
8347 | \r | |
8348 | If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts, \r | |
8349 | then the caller is responsible for making sure the 8259 PIC is in a state compatible with 16-bit real mode. \r | |
8350 | This includes the base vectors, the interrupt masks, and the edge/level trigger mode.\r | |
8351 | \r | |
8352 | If THUNK_ATTRIBUTE_BIG_REAL_MODE is set in the ThunkAttributes field of ThunkContext, then the user code \r | |
8353 | is invoked in big real mode. Otherwise, the user code is invoked in 16-bit real mode with 64KB segment limits.\r | |
8354 | \r | |
8355 | If neither THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 nor THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in \r | |
8356 | ThunkAttributes, then it is assumed that the user code did not enable the A20 mask, and no attempt is made to \r | |
8357 | disable the A20 mask.\r | |
8358 | \r | |
8359 | If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is set and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is clear in \r | |
8360 | ThunkAttributes, then attempt to use the INT 15 service to disable the A20 mask. If this INT 15 call fails, \r | |
8361 | then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.\r | |
8362 | \r | |
8363 | If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is clear and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is set in \r | |
8364 | ThunkAttributes, then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.\r | |
8365 | \r | |
ac644614 | 8366 | If ThunkContext is NULL, then ASSERT().\r |
8367 | If AsmPrepareThunk16() was not previously called with ThunkContext, then ASSERT().\r | |
17f695ed | 8368 | If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in \r |
8369 | ThunkAttributes, then ASSERT().\r | |
ac644614 | 8370 | \r |
8243b089 | 8371 | This interface is limited to be used in either physical mode or virtual modes with paging enabled where the\r |
af2dc6a7 | 8372 | virtual to physical mappings for ThunkContext.RealModeBuffer are mapped 1:1.\r |
52fa075c | 8373 | \r |
ac644614 | 8374 | @param ThunkContext A pointer to the context structure that describes the\r |
8375 | 16-bit real mode code to call.\r | |
8376 | \r | |
8377 | **/\r | |
8378 | VOID\r | |
8379 | EFIAPI\r | |
8380 | AsmThunk16 (\r | |
8381 | IN OUT THUNK_CONTEXT *ThunkContext\r | |
8382 | );\r | |
8383 | \r | |
8384 | \r | |
8385 | /**\r | |
8386 | Prepares all structures and code for a 16-bit real mode thunk, transfers\r | |
8387 | control to a 16-bit real mode entry point, and returns the results.\r | |
8388 | \r | |
8389 | Prepares all structures and code for a 16-bit real mode thunk, transfers\r | |
8390 | control to a 16-bit real mode entry point, and returns the results. If the\r | |
8391 | caller only need to perform a single 16-bit real mode thunk, then this\r | |
8392 | service should be used. If the caller intends to make more than one 16-bit\r | |
8393 | real mode thunk, then it is more efficient if AsmPrepareThunk16() is called\r | |
8394 | once and AsmThunk16() can be called for each 16-bit real mode thunk.\r | |
8395 | \r | |
8243b089 | 8396 | This interface is limited to be used in either physical mode or virtual modes with paging enabled where the\r |
8397 | virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1.\r | |
52fa075c | 8398 | \r |
17f695ed | 8399 | See AsmPrepareThunk16() and AsmThunk16() for the detailed description and ASSERT() conditions.\r |
ac644614 | 8400 | \r |
8401 | @param ThunkContext A pointer to the context structure that describes the\r | |
8402 | 16-bit real mode code to call.\r | |
8403 | \r | |
8404 | **/\r | |
8405 | VOID\r | |
8406 | EFIAPI\r | |
8407 | AsmPrepareAndThunk16 (\r | |
8408 | IN OUT THUNK_CONTEXT *ThunkContext\r | |
8409 | );\r | |
8410 | \r | |
3cfc7813 QL |
8411 | /**\r |
8412 | Generates a 16-bit random number through RDRAND instruction.\r | |
8413 | \r | |
8414 | if Rand is NULL, then ASSERT().\r | |
8415 | \r | |
8416 | @param[out] Rand Buffer pointer to store the random result.\r | |
8417 | \r | |
8418 | @retval TRUE RDRAND call was successful.\r | |
8419 | @retval FALSE Failed attempts to call RDRAND.\r | |
8420 | \r | |
8421 | **/\r | |
8422 | BOOLEAN\r | |
8423 | EFIAPI\r | |
8424 | AsmRdRand16 (\r | |
8425 | OUT UINT16 *Rand\r | |
8426 | );\r | |
8427 | \r | |
8428 | /**\r | |
8429 | Generates a 32-bit random number through RDRAND instruction.\r | |
8430 | \r | |
8431 | if Rand is NULL, then ASSERT().\r | |
8432 | \r | |
8433 | @param[out] Rand Buffer pointer to store the random result.\r | |
8434 | \r | |
8435 | @retval TRUE RDRAND call was successful.\r | |
8436 | @retval FALSE Failed attempts to call RDRAND.\r | |
8437 | \r | |
8438 | **/\r | |
8439 | BOOLEAN\r | |
8440 | EFIAPI\r | |
8441 | AsmRdRand32 (\r | |
8442 | OUT UINT32 *Rand\r | |
8443 | );\r | |
8444 | \r | |
8445 | /**\r | |
8446 | Generates a 64-bit random number through RDRAND instruction.\r | |
8447 | \r | |
8448 | if Rand is NULL, then ASSERT().\r | |
8449 | \r | |
8450 | @param[out] Rand Buffer pointer to store the random result.\r | |
8451 | \r | |
8452 | @retval TRUE RDRAND call was successful.\r | |
8453 | @retval FALSE Failed attempts to call RDRAND.\r | |
8454 | \r | |
8455 | **/\r | |
8456 | BOOLEAN\r | |
8457 | EFIAPI\r | |
8458 | AsmRdRand64 (\r | |
8459 | OUT UINT64 *Rand\r | |
8460 | );\r | |
8461 | \r | |
ac644614 | 8462 | #endif\r |
e3a7917f | 8463 | #endif\r |
ac644614 | 8464 | \r |
8465 | \r |