]>
Commit | Line | Data |
---|---|---|
ac644614 | 1 | /** @file\r |
50a64e5b | 2 | Provides string functions, linked list functions, math functions, synchronization\r |
3 | functions, and CPU architecture specific functions.\r | |
ac644614 | 4 | \r |
2fe241a2 | 5 | Copyright (c) 2006 - 2008, Intel Corporation<BR>\r |
50a64e5b | 6 | All rights reserved. This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
ac644614 | 10 | \r |
50a64e5b | 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
ac644614 | 13 | \r |
14 | **/\r | |
15 | \r | |
16 | #ifndef __BASE_LIB__\r | |
17 | #define __BASE_LIB__\r | |
18 | \r | |
1106ffe1 | 19 | //\r |
20 | // Definitions for architecture specific types\r | |
21 | //\r | |
ac644614 | 22 | #if defined (MDE_CPU_IA32)\r |
fc30687f | 23 | ///\r |
24 | /// IA32 context buffer used by SetJump() and LongJump()\r | |
25 | ///\r | |
ac644614 | 26 | typedef struct {\r |
27 | UINT32 Ebx;\r | |
28 | UINT32 Esi;\r | |
29 | UINT32 Edi;\r | |
30 | UINT32 Ebp;\r | |
31 | UINT32 Esp;\r | |
32 | UINT32 Eip;\r | |
33 | } BASE_LIBRARY_JUMP_BUFFER;\r | |
34 | \r | |
35 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4\r | |
36 | \r | |
aa4df547 | 37 | #endif // defined (MDE_CPU_IA32)\r |
38 | \r | |
39 | #if defined (MDE_CPU_IPF)\r | |
ac644614 | 40 | \r |
fc30687f | 41 | ///\r |
42 | /// IPF context buffer used by SetJump() and LongJump()\r | |
43 | ///\r | |
ac644614 | 44 | typedef struct {\r |
45 | UINT64 F2[2];\r | |
46 | UINT64 F3[2];\r | |
47 | UINT64 F4[2];\r | |
48 | UINT64 F5[2];\r | |
49 | UINT64 F16[2];\r | |
50 | UINT64 F17[2];\r | |
51 | UINT64 F18[2];\r | |
52 | UINT64 F19[2];\r | |
53 | UINT64 F20[2];\r | |
54 | UINT64 F21[2];\r | |
55 | UINT64 F22[2];\r | |
56 | UINT64 F23[2];\r | |
57 | UINT64 F24[2];\r | |
58 | UINT64 F25[2];\r | |
59 | UINT64 F26[2];\r | |
60 | UINT64 F27[2];\r | |
61 | UINT64 F28[2];\r | |
62 | UINT64 F29[2];\r | |
63 | UINT64 F30[2];\r | |
64 | UINT64 F31[2];\r | |
65 | UINT64 R4;\r | |
66 | UINT64 R5;\r | |
67 | UINT64 R6;\r | |
68 | UINT64 R7;\r | |
69 | UINT64 SP;\r | |
70 | UINT64 BR0;\r | |
71 | UINT64 BR1;\r | |
72 | UINT64 BR2;\r | |
73 | UINT64 BR3;\r | |
74 | UINT64 BR4;\r | |
75 | UINT64 BR5;\r | |
76 | UINT64 InitialUNAT;\r | |
77 | UINT64 AfterSpillUNAT;\r | |
78 | UINT64 PFS;\r | |
79 | UINT64 BSP;\r | |
80 | UINT64 Predicates;\r | |
81 | UINT64 LoopCount;\r | |
82 | UINT64 FPSR;\r | |
83 | } BASE_LIBRARY_JUMP_BUFFER;\r | |
84 | \r | |
85 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 0x10\r | |
86 | \r | |
aa4df547 | 87 | #endif // defined (MDE_CPU_IPF)\r |
88 | \r | |
89 | #if defined (MDE_CPU_X64)\r | |
fc30687f | 90 | ///\r |
030cd1a2 | 91 | /// x64 context buffer used by SetJump() and LongJump()\r |
fc30687f | 92 | ///\r |
ac644614 | 93 | typedef struct {\r |
94 | UINT64 Rbx;\r | |
95 | UINT64 Rsp;\r | |
96 | UINT64 Rbp;\r | |
97 | UINT64 Rdi;\r | |
98 | UINT64 Rsi;\r | |
99 | UINT64 R12;\r | |
100 | UINT64 R13;\r | |
101 | UINT64 R14;\r | |
102 | UINT64 R15;\r | |
103 | UINT64 Rip;\r | |
104 | } BASE_LIBRARY_JUMP_BUFFER;\r | |
105 | \r | |
106 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8\r | |
107 | \r | |
aa4df547 | 108 | #endif // defined (MDE_CPU_X64)\r |
109 | \r | |
110 | #if defined (MDE_CPU_EBC)\r | |
fc30687f | 111 | ///\r |
112 | /// EBC context buffer used by SetJump() and LongJump()\r | |
113 | ///\r | |
ac644614 | 114 | typedef struct {\r |
115 | UINT64 R0;\r | |
116 | UINT64 R1;\r | |
117 | UINT64 R2;\r | |
118 | UINT64 R3;\r | |
119 | UINT64 IP;\r | |
120 | } BASE_LIBRARY_JUMP_BUFFER;\r | |
121 | \r | |
122 | #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8\r | |
123 | \r | |
aa4df547 | 124 | #endif // defined (MDE_CPU_EBC)\r |
ac644614 | 125 | \r |
126 | //\r | |
127 | // String Services\r | |
128 | //\r | |
129 | \r | |
130 | /**\r | |
131 | Copies one Null-terminated Unicode string to another Null-terminated Unicode\r | |
132 | string and returns the new Unicode string.\r | |
133 | \r | |
134 | This function copies the contents of the Unicode string Source to the Unicode\r | |
135 | string Destination, and returns Destination. If Source and Destination\r | |
136 | overlap, then the results are undefined.\r | |
137 | \r | |
138 | If Destination is NULL, then ASSERT().\r | |
139 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
140 | If Source is NULL, then ASSERT().\r | |
141 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
142 | If Source and Destination overlap, then ASSERT().\r | |
143 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
144 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
145 | Null-terminator, then ASSERT().\r | |
146 | \r | |
147 | @param Destination Pointer to a Null-terminated Unicode string.\r | |
148 | @param Source Pointer to a Null-terminated Unicode string.\r | |
149 | \r | |
9aa049d9 | 150 | @return Destination.\r |
ac644614 | 151 | \r |
152 | **/\r | |
153 | CHAR16 *\r | |
154 | EFIAPI\r | |
155 | StrCpy (\r | |
156 | OUT CHAR16 *Destination,\r | |
157 | IN CONST CHAR16 *Source\r | |
158 | );\r | |
159 | \r | |
160 | \r | |
161 | /**\r | |
17f695ed | 162 | Copies up to a specified length from one Null-terminated Unicode string to \r |
163 | another Null-terminated Unicode string and returns the new Unicode string.\r | |
ac644614 | 164 | \r |
165 | This function copies the contents of the Unicode string Source to the Unicode\r | |
166 | string Destination, and returns Destination. At most, Length Unicode\r | |
167 | characters are copied from Source to Destination. If Length is 0, then\r | |
168 | Destination is returned unmodified. If Length is greater that the number of\r | |
169 | Unicode characters in Source, then Destination is padded with Null Unicode\r | |
170 | characters. If Source and Destination overlap, then the results are\r | |
171 | undefined.\r | |
172 | \r | |
173 | If Length > 0 and Destination is NULL, then ASSERT().\r | |
174 | If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
175 | If Length > 0 and Source is NULL, then ASSERT().\r | |
77f863ee | 176 | If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 177 | If Source and Destination overlap, then ASSERT().\r |
178 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
179 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
180 | Null-terminator, then ASSERT().\r | |
181 | \r | |
182 | @param Destination Pointer to a Null-terminated Unicode string.\r | |
183 | @param Source Pointer to a Null-terminated Unicode string.\r | |
184 | @param Length Maximum number of Unicode characters to copy.\r | |
185 | \r | |
9aa049d9 | 186 | @return Destination.\r |
ac644614 | 187 | \r |
188 | **/\r | |
189 | CHAR16 *\r | |
190 | EFIAPI\r | |
191 | StrnCpy (\r | |
192 | OUT CHAR16 *Destination,\r | |
193 | IN CONST CHAR16 *Source,\r | |
194 | IN UINTN Length\r | |
195 | );\r | |
196 | \r | |
197 | \r | |
198 | /**\r | |
199 | Returns the length of a Null-terminated Unicode string.\r | |
200 | \r | |
201 | This function returns the number of Unicode characters in the Null-terminated\r | |
202 | Unicode string specified by String.\r | |
203 | \r | |
204 | If String is NULL, then ASSERT().\r | |
205 | If String is not aligned on a 16-bit boundary, then ASSERT().\r | |
206 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
207 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
208 | Null-terminator, then ASSERT().\r | |
209 | \r | |
210 | @param String Pointer to a Null-terminated Unicode string.\r | |
211 | \r | |
212 | @return The length of String.\r | |
213 | \r | |
214 | **/\r | |
215 | UINTN\r | |
216 | EFIAPI\r | |
217 | StrLen (\r | |
218 | IN CONST CHAR16 *String\r | |
219 | );\r | |
220 | \r | |
221 | \r | |
222 | /**\r | |
223 | Returns the size of a Null-terminated Unicode string in bytes, including the\r | |
224 | Null terminator.\r | |
225 | \r | |
17f695ed | 226 | This function returns the size, in bytes, of the Null-terminated Unicode string \r |
227 | specified by String.\r | |
ac644614 | 228 | \r |
229 | If String is NULL, then ASSERT().\r | |
230 | If String is not aligned on a 16-bit boundary, then ASSERT().\r | |
231 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
232 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
233 | Null-terminator, then ASSERT().\r | |
234 | \r | |
235 | @param String Pointer to a Null-terminated Unicode string.\r | |
236 | \r | |
237 | @return The size of String.\r | |
238 | \r | |
239 | **/\r | |
240 | UINTN\r | |
241 | EFIAPI\r | |
242 | StrSize (\r | |
243 | IN CONST CHAR16 *String\r | |
244 | );\r | |
245 | \r | |
246 | \r | |
247 | /**\r | |
248 | Compares two Null-terminated Unicode strings, and returns the difference\r | |
249 | between the first mismatched Unicode characters.\r | |
250 | \r | |
251 | This function compares the Null-terminated Unicode string FirstString to the\r | |
252 | Null-terminated Unicode string SecondString. If FirstString is identical to\r | |
253 | SecondString, then 0 is returned. Otherwise, the value returned is the first\r | |
254 | mismatched Unicode character in SecondString subtracted from the first\r | |
255 | mismatched Unicode character in FirstString.\r | |
256 | \r | |
257 | If FirstString is NULL, then ASSERT().\r | |
258 | If FirstString is not aligned on a 16-bit boundary, then ASSERT().\r | |
259 | If SecondString is NULL, then ASSERT().\r | |
260 | If SecondString is not aligned on a 16-bit boundary, then ASSERT().\r | |
261 | If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more\r | |
262 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
263 | Null-terminator, then ASSERT().\r | |
264 | If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more\r | |
265 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
266 | Null-terminator, then ASSERT().\r | |
267 | \r | |
268 | @param FirstString Pointer to a Null-terminated Unicode string.\r | |
269 | @param SecondString Pointer to a Null-terminated Unicode string.\r | |
270 | \r | |
1106ffe1 | 271 | @retval 0 FirstString is identical to SecondString.\r |
272 | @return others FirstString is not identical to SecondString.\r | |
ac644614 | 273 | \r |
274 | **/\r | |
275 | INTN\r | |
276 | EFIAPI\r | |
277 | StrCmp (\r | |
278 | IN CONST CHAR16 *FirstString,\r | |
279 | IN CONST CHAR16 *SecondString\r | |
280 | );\r | |
281 | \r | |
282 | \r | |
283 | /**\r | |
17f695ed | 284 | Compares up to a specified length the contents of two Null-terminated Unicode strings,\r |
285 | and returns the difference between the first mismatched Unicode characters.\r | |
286 | \r | |
ac644614 | 287 | This function compares the Null-terminated Unicode string FirstString to the\r |
288 | Null-terminated Unicode string SecondString. At most, Length Unicode\r | |
289 | characters will be compared. If Length is 0, then 0 is returned. If\r | |
290 | FirstString is identical to SecondString, then 0 is returned. Otherwise, the\r | |
291 | value returned is the first mismatched Unicode character in SecondString\r | |
292 | subtracted from the first mismatched Unicode character in FirstString.\r | |
293 | \r | |
294 | If Length > 0 and FirstString is NULL, then ASSERT().\r | |
77f863ee | 295 | If Length > 0 and FirstString is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 296 | If Length > 0 and SecondString is NULL, then ASSERT().\r |
77f863ee | 297 | If Length > 0 and SecondString is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 298 | If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more\r |
299 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
300 | Null-terminator, then ASSERT().\r | |
301 | If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more\r | |
302 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
303 | Null-terminator, then ASSERT().\r | |
304 | \r | |
305 | @param FirstString Pointer to a Null-terminated Unicode string.\r | |
306 | @param SecondString Pointer to a Null-terminated Unicode string.\r | |
307 | @param Length Maximum number of Unicode characters to compare.\r | |
308 | \r | |
1106ffe1 | 309 | @retval 0 FirstString is identical to SecondString.\r |
310 | @return others FirstString is not identical to SecondString.\r | |
ac644614 | 311 | \r |
312 | **/\r | |
313 | INTN\r | |
314 | EFIAPI\r | |
315 | StrnCmp (\r | |
316 | IN CONST CHAR16 *FirstString,\r | |
317 | IN CONST CHAR16 *SecondString,\r | |
318 | IN UINTN Length\r | |
319 | );\r | |
320 | \r | |
321 | \r | |
322 | /**\r | |
323 | Concatenates one Null-terminated Unicode string to another Null-terminated\r | |
324 | Unicode string, and returns the concatenated Unicode string.\r | |
325 | \r | |
326 | This function concatenates two Null-terminated Unicode strings. The contents\r | |
327 | of Null-terminated Unicode string Source are concatenated to the end of\r | |
328 | Null-terminated Unicode string Destination. The Null-terminated concatenated\r | |
329 | Unicode String is returned. If Source and Destination overlap, then the\r | |
330 | results are undefined.\r | |
331 | \r | |
332 | If Destination is NULL, then ASSERT().\r | |
77f863ee | 333 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 334 | If Source is NULL, then ASSERT().\r |
77f863ee | 335 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r |
ac644614 | 336 | If Source and Destination overlap, then ASSERT().\r |
337 | If PcdMaximumUnicodeStringLength is not zero, and Destination contains more\r | |
338 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
339 | Null-terminator, then ASSERT().\r | |
340 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
341 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
342 | Null-terminator, then ASSERT().\r | |
343 | If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination\r | |
344 | and Source results in a Unicode string with more than\r | |
345 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
346 | Null-terminator, then ASSERT().\r | |
347 | \r | |
348 | @param Destination Pointer to a Null-terminated Unicode string.\r | |
349 | @param Source Pointer to a Null-terminated Unicode string.\r | |
350 | \r | |
9aa049d9 | 351 | @return Destination.\r |
ac644614 | 352 | \r |
353 | **/\r | |
354 | CHAR16 *\r | |
355 | EFIAPI\r | |
356 | StrCat (\r | |
357 | IN OUT CHAR16 *Destination,\r | |
358 | IN CONST CHAR16 *Source\r | |
359 | );\r | |
360 | \r | |
361 | \r | |
362 | /**\r | |
17f695ed | 363 | Concatenates up to a specified length one Null-terminated Unicode to the end \r |
364 | of another Null-terminated Unicode string, and returns the concatenated \r | |
ac644614 | 365 | Unicode string.\r |
366 | \r | |
367 | This function concatenates two Null-terminated Unicode strings. The contents\r | |
368 | of Null-terminated Unicode string Source are concatenated to the end of\r | |
369 | Null-terminated Unicode string Destination, and Destination is returned. At\r | |
370 | most, Length Unicode characters are concatenated from Source to the end of\r | |
371 | Destination, and Destination is always Null-terminated. If Length is 0, then\r | |
372 | Destination is returned unmodified. If Source and Destination overlap, then\r | |
373 | the results are undefined.\r | |
374 | \r | |
375 | If Destination is NULL, then ASSERT().\r | |
376 | If Length > 0 and Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
377 | If Length > 0 and Source is NULL, then ASSERT().\r | |
378 | If Length > 0 and Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
379 | If Source and Destination overlap, then ASSERT().\r | |
380 | If PcdMaximumUnicodeStringLength is not zero, and Destination contains more\r | |
381 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
382 | Null-terminator, then ASSERT().\r | |
383 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
384 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
385 | Null-terminator, then ASSERT().\r | |
386 | If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination\r | |
387 | and Source results in a Unicode string with more than\r | |
388 | PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
389 | Null-terminator, then ASSERT().\r | |
390 | \r | |
391 | @param Destination Pointer to a Null-terminated Unicode string.\r | |
392 | @param Source Pointer to a Null-terminated Unicode string.\r | |
393 | @param Length Maximum number of Unicode characters to concatenate from\r | |
394 | Source.\r | |
395 | \r | |
9aa049d9 | 396 | @return Destination.\r |
ac644614 | 397 | \r |
398 | **/\r | |
399 | CHAR16 *\r | |
400 | EFIAPI\r | |
401 | StrnCat (\r | |
402 | IN OUT CHAR16 *Destination,\r | |
403 | IN CONST CHAR16 *Source,\r | |
404 | IN UINTN Length\r | |
405 | );\r | |
406 | \r | |
407 | /**\r | |
9aa049d9 | 408 | Returns the first occurrence of a Null-terminated Unicode sub-string\r |
ac644614 | 409 | in a Null-terminated Unicode string.\r |
410 | \r | |
411 | This function scans the contents of the Null-terminated Unicode string\r | |
412 | specified by String and returns the first occurrence of SearchString.\r | |
413 | If SearchString is not found in String, then NULL is returned. If\r | |
414 | the length of SearchString is zero, then String is\r | |
415 | returned.\r | |
416 | \r | |
417 | If String is NULL, then ASSERT().\r | |
418 | If String is not aligned on a 16-bit boundary, then ASSERT().\r | |
419 | If SearchString is NULL, then ASSERT().\r | |
420 | If SearchString is not aligned on a 16-bit boundary, then ASSERT().\r | |
421 | \r | |
422 | If PcdMaximumUnicodeStringLength is not zero, and SearchString\r | |
423 | or String contains more than PcdMaximumUnicodeStringLength Unicode\r | |
424 | characters not including the Null-terminator, then ASSERT().\r | |
425 | \r | |
17f695ed | 426 | @param String Pointer to a Null-terminated Unicode string.\r |
427 | @param SearchString Pointer to a Null-terminated Unicode string to search for.\r | |
ac644614 | 428 | \r |
429 | @retval NULL If the SearchString does not appear in String.\r | |
1106ffe1 | 430 | @return others If there is a match.\r |
ac644614 | 431 | \r |
432 | **/\r | |
433 | CHAR16 *\r | |
434 | EFIAPI\r | |
435 | StrStr (\r | |
17f695ed | 436 | IN CONST CHAR16 *String,\r |
437 | IN CONST CHAR16 *SearchString\r | |
ac644614 | 438 | );\r |
439 | \r | |
440 | /**\r | |
441 | Convert a Null-terminated Unicode decimal string to a value of\r | |
442 | type UINTN.\r | |
443 | \r | |
444 | This function returns a value of type UINTN by interpreting the contents\r | |
445 | of the Unicode string specified by String as a decimal number. The format\r | |
446 | of the input Unicode string String is:\r | |
447 | \r | |
448 | [spaces] [decimal digits].\r | |
449 | \r | |
450 | The valid decimal digit character is in the range [0-9]. The\r | |
451 | function will ignore the pad space, which includes spaces or\r | |
452 | tab characters, before [decimal digits]. The running zero in the\r | |
453 | beginning of [decimal digits] will be ignored. Then, the function\r | |
454 | stops at the first character that is a not a valid decimal character\r | |
455 | or a Null-terminator, whichever one comes first.\r | |
456 | \r | |
457 | If String is NULL, then ASSERT().\r | |
458 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
459 | If String has only pad spaces, then 0 is returned.\r | |
460 | If String has no pad spaces or valid decimal digits,\r | |
461 | then 0 is returned.\r | |
462 | If the number represented by String overflows according\r | |
463 | to the range defined by UINTN, then ASSERT().\r | |
464 | \r | |
465 | If PcdMaximumUnicodeStringLength is not zero, and String contains\r | |
466 | more than PcdMaximumUnicodeStringLength Unicode characters not including\r | |
467 | the Null-terminator, then ASSERT().\r | |
468 | \r | |
17f695ed | 469 | @param String Pointer to a Null-terminated Unicode string.\r |
ac644614 | 470 | \r |
38bbd3d9 | 471 | @retval Value translated from String.\r |
ac644614 | 472 | \r |
473 | **/\r | |
474 | UINTN\r | |
475 | EFIAPI\r | |
476 | StrDecimalToUintn (\r | |
17f695ed | 477 | IN CONST CHAR16 *String\r |
ac644614 | 478 | );\r |
479 | \r | |
480 | /**\r | |
481 | Convert a Null-terminated Unicode decimal string to a value of\r | |
482 | type UINT64.\r | |
483 | \r | |
484 | This function returns a value of type UINT64 by interpreting the contents\r | |
485 | of the Unicode string specified by String as a decimal number. The format\r | |
486 | of the input Unicode string String is:\r | |
487 | \r | |
488 | [spaces] [decimal digits].\r | |
489 | \r | |
490 | The valid decimal digit character is in the range [0-9]. The\r | |
491 | function will ignore the pad space, which includes spaces or\r | |
492 | tab characters, before [decimal digits]. The running zero in the\r | |
493 | beginning of [decimal digits] will be ignored. Then, the function\r | |
494 | stops at the first character that is a not a valid decimal character\r | |
495 | or a Null-terminator, whichever one comes first.\r | |
496 | \r | |
497 | If String is NULL, then ASSERT().\r | |
498 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
499 | If String has only pad spaces, then 0 is returned.\r | |
500 | If String has no pad spaces or valid decimal digits,\r | |
501 | then 0 is returned.\r | |
502 | If the number represented by String overflows according\r | |
503 | to the range defined by UINT64, then ASSERT().\r | |
504 | \r | |
505 | If PcdMaximumUnicodeStringLength is not zero, and String contains\r | |
506 | more than PcdMaximumUnicodeStringLength Unicode characters not including\r | |
507 | the Null-terminator, then ASSERT().\r | |
508 | \r | |
17f695ed | 509 | @param String Pointer to a Null-terminated Unicode string.\r |
ac644614 | 510 | \r |
38bbd3d9 | 511 | @retval Value translated from String.\r |
ac644614 | 512 | \r |
513 | **/\r | |
514 | UINT64\r | |
515 | EFIAPI\r | |
516 | StrDecimalToUint64 (\r | |
17f695ed | 517 | IN CONST CHAR16 *String\r |
ac644614 | 518 | );\r |
519 | \r | |
520 | \r | |
521 | /**\r | |
522 | Convert a Null-terminated Unicode hexadecimal string to a value of type UINTN.\r | |
523 | \r | |
524 | This function returns a value of type UINTN by interpreting the contents\r | |
525 | of the Unicode string specified by String as a hexadecimal number.\r | |
526 | The format of the input Unicode string String is:\r | |
527 | \r | |
528 | [spaces][zeros][x][hexadecimal digits].\r | |
529 | \r | |
530 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
531 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.\r | |
532 | If "x" appears in the input string, it must be prefixed with at least one 0.\r | |
533 | The function will ignore the pad space, which includes spaces or tab characters,\r | |
534 | before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or\r | |
535 | [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the\r | |
536 | first valid hexadecimal digit. Then, the function stops at the first character that is\r | |
537 | a not a valid hexadecimal character or NULL, whichever one comes first.\r | |
538 | \r | |
539 | If String is NULL, then ASSERT().\r | |
540 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
541 | If String has only pad spaces, then zero is returned.\r | |
542 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits,\r | |
543 | then zero is returned.\r | |
544 | If the number represented by String overflows according to the range defined by\r | |
545 | UINTN, then ASSERT().\r | |
546 | \r | |
547 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
548 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,\r | |
549 | then ASSERT().\r | |
550 | \r | |
17f695ed | 551 | @param String Pointer to a Null-terminated Unicode string.\r |
ac644614 | 552 | \r |
38bbd3d9 | 553 | @retval Value translated from String.\r |
ac644614 | 554 | \r |
555 | **/\r | |
556 | UINTN\r | |
557 | EFIAPI\r | |
558 | StrHexToUintn (\r | |
17f695ed | 559 | IN CONST CHAR16 *String\r |
ac644614 | 560 | );\r |
561 | \r | |
562 | \r | |
563 | /**\r | |
564 | Convert a Null-terminated Unicode hexadecimal string to a value of type UINT64.\r | |
565 | \r | |
566 | This function returns a value of type UINT64 by interpreting the contents\r | |
567 | of the Unicode string specified by String as a hexadecimal number.\r | |
568 | The format of the input Unicode string String is\r | |
569 | \r | |
570 | [spaces][zeros][x][hexadecimal digits].\r | |
571 | \r | |
572 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
573 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix.\r | |
574 | If "x" appears in the input string, it must be prefixed with at least one 0.\r | |
575 | The function will ignore the pad space, which includes spaces or tab characters,\r | |
576 | before [zeros], [x] or [hexadecimal digit]. The running zero before [x] or\r | |
577 | [hexadecimal digit] will be ignored. Then, the decoding starts after [x] or the\r | |
578 | first valid hexadecimal digit. Then, the function stops at the first character that is\r | |
579 | a not a valid hexadecimal character or NULL, whichever one comes first.\r | |
580 | \r | |
581 | If String is NULL, then ASSERT().\r | |
582 | If String is not aligned in a 16-bit boundary, then ASSERT().\r | |
583 | If String has only pad spaces, then zero is returned.\r | |
584 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits,\r | |
585 | then zero is returned.\r | |
586 | If the number represented by String overflows according to the range defined by\r | |
587 | UINT64, then ASSERT().\r | |
588 | \r | |
589 | If PcdMaximumUnicodeStringLength is not zero, and String contains more than\r | |
590 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator,\r | |
591 | then ASSERT().\r | |
592 | \r | |
17f695ed | 593 | @param String Pointer to a Null-terminated Unicode string.\r |
ac644614 | 594 | \r |
38bbd3d9 | 595 | @retval Value translated from String.\r |
ac644614 | 596 | \r |
597 | **/\r | |
598 | UINT64\r | |
599 | EFIAPI\r | |
600 | StrHexToUint64 (\r | |
17f695ed | 601 | IN CONST CHAR16 *String\r |
ac644614 | 602 | );\r |
603 | \r | |
ac644614 | 604 | /**\r |
17f695ed | 605 | Convert a Null-terminated Unicode string to a Null-terminated\r |
ac644614 | 606 | ASCII string and returns the ASCII string.\r |
607 | \r | |
608 | This function converts the content of the Unicode string Source\r | |
609 | to the ASCII string Destination by copying the lower 8 bits of\r | |
610 | each Unicode character. It returns Destination.\r | |
611 | \r | |
612 | If any Unicode characters in Source contain non-zero value in\r | |
613 | the upper 8 bits, then ASSERT().\r | |
614 | \r | |
615 | If Destination is NULL, then ASSERT().\r | |
616 | If Source is NULL, then ASSERT().\r | |
617 | If Source is not aligned on a 16-bit boundary, then ASSERT().\r | |
618 | If Source and Destination overlap, then ASSERT().\r | |
619 | \r | |
620 | If PcdMaximumUnicodeStringLength is not zero, and Source contains\r | |
621 | more than PcdMaximumUnicodeStringLength Unicode characters not including\r | |
622 | the Null-terminator, then ASSERT().\r | |
623 | \r | |
624 | If PcdMaximumAsciiStringLength is not zero, and Source contains more\r | |
625 | than PcdMaximumAsciiStringLength Unicode characters not including the\r | |
626 | Null-terminator, then ASSERT().\r | |
627 | \r | |
628 | @param Source Pointer to a Null-terminated Unicode string.\r | |
629 | @param Destination Pointer to a Null-terminated ASCII string.\r | |
630 | \r | |
9aa049d9 | 631 | @return Destination.\r |
ac644614 | 632 | \r |
633 | **/\r | |
634 | CHAR8 *\r | |
635 | EFIAPI\r | |
636 | UnicodeStrToAsciiStr (\r | |
17f695ed | 637 | IN CONST CHAR16 *Source,\r |
638 | OUT CHAR8 *Destination\r | |
ac644614 | 639 | );\r |
640 | \r | |
641 | \r | |
642 | /**\r | |
643 | Copies one Null-terminated ASCII string to another Null-terminated ASCII\r | |
644 | string and returns the new ASCII string.\r | |
645 | \r | |
646 | This function copies the contents of the ASCII string Source to the ASCII\r | |
647 | string Destination, and returns Destination. If Source and Destination\r | |
648 | overlap, then the results are undefined.\r | |
649 | \r | |
650 | If Destination is NULL, then ASSERT().\r | |
651 | If Source is NULL, then ASSERT().\r | |
652 | If Source and Destination overlap, then ASSERT().\r | |
653 | If PcdMaximumAsciiStringLength is not zero and Source contains more than\r | |
654 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
655 | then ASSERT().\r | |
656 | \r | |
657 | @param Destination Pointer to a Null-terminated ASCII string.\r | |
658 | @param Source Pointer to a Null-terminated ASCII string.\r | |
659 | \r | |
660 | @return Destination\r | |
661 | \r | |
662 | **/\r | |
663 | CHAR8 *\r | |
664 | EFIAPI\r | |
665 | AsciiStrCpy (\r | |
666 | OUT CHAR8 *Destination,\r | |
667 | IN CONST CHAR8 *Source\r | |
668 | );\r | |
669 | \r | |
670 | \r | |
671 | /**\r | |
17f695ed | 672 | Copies up to a specified length one Null-terminated ASCII string to another \r |
673 | Null-terminated ASCII string and returns the new ASCII string.\r | |
ac644614 | 674 | \r |
675 | This function copies the contents of the ASCII string Source to the ASCII\r | |
676 | string Destination, and returns Destination. At most, Length ASCII characters\r | |
677 | are copied from Source to Destination. If Length is 0, then Destination is\r | |
678 | returned unmodified. If Length is greater that the number of ASCII characters\r | |
679 | in Source, then Destination is padded with Null ASCII characters. If Source\r | |
680 | and Destination overlap, then the results are undefined.\r | |
681 | \r | |
682 | If Destination is NULL, then ASSERT().\r | |
683 | If Source is NULL, then ASSERT().\r | |
684 | If Source and Destination overlap, then ASSERT().\r | |
685 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r | |
686 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
687 | then ASSERT().\r | |
688 | \r | |
689 | @param Destination Pointer to a Null-terminated ASCII string.\r | |
690 | @param Source Pointer to a Null-terminated ASCII string.\r | |
691 | @param Length Maximum number of ASCII characters to copy.\r | |
692 | \r | |
693 | @return Destination\r | |
694 | \r | |
695 | **/\r | |
696 | CHAR8 *\r | |
697 | EFIAPI\r | |
698 | AsciiStrnCpy (\r | |
699 | OUT CHAR8 *Destination,\r | |
700 | IN CONST CHAR8 *Source,\r | |
701 | IN UINTN Length\r | |
702 | );\r | |
703 | \r | |
704 | \r | |
705 | /**\r | |
706 | Returns the length of a Null-terminated ASCII string.\r | |
707 | \r | |
708 | This function returns the number of ASCII characters in the Null-terminated\r | |
709 | ASCII string specified by String.\r | |
710 | \r | |
711 | If Length > 0 and Destination is NULL, then ASSERT().\r | |
712 | If Length > 0 and Source is NULL, then ASSERT().\r | |
713 | If PcdMaximumAsciiStringLength is not zero and String contains more than\r | |
714 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
715 | then ASSERT().\r | |
716 | \r | |
717 | @param String Pointer to a Null-terminated ASCII string.\r | |
718 | \r | |
719 | @return The length of String.\r | |
720 | \r | |
721 | **/\r | |
722 | UINTN\r | |
723 | EFIAPI\r | |
724 | AsciiStrLen (\r | |
725 | IN CONST CHAR8 *String\r | |
726 | );\r | |
727 | \r | |
728 | \r | |
729 | /**\r | |
730 | Returns the size of a Null-terminated ASCII string in bytes, including the\r | |
731 | Null terminator.\r | |
732 | \r | |
733 | This function returns the size, in bytes, of the Null-terminated ASCII string\r | |
734 | specified by String.\r | |
735 | \r | |
736 | If String is NULL, then ASSERT().\r | |
737 | If PcdMaximumAsciiStringLength is not zero and String contains more than\r | |
738 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
739 | then ASSERT().\r | |
740 | \r | |
741 | @param String Pointer to a Null-terminated ASCII string.\r | |
742 | \r | |
743 | @return The size of String.\r | |
744 | \r | |
745 | **/\r | |
746 | UINTN\r | |
747 | EFIAPI\r | |
748 | AsciiStrSize (\r | |
749 | IN CONST CHAR8 *String\r | |
750 | );\r | |
751 | \r | |
752 | \r | |
753 | /**\r | |
754 | Compares two Null-terminated ASCII strings, and returns the difference\r | |
755 | between the first mismatched ASCII characters.\r | |
756 | \r | |
757 | This function compares the Null-terminated ASCII string FirstString to the\r | |
758 | Null-terminated ASCII string SecondString. If FirstString is identical to\r | |
759 | SecondString, then 0 is returned. Otherwise, the value returned is the first\r | |
760 | mismatched ASCII character in SecondString subtracted from the first\r | |
761 | mismatched ASCII character in FirstString.\r | |
762 | \r | |
763 | If FirstString is NULL, then ASSERT().\r | |
764 | If SecondString is NULL, then ASSERT().\r | |
765 | If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r | |
766 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
767 | then ASSERT().\r | |
768 | If PcdMaximumAsciiStringLength is not zero and SecondString contains more\r | |
769 | than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
770 | Null-terminator, then ASSERT().\r | |
771 | \r | |
772 | @param FirstString Pointer to a Null-terminated ASCII string.\r | |
773 | @param SecondString Pointer to a Null-terminated ASCII string.\r | |
774 | \r | |
17f695ed | 775 | @retval ==0 FirstString is identical to SecondString.\r |
776 | @retval !=0 FirstString is not identical to SecondString.\r | |
ac644614 | 777 | \r |
778 | **/\r | |
779 | INTN\r | |
780 | EFIAPI\r | |
781 | AsciiStrCmp (\r | |
782 | IN CONST CHAR8 *FirstString,\r | |
783 | IN CONST CHAR8 *SecondString\r | |
784 | );\r | |
785 | \r | |
786 | \r | |
787 | /**\r | |
788 | Performs a case insensitive comparison of two Null-terminated ASCII strings,\r | |
789 | and returns the difference between the first mismatched ASCII characters.\r | |
790 | \r | |
791 | This function performs a case insensitive comparison of the Null-terminated\r | |
792 | ASCII string FirstString to the Null-terminated ASCII string SecondString. If\r | |
793 | FirstString is identical to SecondString, then 0 is returned. Otherwise, the\r | |
794 | value returned is the first mismatched lower case ASCII character in\r | |
795 | SecondString subtracted from the first mismatched lower case ASCII character\r | |
796 | in FirstString.\r | |
797 | \r | |
798 | If FirstString is NULL, then ASSERT().\r | |
799 | If SecondString is NULL, then ASSERT().\r | |
800 | If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r | |
801 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
802 | then ASSERT().\r | |
803 | If PcdMaximumAsciiStringLength is not zero and SecondString contains more\r | |
804 | than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
805 | Null-terminator, then ASSERT().\r | |
806 | \r | |
807 | @param FirstString Pointer to a Null-terminated ASCII string.\r | |
808 | @param SecondString Pointer to a Null-terminated ASCII string.\r | |
809 | \r | |
17f695ed | 810 | @retval ==0 FirstString is identical to SecondString using case insensitive\r |
1106ffe1 | 811 | comparisons.\r |
17f695ed | 812 | @retval !=0 FirstString is not identical to SecondString using case\r |
1106ffe1 | 813 | insensitive comparisons.\r |
ac644614 | 814 | \r |
815 | **/\r | |
816 | INTN\r | |
817 | EFIAPI\r | |
818 | AsciiStriCmp (\r | |
819 | IN CONST CHAR8 *FirstString,\r | |
820 | IN CONST CHAR8 *SecondString\r | |
821 | );\r | |
822 | \r | |
823 | \r | |
824 | /**\r | |
825 | Compares two Null-terminated ASCII strings with maximum lengths, and returns\r | |
826 | the difference between the first mismatched ASCII characters.\r | |
827 | \r | |
828 | This function compares the Null-terminated ASCII string FirstString to the\r | |
829 | Null-terminated ASCII string SecondString. At most, Length ASCII characters\r | |
830 | will be compared. If Length is 0, then 0 is returned. If FirstString is\r | |
831 | identical to SecondString, then 0 is returned. Otherwise, the value returned\r | |
832 | is the first mismatched ASCII character in SecondString subtracted from the\r | |
833 | first mismatched ASCII character in FirstString.\r | |
834 | \r | |
835 | If Length > 0 and FirstString is NULL, then ASSERT().\r | |
836 | If Length > 0 and SecondString is NULL, then ASSERT().\r | |
837 | If PcdMaximumAsciiStringLength is not zero and FirstString contains more than\r | |
838 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
839 | then ASSERT().\r | |
840 | If PcdMaximumAsciiStringLength is not zero and SecondString contains more than\r | |
841 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
842 | then ASSERT().\r | |
843 | \r | |
844 | @param FirstString Pointer to a Null-terminated ASCII string.\r | |
845 | @param SecondString Pointer to a Null-terminated ASCII string.\r | |
846 | @param Length Maximum number of ASCII characters for compare.\r | |
847 | \r | |
17f695ed | 848 | @retval ==0 FirstString is identical to SecondString.\r |
849 | @retval !=0 FirstString is not identical to SecondString.\r | |
ac644614 | 850 | \r |
851 | **/\r | |
852 | INTN\r | |
853 | EFIAPI\r | |
854 | AsciiStrnCmp (\r | |
855 | IN CONST CHAR8 *FirstString,\r | |
856 | IN CONST CHAR8 *SecondString,\r | |
857 | IN UINTN Length\r | |
858 | );\r | |
859 | \r | |
860 | \r | |
861 | /**\r | |
862 | Concatenates one Null-terminated ASCII string to another Null-terminated\r | |
863 | ASCII string, and returns the concatenated ASCII string.\r | |
864 | \r | |
865 | This function concatenates two Null-terminated ASCII strings. The contents of\r | |
866 | Null-terminated ASCII string Source are concatenated to the end of Null-\r | |
867 | terminated ASCII string Destination. The Null-terminated concatenated ASCII\r | |
868 | String is returned.\r | |
869 | \r | |
870 | If Destination is NULL, then ASSERT().\r | |
871 | If Source is NULL, then ASSERT().\r | |
872 | If PcdMaximumAsciiStringLength is not zero and Destination contains more than\r | |
873 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
874 | then ASSERT().\r | |
875 | If PcdMaximumAsciiStringLength is not zero and Source contains more than\r | |
876 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
877 | then ASSERT().\r | |
878 | If PcdMaximumAsciiStringLength is not zero and concatenating Destination and\r | |
879 | Source results in a ASCII string with more than PcdMaximumAsciiStringLength\r | |
880 | ASCII characters, then ASSERT().\r | |
881 | \r | |
882 | @param Destination Pointer to a Null-terminated ASCII string.\r | |
883 | @param Source Pointer to a Null-terminated ASCII string.\r | |
884 | \r | |
885 | @return Destination\r | |
886 | \r | |
887 | **/\r | |
888 | CHAR8 *\r | |
889 | EFIAPI\r | |
890 | AsciiStrCat (\r | |
891 | IN OUT CHAR8 *Destination,\r | |
892 | IN CONST CHAR8 *Source\r | |
893 | );\r | |
894 | \r | |
895 | \r | |
896 | /**\r | |
17f695ed | 897 | Concatenates up to a specified length one Null-terminated ASCII string to \r |
898 | the end of another Null-terminated ASCII string, and returns the \r | |
899 | concatenated ASCII string.\r | |
ac644614 | 900 | \r |
901 | This function concatenates two Null-terminated ASCII strings. The contents\r | |
902 | of Null-terminated ASCII string Source are concatenated to the end of Null-\r | |
903 | terminated ASCII string Destination, and Destination is returned. At most,\r | |
904 | Length ASCII characters are concatenated from Source to the end of\r | |
905 | Destination, and Destination is always Null-terminated. If Length is 0, then\r | |
906 | Destination is returned unmodified. If Source and Destination overlap, then\r | |
907 | the results are undefined.\r | |
908 | \r | |
909 | If Length > 0 and Destination is NULL, then ASSERT().\r | |
910 | If Length > 0 and Source is NULL, then ASSERT().\r | |
911 | If Source and Destination overlap, then ASSERT().\r | |
912 | If PcdMaximumAsciiStringLength is not zero, and Destination contains more than\r | |
913 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
914 | then ASSERT().\r | |
915 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r | |
916 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
917 | then ASSERT().\r | |
918 | If PcdMaximumAsciiStringLength is not zero, and concatenating Destination and\r | |
919 | Source results in a ASCII string with more than PcdMaximumAsciiStringLength\r | |
920 | ASCII characters not including the Null-terminator, then ASSERT().\r | |
921 | \r | |
922 | @param Destination Pointer to a Null-terminated ASCII string.\r | |
923 | @param Source Pointer to a Null-terminated ASCII string.\r | |
924 | @param Length Maximum number of ASCII characters to concatenate from\r | |
925 | Source.\r | |
926 | \r | |
927 | @return Destination\r | |
928 | \r | |
929 | **/\r | |
930 | CHAR8 *\r | |
931 | EFIAPI\r | |
932 | AsciiStrnCat (\r | |
933 | IN OUT CHAR8 *Destination,\r | |
934 | IN CONST CHAR8 *Source,\r | |
935 | IN UINTN Length\r | |
936 | );\r | |
937 | \r | |
938 | \r | |
939 | /**\r | |
9aa049d9 | 940 | Returns the first occurrence of a Null-terminated ASCII sub-string\r |
ac644614 | 941 | in a Null-terminated ASCII string.\r |
942 | \r | |
943 | This function scans the contents of the ASCII string specified by String\r | |
944 | and returns the first occurrence of SearchString. If SearchString is not\r | |
945 | found in String, then NULL is returned. If the length of SearchString is zero,\r | |
946 | then String is returned.\r | |
947 | \r | |
948 | If String is NULL, then ASSERT().\r | |
949 | If SearchString is NULL, then ASSERT().\r | |
950 | \r | |
951 | If PcdMaximumAsciiStringLength is not zero, and SearchString or\r | |
952 | String contains more than PcdMaximumAsciiStringLength Unicode characters\r | |
953 | not including the Null-terminator, then ASSERT().\r | |
954 | \r | |
1106ffe1 | 955 | @param String Pointer to a Null-terminated ASCII string.\r |
956 | @param SearchString Pointer to a Null-terminated ASCII string to search for.\r | |
ac644614 | 957 | \r |
958 | @retval NULL If the SearchString does not appear in String.\r | |
17f695ed | 959 | @retval others If there is a match return the first occurrence of SearchingString.\r |
9aa049d9 | 960 | If the length of SearchString is zero,return String.\r |
ac644614 | 961 | \r |
962 | **/\r | |
963 | CHAR8 *\r | |
964 | EFIAPI\r | |
965 | AsciiStrStr (\r | |
17f695ed | 966 | IN CONST CHAR8 *String,\r |
967 | IN CONST CHAR8 *SearchString\r | |
ac644614 | 968 | );\r |
969 | \r | |
970 | \r | |
971 | /**\r | |
972 | Convert a Null-terminated ASCII decimal string to a value of type\r | |
973 | UINTN.\r | |
974 | \r | |
975 | This function returns a value of type UINTN by interpreting the contents\r | |
976 | of the ASCII string String as a decimal number. The format of the input\r | |
977 | ASCII string String is:\r | |
978 | \r | |
979 | [spaces] [decimal digits].\r | |
980 | \r | |
981 | The valid decimal digit character is in the range [0-9]. The function will\r | |
982 | ignore the pad space, which includes spaces or tab characters, before the digits.\r | |
983 | The running zero in the beginning of [decimal digits] will be ignored. Then, the\r | |
984 | function stops at the first character that is a not a valid decimal character or\r | |
985 | Null-terminator, whichever on comes first.\r | |
986 | \r | |
987 | If String has only pad spaces, then 0 is returned.\r | |
988 | If String has no pad spaces or valid decimal digits, then 0 is returned.\r | |
989 | If the number represented by String overflows according to the range defined by\r | |
990 | UINTN, then ASSERT().\r | |
991 | If String is NULL, then ASSERT().\r | |
992 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
993 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
994 | then ASSERT().\r | |
995 | \r | |
17f695ed | 996 | @param String Pointer to a Null-terminated ASCII string.\r |
ac644614 | 997 | \r |
38bbd3d9 | 998 | @retval Value translated from String.\r |
ac644614 | 999 | \r |
1000 | **/\r | |
1001 | UINTN\r | |
1002 | EFIAPI\r | |
1003 | AsciiStrDecimalToUintn (\r | |
1004 | IN CONST CHAR8 *String\r | |
1005 | );\r | |
1006 | \r | |
1007 | \r | |
1008 | /**\r | |
1009 | Convert a Null-terminated ASCII decimal string to a value of type\r | |
1010 | UINT64.\r | |
1011 | \r | |
1012 | This function returns a value of type UINT64 by interpreting the contents\r | |
1013 | of the ASCII string String as a decimal number. The format of the input\r | |
1014 | ASCII string String is:\r | |
1015 | \r | |
1016 | [spaces] [decimal digits].\r | |
1017 | \r | |
1018 | The valid decimal digit character is in the range [0-9]. The function will\r | |
1019 | ignore the pad space, which includes spaces or tab characters, before the digits.\r | |
1020 | The running zero in the beginning of [decimal digits] will be ignored. Then, the\r | |
1021 | function stops at the first character that is a not a valid decimal character or\r | |
1022 | Null-terminator, whichever on comes first.\r | |
1023 | \r | |
1024 | If String has only pad spaces, then 0 is returned.\r | |
1025 | If String has no pad spaces or valid decimal digits, then 0 is returned.\r | |
1026 | If the number represented by String overflows according to the range defined by\r | |
1027 | UINT64, then ASSERT().\r | |
1028 | If String is NULL, then ASSERT().\r | |
1029 | If PcdMaximumAsciiStringLength is not zero, and String contains more than\r | |
1030 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1031 | then ASSERT().\r | |
1032 | \r | |
17f695ed | 1033 | @param String Pointer to a Null-terminated ASCII string.\r |
ac644614 | 1034 | \r |
38bbd3d9 | 1035 | @retval Value translated from String.\r |
ac644614 | 1036 | \r |
1037 | **/\r | |
1038 | UINT64\r | |
1039 | EFIAPI\r | |
1040 | AsciiStrDecimalToUint64 (\r | |
17f695ed | 1041 | IN CONST CHAR8 *String\r |
ac644614 | 1042 | );\r |
1043 | \r | |
1044 | \r | |
1045 | /**\r | |
1046 | Convert a Null-terminated ASCII hexadecimal string to a value of type UINTN.\r | |
1047 | \r | |
1048 | This function returns a value of type UINTN by interpreting the contents of\r | |
1049 | the ASCII string String as a hexadecimal number. The format of the input ASCII\r | |
1050 | string String is:\r | |
1051 | \r | |
1052 | [spaces][zeros][x][hexadecimal digits].\r | |
1053 | \r | |
1054 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
1055 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"\r | |
1056 | appears in the input string, it must be prefixed with at least one 0. The function\r | |
1057 | will ignore the pad space, which includes spaces or tab characters, before [zeros],\r | |
1058 | [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]\r | |
1059 | will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal\r | |
1060 | digit. Then, the function stops at the first character that is a not a valid\r | |
1061 | hexadecimal character or Null-terminator, whichever on comes first.\r | |
1062 | \r | |
1063 | If String has only pad spaces, then 0 is returned.\r | |
1064 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then\r | |
1065 | 0 is returned.\r | |
1066 | \r | |
1067 | If the number represented by String overflows according to the range defined by UINTN,\r | |
1068 | then ASSERT().\r | |
1069 | If String is NULL, then ASSERT().\r | |
1070 | If PcdMaximumAsciiStringLength is not zero,\r | |
1071 | and String contains more than PcdMaximumAsciiStringLength ASCII characters not including\r | |
1072 | the Null-terminator, then ASSERT().\r | |
1073 | \r | |
17f695ed | 1074 | @param String Pointer to a Null-terminated ASCII string.\r |
ac644614 | 1075 | \r |
38bbd3d9 | 1076 | @retval Value translated from String.\r |
ac644614 | 1077 | \r |
1078 | **/\r | |
1079 | UINTN\r | |
1080 | EFIAPI\r | |
1081 | AsciiStrHexToUintn (\r | |
17f695ed | 1082 | IN CONST CHAR8 *String\r |
ac644614 | 1083 | );\r |
1084 | \r | |
1085 | \r | |
1086 | /**\r | |
1087 | Convert a Null-terminated ASCII hexadecimal string to a value of type UINT64.\r | |
1088 | \r | |
1089 | This function returns a value of type UINT64 by interpreting the contents of\r | |
1090 | the ASCII string String as a hexadecimal number. The format of the input ASCII\r | |
1091 | string String is:\r | |
1092 | \r | |
1093 | [spaces][zeros][x][hexadecimal digits].\r | |
1094 | \r | |
1095 | The valid hexadecimal digit character is in the range [0-9], [a-f] and [A-F].\r | |
1096 | The prefix "0x" is optional. Both "x" and "X" is allowed in "0x" prefix. If "x"\r | |
1097 | appears in the input string, it must be prefixed with at least one 0. The function\r | |
1098 | will ignore the pad space, which includes spaces or tab characters, before [zeros],\r | |
1099 | [x] or [hexadecimal digits]. The running zero before [x] or [hexadecimal digits]\r | |
1100 | will be ignored. Then, the decoding starts after [x] or the first valid hexadecimal\r | |
1101 | digit. Then, the function stops at the first character that is a not a valid\r | |
1102 | hexadecimal character or Null-terminator, whichever on comes first.\r | |
1103 | \r | |
1104 | If String has only pad spaces, then 0 is returned.\r | |
1105 | If String has no leading pad spaces, leading zeros or valid hexadecimal digits, then\r | |
1106 | 0 is returned.\r | |
1107 | \r | |
1108 | If the number represented by String overflows according to the range defined by UINT64,\r | |
1109 | then ASSERT().\r | |
1110 | If String is NULL, then ASSERT().\r | |
1111 | If PcdMaximumAsciiStringLength is not zero,\r | |
1112 | and String contains more than PcdMaximumAsciiStringLength ASCII characters not including\r | |
1113 | the Null-terminator, then ASSERT().\r | |
1114 | \r | |
17f695ed | 1115 | @param String Pointer to a Null-terminated ASCII string.\r |
ac644614 | 1116 | \r |
38bbd3d9 | 1117 | @retval Value translated from String.\r |
ac644614 | 1118 | \r |
1119 | **/\r | |
1120 | UINT64\r | |
1121 | EFIAPI\r | |
1122 | AsciiStrHexToUint64 (\r | |
17f695ed | 1123 | IN CONST CHAR8 *String\r |
ac644614 | 1124 | );\r |
1125 | \r | |
1126 | \r | |
1127 | /**\r | |
1128 | Convert one Null-terminated ASCII string to a Null-terminated\r | |
1129 | Unicode string and returns the Unicode string.\r | |
1130 | \r | |
1131 | This function converts the contents of the ASCII string Source to the Unicode\r | |
1132 | string Destination, and returns Destination. The function terminates the\r | |
1133 | Unicode string Destination by appending a Null-terminator character at the end.\r | |
1134 | The caller is responsible to make sure Destination points to a buffer with size\r | |
1135 | equal or greater than ((AsciiStrLen (Source) + 1) * sizeof (CHAR16)) in bytes.\r | |
1136 | \r | |
1137 | If Destination is NULL, then ASSERT().\r | |
1138 | If Destination is not aligned on a 16-bit boundary, then ASSERT().\r | |
1139 | If Source is NULL, then ASSERT().\r | |
1140 | If Source and Destination overlap, then ASSERT().\r | |
1141 | If PcdMaximumAsciiStringLength is not zero, and Source contains more than\r | |
1142 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator,\r | |
1143 | then ASSERT().\r | |
1144 | If PcdMaximumUnicodeStringLength is not zero, and Source contains more than\r | |
1145 | PcdMaximumUnicodeStringLength ASCII characters not including the\r | |
1146 | Null-terminator, then ASSERT().\r | |
1147 | \r | |
1148 | @param Source Pointer to a Null-terminated ASCII string.\r | |
1149 | @param Destination Pointer to a Null-terminated Unicode string.\r | |
1150 | \r | |
9aa049d9 | 1151 | @return Destination.\r |
ac644614 | 1152 | \r |
1153 | **/\r | |
1154 | CHAR16 *\r | |
1155 | EFIAPI\r | |
1156 | AsciiStrToUnicodeStr (\r | |
17f695ed | 1157 | IN CONST CHAR8 *Source,\r |
1158 | OUT CHAR16 *Destination\r | |
ac644614 | 1159 | );\r |
1160 | \r | |
1161 | \r | |
1162 | /**\r | |
1163 | Converts an 8-bit value to an 8-bit BCD value.\r | |
1164 | \r | |
1165 | Converts the 8-bit value specified by Value to BCD. The BCD value is\r | |
1166 | returned.\r | |
1167 | \r | |
1168 | If Value >= 100, then ASSERT().\r | |
1169 | \r | |
1170 | @param Value The 8-bit value to convert to BCD. Range 0..99.\r | |
1171 | \r | |
9aa049d9 | 1172 | @return The BCD value.\r |
ac644614 | 1173 | \r |
1174 | **/\r | |
1175 | UINT8\r | |
1176 | EFIAPI\r | |
1177 | DecimalToBcd8 (\r | |
1178 | IN UINT8 Value\r | |
1179 | );\r | |
1180 | \r | |
1181 | \r | |
1182 | /**\r | |
1183 | Converts an 8-bit BCD value to an 8-bit value.\r | |
1184 | \r | |
1185 | Converts the 8-bit BCD value specified by Value to an 8-bit value. The 8-bit\r | |
1186 | value is returned.\r | |
1187 | \r | |
1188 | If Value >= 0xA0, then ASSERT().\r | |
1189 | If (Value & 0x0F) >= 0x0A, then ASSERT().\r | |
1190 | \r | |
1191 | @param Value The 8-bit BCD value to convert to an 8-bit value.\r | |
1192 | \r | |
1193 | @return The 8-bit value is returned.\r | |
1194 | \r | |
1195 | **/\r | |
1196 | UINT8\r | |
1197 | EFIAPI\r | |
1198 | BcdToDecimal8 (\r | |
1199 | IN UINT8 Value\r | |
1200 | );\r | |
1201 | \r | |
1202 | \r | |
1203 | //\r | |
1204 | // Linked List Functions and Macros\r | |
1205 | //\r | |
1206 | \r | |
1207 | /**\r | |
1208 | Initializes the head node of a doubly linked list that is declared as a\r | |
1209 | global variable in a module.\r | |
1210 | \r | |
1211 | Initializes the forward and backward links of a new linked list. After\r | |
1212 | initializing a linked list with this macro, the other linked list functions\r | |
1213 | may be used to add and remove nodes from the linked list. This macro results\r | |
1214 | in smaller executables by initializing the linked list in the data section,\r | |
1215 | instead if calling the InitializeListHead() function to perform the\r | |
1216 | equivalent operation.\r | |
1217 | \r | |
77f863ee | 1218 | @param ListHead The head note of a list to initialize.\r |
ac644614 | 1219 | \r |
1220 | **/\r | |
17f695ed | 1221 | #define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)}\r |
ac644614 | 1222 | \r |
1223 | \r | |
1224 | /**\r | |
1225 | Initializes the head node of a doubly linked list, and returns the pointer to\r | |
1226 | the head node of the doubly linked list.\r | |
1227 | \r | |
1228 | Initializes the forward and backward links of a new linked list. After\r | |
1229 | initializing a linked list with this function, the other linked list\r | |
1230 | functions may be used to add and remove nodes from the linked list. It is up\r | |
1231 | to the caller of this function to allocate the memory for ListHead.\r | |
1232 | \r | |
1233 | If ListHead is NULL, then ASSERT().\r | |
1234 | \r | |
1235 | @param ListHead A pointer to the head node of a new doubly linked list.\r | |
1236 | \r | |
1237 | @return ListHead\r | |
1238 | \r | |
1239 | **/\r | |
1240 | LIST_ENTRY *\r | |
1241 | EFIAPI\r | |
1242 | InitializeListHead (\r | |
aa0583c7 | 1243 | IN OUT LIST_ENTRY *ListHead\r |
ac644614 | 1244 | );\r |
1245 | \r | |
1246 | \r | |
1247 | /**\r | |
1248 | Adds a node to the beginning of a doubly linked list, and returns the pointer\r | |
1249 | to the head node of the doubly linked list.\r | |
1250 | \r | |
1251 | Adds the node Entry at the beginning of the doubly linked list denoted by\r | |
1252 | ListHead, and returns ListHead.\r | |
1253 | \r | |
1254 | If ListHead is NULL, then ASSERT().\r | |
1255 | If Entry is NULL, then ASSERT().\r | |
17f695ed | 1256 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or\r |
1257 | InitializeListHead(), then ASSERT().\r | |
ac644614 | 1258 | If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r |
1259 | of nodes in ListHead, including the ListHead node, is greater than or\r | |
1260 | equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
1261 | \r | |
1262 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
1263 | @param Entry A pointer to a node that is to be inserted at the beginning\r | |
1264 | of a doubly linked list.\r | |
1265 | \r | |
1266 | @return ListHead\r | |
1267 | \r | |
1268 | **/\r | |
1269 | LIST_ENTRY *\r | |
1270 | EFIAPI\r | |
1271 | InsertHeadList (\r | |
aa0583c7 | 1272 | IN OUT LIST_ENTRY *ListHead,\r |
1273 | IN OUT LIST_ENTRY *Entry\r | |
ac644614 | 1274 | );\r |
1275 | \r | |
1276 | \r | |
1277 | /**\r | |
1278 | Adds a node to the end of a doubly linked list, and returns the pointer to\r | |
1279 | the head node of the doubly linked list.\r | |
1280 | \r | |
1281 | Adds the node Entry to the end of the doubly linked list denoted by ListHead,\r | |
1282 | and returns ListHead.\r | |
1283 | \r | |
1284 | If ListHead is NULL, then ASSERT().\r | |
1285 | If Entry is NULL, then ASSERT().\r | |
17f695ed | 1286 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
1287 | InitializeListHead(), then ASSERT().\r | |
ac644614 | 1288 | If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r |
1289 | of nodes in ListHead, including the ListHead node, is greater than or\r | |
1290 | equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
1291 | \r | |
1292 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
1293 | @param Entry A pointer to a node that is to be added at the end of the\r | |
1294 | doubly linked list.\r | |
1295 | \r | |
1296 | @return ListHead\r | |
1297 | \r | |
1298 | **/\r | |
1299 | LIST_ENTRY *\r | |
1300 | EFIAPI\r | |
1301 | InsertTailList (\r | |
aa0583c7 | 1302 | IN OUT LIST_ENTRY *ListHead,\r |
1303 | IN OUT LIST_ENTRY *Entry\r | |
ac644614 | 1304 | );\r |
1305 | \r | |
1306 | \r | |
1307 | /**\r | |
1308 | Retrieves the first node of a doubly linked list.\r | |
1309 | \r | |
17f695ed | 1310 | Returns the first node of a doubly linked list. List must have been \r |
1311 | initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r | |
1312 | If List is empty, then List is returned.\r | |
ac644614 | 1313 | \r |
1314 | If List is NULL, then ASSERT().\r | |
17f695ed | 1315 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
1316 | InitializeListHead(), then ASSERT().\r | |
ac644614 | 1317 | If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r |
1318 | in List, including the List node, is greater than or equal to\r | |
1319 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1320 | \r | |
1321 | @param List A pointer to the head node of a doubly linked list.\r | |
1322 | \r | |
1323 | @return The first node of a doubly linked list.\r | |
1324 | @retval NULL The list is empty.\r | |
1325 | \r | |
1326 | **/\r | |
1327 | LIST_ENTRY *\r | |
1328 | EFIAPI\r | |
1329 | GetFirstNode (\r | |
1330 | IN CONST LIST_ENTRY *List\r | |
1331 | );\r | |
1332 | \r | |
1333 | \r | |
1334 | /**\r | |
1335 | Retrieves the next node of a doubly linked list.\r | |
1336 | \r | |
17f695ed | 1337 | Returns the node of a doubly linked list that follows Node. \r |
1338 | List must have been initialized with INTIALIZE_LIST_HEAD_VARIABLE()\r | |
1339 | or InitializeListHead(). If List is empty, then List is returned.\r | |
ac644614 | 1340 | \r |
1341 | If List is NULL, then ASSERT().\r | |
1342 | If Node is NULL, then ASSERT().\r | |
17f695ed | 1343 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
1344 | InitializeListHead(), then ASSERT().\r | |
ac644614 | 1345 | If PcdMaximumLinkedListLenth is not zero, and List contains more than\r |
1346 | PcdMaximumLinkedListLenth nodes, then ASSERT().\r | |
1347 | If Node is not a node in List, then ASSERT().\r | |
1348 | \r | |
1349 | @param List A pointer to the head node of a doubly linked list.\r | |
1350 | @param Node A pointer to a node in the doubly linked list.\r | |
1351 | \r | |
1352 | @return Pointer to the next node if one exists. Otherwise a null value which\r | |
1353 | is actually List is returned.\r | |
1354 | \r | |
1355 | **/\r | |
1356 | LIST_ENTRY *\r | |
1357 | EFIAPI\r | |
1358 | GetNextNode (\r | |
1359 | IN CONST LIST_ENTRY *List,\r | |
1360 | IN CONST LIST_ENTRY *Node\r | |
1361 | );\r | |
1362 | \r | |
1363 | \r | |
1364 | /**\r | |
1365 | Checks to see if a doubly linked list is empty or not.\r | |
1366 | \r | |
1367 | Checks to see if the doubly linked list is empty. If the linked list contains\r | |
1368 | zero nodes, this function returns TRUE. Otherwise, it returns FALSE.\r | |
1369 | \r | |
1370 | If ListHead is NULL, then ASSERT().\r | |
17f695ed | 1371 | If ListHead was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or \r |
1372 | InitializeListHead(), then ASSERT().\r | |
ac644614 | 1373 | If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r |
1374 | in List, including the List node, is greater than or equal to\r | |
1375 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1376 | \r | |
1377 | @param ListHead A pointer to the head node of a doubly linked list.\r | |
1378 | \r | |
1379 | @retval TRUE The linked list is empty.\r | |
1380 | @retval FALSE The linked list is not empty.\r | |
1381 | \r | |
1382 | **/\r | |
1383 | BOOLEAN\r | |
1384 | EFIAPI\r | |
1385 | IsListEmpty (\r | |
1386 | IN CONST LIST_ENTRY *ListHead\r | |
1387 | );\r | |
1388 | \r | |
1389 | \r | |
1390 | /**\r | |
aa0583c7 | 1391 | Determines if a node in a doubly linked list is the head node of a the same\r |
1392 | doubly linked list. This function is typically used to terminate a loop that\r | |
1393 | traverses all the nodes in a doubly linked list starting with the head node.\r | |
ac644614 | 1394 | \r |
aa0583c7 | 1395 | Returns TRUE if Node is equal to List. Returns FALSE if Node is one of the\r |
1396 | nodes in the doubly linked list specified by List. List must have been\r | |
17f695ed | 1397 | initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r |
ac644614 | 1398 | \r |
1399 | If List is NULL, then ASSERT().\r | |
1400 | If Node is NULL, then ASSERT().\r | |
17f695ed | 1401 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(), \r |
1402 | then ASSERT().\r | |
ac644614 | 1403 | If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r |
1404 | in List, including the List node, is greater than or equal to\r | |
1405 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1406 | If Node is not a node in List and Node is not equal to List, then ASSERT().\r | |
1407 | \r | |
1408 | @param List A pointer to the head node of a doubly linked list.\r | |
1409 | @param Node A pointer to a node in the doubly linked list.\r | |
1410 | \r | |
1411 | @retval TRUE Node is one of the nodes in the doubly linked list.\r | |
1412 | @retval FALSE Node is not one of the nodes in the doubly linked list.\r | |
1413 | \r | |
1414 | **/\r | |
1415 | BOOLEAN\r | |
1416 | EFIAPI\r | |
1417 | IsNull (\r | |
1418 | IN CONST LIST_ENTRY *List,\r | |
1419 | IN CONST LIST_ENTRY *Node\r | |
1420 | );\r | |
1421 | \r | |
1422 | \r | |
1423 | /**\r | |
1424 | Determines if a node the last node in a doubly linked list.\r | |
1425 | \r | |
1426 | Returns TRUE if Node is the last node in the doubly linked list specified by\r | |
1427 | List. Otherwise, FALSE is returned. List must have been initialized with\r | |
17f695ed | 1428 | INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead().\r |
ac644614 | 1429 | \r |
1430 | If List is NULL, then ASSERT().\r | |
1431 | If Node is NULL, then ASSERT().\r | |
17f695ed | 1432 | If List was not initialized with INTIALIZE_LIST_HEAD_VARIABLE() or\r |
1433 | InitializeListHead(), then ASSERT().\r | |
ac644614 | 1434 | If PcdMaximumLinkedListLenth is not zero, and the number of nodes\r |
1435 | in List, including the List node, is greater than or equal to\r | |
1436 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1437 | If Node is not a node in List, then ASSERT().\r | |
1438 | \r | |
1439 | @param List A pointer to the head node of a doubly linked list.\r | |
1440 | @param Node A pointer to a node in the doubly linked list.\r | |
1441 | \r | |
1442 | @retval TRUE Node is the last node in the linked list.\r | |
1443 | @retval FALSE Node is not the last node in the linked list.\r | |
1444 | \r | |
1445 | **/\r | |
1446 | BOOLEAN\r | |
1447 | EFIAPI\r | |
1448 | IsNodeAtEnd (\r | |
1449 | IN CONST LIST_ENTRY *List,\r | |
1450 | IN CONST LIST_ENTRY *Node\r | |
1451 | );\r | |
1452 | \r | |
1453 | \r | |
1454 | /**\r | |
1455 | Swaps the location of two nodes in a doubly linked list, and returns the\r | |
1456 | first node after the swap.\r | |
1457 | \r | |
1458 | If FirstEntry is identical to SecondEntry, then SecondEntry is returned.\r | |
1459 | Otherwise, the location of the FirstEntry node is swapped with the location\r | |
1460 | of the SecondEntry node in a doubly linked list. SecondEntry must be in the\r | |
1461 | same double linked list as FirstEntry and that double linked list must have\r | |
17f695ed | 1462 | been initialized with INTIALIZE_LIST_HEAD_VARIABLE() or InitializeListHead(). \r |
1463 | SecondEntry is returned after the nodes are swapped.\r | |
ac644614 | 1464 | \r |
1465 | If FirstEntry is NULL, then ASSERT().\r | |
1466 | If SecondEntry is NULL, then ASSERT().\r | |
1467 | If SecondEntry and FirstEntry are not in the same linked list, then ASSERT().\r | |
1468 | If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r | |
1469 | linked list containing the FirstEntry and SecondEntry nodes, including\r | |
1470 | the FirstEntry and SecondEntry nodes, is greater than or equal to\r | |
1471 | PcdMaximumLinkedListLength, then ASSERT().\r | |
1472 | \r | |
1473 | @param FirstEntry A pointer to a node in a linked list.\r | |
1474 | @param SecondEntry A pointer to another node in the same linked list.\r | |
38bbd3d9 | 1475 | \r |
9aa049d9 | 1476 | @return SecondEntry.\r |
ac644614 | 1477 | \r |
1478 | **/\r | |
1479 | LIST_ENTRY *\r | |
1480 | EFIAPI\r | |
1481 | SwapListEntries (\r | |
aa0583c7 | 1482 | IN OUT LIST_ENTRY *FirstEntry,\r |
1483 | IN OUT LIST_ENTRY *SecondEntry\r | |
ac644614 | 1484 | );\r |
1485 | \r | |
1486 | \r | |
1487 | /**\r | |
1488 | Removes a node from a doubly linked list, and returns the node that follows\r | |
1489 | the removed node.\r | |
1490 | \r | |
1491 | Removes the node Entry from a doubly linked list. It is up to the caller of\r | |
1492 | this function to release the memory used by this node if that is required. On\r | |
1493 | exit, the node following Entry in the doubly linked list is returned. If\r | |
1494 | Entry is the only node in the linked list, then the head node of the linked\r | |
1495 | list is returned.\r | |
1496 | \r | |
1497 | If Entry is NULL, then ASSERT().\r | |
1498 | If Entry is the head node of an empty list, then ASSERT().\r | |
1499 | If PcdMaximumLinkedListLength is not zero, and the number of nodes in the\r | |
1500 | linked list containing Entry, including the Entry node, is greater than\r | |
1501 | or equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
1502 | \r | |
9aa049d9 | 1503 | @param Entry A pointer to a node in a linked list.\r |
ac644614 | 1504 | \r |
9aa049d9 | 1505 | @return Entry.\r |
ac644614 | 1506 | \r |
1507 | **/\r | |
1508 | LIST_ENTRY *\r | |
1509 | EFIAPI\r | |
1510 | RemoveEntryList (\r | |
1511 | IN CONST LIST_ENTRY *Entry\r | |
1512 | );\r | |
1513 | \r | |
1514 | //\r | |
1515 | // Math Services\r | |
1516 | //\r | |
1517 | \r | |
1518 | /**\r | |
1519 | Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled\r | |
1520 | with zeros. The shifted value is returned.\r | |
1521 | \r | |
1522 | This function shifts the 64-bit value Operand to the left by Count bits. The\r | |
1523 | low Count bits are set to zero. The shifted value is returned.\r | |
1524 | \r | |
1525 | If Count is greater than 63, then ASSERT().\r | |
1526 | \r | |
1527 | @param Operand The 64-bit operand to shift left.\r | |
1528 | @param Count The number of bits to shift left.\r | |
1529 | \r | |
9aa049d9 | 1530 | @return Operand << Count.\r |
ac644614 | 1531 | \r |
1532 | **/\r | |
1533 | UINT64\r | |
1534 | EFIAPI\r | |
1535 | LShiftU64 (\r | |
1536 | IN UINT64 Operand,\r | |
1537 | IN UINTN Count\r | |
1538 | );\r | |
1539 | \r | |
1540 | \r | |
1541 | /**\r | |
1542 | Shifts a 64-bit integer right between 0 and 63 bits. This high bits are\r | |
1543 | filled with zeros. The shifted value is returned.\r | |
1544 | \r | |
1545 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
1546 | high Count bits are set to zero. The shifted value is returned.\r | |
1547 | \r | |
1548 | If Count is greater than 63, then ASSERT().\r | |
1549 | \r | |
1550 | @param Operand The 64-bit operand to shift right.\r | |
1551 | @param Count The number of bits to shift right.\r | |
1552 | \r | |
1553 | @return Operand >> Count\r | |
1554 | \r | |
1555 | **/\r | |
1556 | UINT64\r | |
1557 | EFIAPI\r | |
1558 | RShiftU64 (\r | |
1559 | IN UINT64 Operand,\r | |
1560 | IN UINTN Count\r | |
1561 | );\r | |
1562 | \r | |
1563 | \r | |
1564 | /**\r | |
1565 | Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled\r | |
1566 | with original integer's bit 63. The shifted value is returned.\r | |
1567 | \r | |
1568 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
1569 | high Count bits are set to bit 63 of Operand. The shifted value is returned.\r | |
1570 | \r | |
1571 | If Count is greater than 63, then ASSERT().\r | |
1572 | \r | |
1573 | @param Operand The 64-bit operand to shift right.\r | |
1574 | @param Count The number of bits to shift right.\r | |
1575 | \r | |
1576 | @return Operand >> Count\r | |
1577 | \r | |
1578 | **/\r | |
1579 | UINT64\r | |
1580 | EFIAPI\r | |
1581 | ARShiftU64 (\r | |
1582 | IN UINT64 Operand,\r | |
1583 | IN UINTN Count\r | |
1584 | );\r | |
1585 | \r | |
1586 | \r | |
1587 | /**\r | |
1588 | Rotates a 32-bit integer left between 0 and 31 bits, filling the low bits\r | |
1589 | with the high bits that were rotated.\r | |
1590 | \r | |
1591 | This function rotates the 32-bit value Operand to the left by Count bits. The\r | |
1592 | low Count bits are fill with the high Count bits of Operand. The rotated\r | |
1593 | value is returned.\r | |
1594 | \r | |
1595 | If Count is greater than 31, then ASSERT().\r | |
1596 | \r | |
1597 | @param Operand The 32-bit operand to rotate left.\r | |
1598 | @param Count The number of bits to rotate left.\r | |
1599 | \r | |
17f695ed | 1600 | @return Operand << Count\r |
ac644614 | 1601 | \r |
1602 | **/\r | |
1603 | UINT32\r | |
1604 | EFIAPI\r | |
1605 | LRotU32 (\r | |
1606 | IN UINT32 Operand,\r | |
1607 | IN UINTN Count\r | |
1608 | );\r | |
1609 | \r | |
1610 | \r | |
1611 | /**\r | |
1612 | Rotates a 32-bit integer right between 0 and 31 bits, filling the high bits\r | |
1613 | with the low bits that were rotated.\r | |
1614 | \r | |
1615 | This function rotates the 32-bit value Operand to the right by Count bits.\r | |
1616 | The high Count bits are fill with the low Count bits of Operand. The rotated\r | |
1617 | value is returned.\r | |
1618 | \r | |
1619 | If Count is greater than 31, then ASSERT().\r | |
1620 | \r | |
1621 | @param Operand The 32-bit operand to rotate right.\r | |
1622 | @param Count The number of bits to rotate right.\r | |
1623 | \r | |
2fe241a2 | 1624 | @return Operand >> Count\r |
ac644614 | 1625 | \r |
1626 | **/\r | |
1627 | UINT32\r | |
1628 | EFIAPI\r | |
1629 | RRotU32 (\r | |
1630 | IN UINT32 Operand,\r | |
1631 | IN UINTN Count\r | |
1632 | );\r | |
1633 | \r | |
1634 | \r | |
1635 | /**\r | |
1636 | Rotates a 64-bit integer left between 0 and 63 bits, filling the low bits\r | |
1637 | with the high bits that were rotated.\r | |
1638 | \r | |
1639 | This function rotates the 64-bit value Operand to the left by Count bits. The\r | |
1640 | low Count bits are fill with the high Count bits of Operand. The rotated\r | |
1641 | value is returned.\r | |
1642 | \r | |
1643 | If Count is greater than 63, then ASSERT().\r | |
1644 | \r | |
1645 | @param Operand The 64-bit operand to rotate left.\r | |
1646 | @param Count The number of bits to rotate left.\r | |
1647 | \r | |
17f695ed | 1648 | @return Operand << Count\r |
ac644614 | 1649 | \r |
1650 | **/\r | |
1651 | UINT64\r | |
1652 | EFIAPI\r | |
1653 | LRotU64 (\r | |
1654 | IN UINT64 Operand,\r | |
1655 | IN UINTN Count\r | |
1656 | );\r | |
1657 | \r | |
1658 | \r | |
1659 | /**\r | |
1660 | Rotates a 64-bit integer right between 0 and 63 bits, filling the high bits\r | |
1661 | with the high low bits that were rotated.\r | |
1662 | \r | |
1663 | This function rotates the 64-bit value Operand to the right by Count bits.\r | |
1664 | The high Count bits are fill with the low Count bits of Operand. The rotated\r | |
1665 | value is returned.\r | |
1666 | \r | |
1667 | If Count is greater than 63, then ASSERT().\r | |
1668 | \r | |
1669 | @param Operand The 64-bit operand to rotate right.\r | |
1670 | @param Count The number of bits to rotate right.\r | |
1671 | \r | |
17f695ed | 1672 | @return Operand >> Count\r |
ac644614 | 1673 | \r |
1674 | **/\r | |
1675 | UINT64\r | |
1676 | EFIAPI\r | |
1677 | RRotU64 (\r | |
1678 | IN UINT64 Operand,\r | |
1679 | IN UINTN Count\r | |
1680 | );\r | |
1681 | \r | |
1682 | \r | |
1683 | /**\r | |
1684 | Returns the bit position of the lowest bit set in a 32-bit value.\r | |
1685 | \r | |
1686 | This function computes the bit position of the lowest bit set in the 32-bit\r | |
1687 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
1688 | Otherwise, a value between 0 and 31 is returned.\r | |
1689 | \r | |
1690 | @param Operand The 32-bit operand to evaluate.\r | |
1691 | \r | |
9aa049d9 | 1692 | @retval 0..31 The lowest bit set in Operand was found.\r |
17f695ed | 1693 | @retval -1 Operand is zero.\r |
ac644614 | 1694 | \r |
1695 | **/\r | |
1696 | INTN\r | |
1697 | EFIAPI\r | |
1698 | LowBitSet32 (\r | |
1699 | IN UINT32 Operand\r | |
1700 | );\r | |
1701 | \r | |
1702 | \r | |
1703 | /**\r | |
1704 | Returns the bit position of the lowest bit set in a 64-bit value.\r | |
1705 | \r | |
1706 | This function computes the bit position of the lowest bit set in the 64-bit\r | |
1707 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
1708 | Otherwise, a value between 0 and 63 is returned.\r | |
1709 | \r | |
1710 | @param Operand The 64-bit operand to evaluate.\r | |
1711 | \r | |
9aa049d9 | 1712 | @retval 0..63 The lowest bit set in Operand was found.\r |
17f695ed | 1713 | @retval -1 Operand is zero.\r |
1714 | \r | |
ac644614 | 1715 | \r |
1716 | **/\r | |
1717 | INTN\r | |
1718 | EFIAPI\r | |
1719 | LowBitSet64 (\r | |
1720 | IN UINT64 Operand\r | |
1721 | );\r | |
1722 | \r | |
1723 | \r | |
1724 | /**\r | |
1725 | Returns the bit position of the highest bit set in a 32-bit value. Equivalent\r | |
1726 | to log2(x).\r | |
1727 | \r | |
1728 | This function computes the bit position of the highest bit set in the 32-bit\r | |
1729 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
1730 | Otherwise, a value between 0 and 31 is returned.\r | |
1731 | \r | |
1732 | @param Operand The 32-bit operand to evaluate.\r | |
1733 | \r | |
9aa049d9 | 1734 | @retval 0..31 Position of the highest bit set in Operand if found.\r |
17f695ed | 1735 | @retval -1 Operand is zero.\r |
ac644614 | 1736 | \r |
1737 | **/\r | |
1738 | INTN\r | |
1739 | EFIAPI\r | |
1740 | HighBitSet32 (\r | |
1741 | IN UINT32 Operand\r | |
1742 | );\r | |
1743 | \r | |
1744 | \r | |
1745 | /**\r | |
1746 | Returns the bit position of the highest bit set in a 64-bit value. Equivalent\r | |
1747 | to log2(x).\r | |
1748 | \r | |
1749 | This function computes the bit position of the highest bit set in the 64-bit\r | |
1750 | value specified by Operand. If Operand is zero, then -1 is returned.\r | |
1751 | Otherwise, a value between 0 and 63 is returned.\r | |
1752 | \r | |
1753 | @param Operand The 64-bit operand to evaluate.\r | |
1754 | \r | |
9aa049d9 | 1755 | @retval 0..63 Position of the highest bit set in Operand if found.\r |
17f695ed | 1756 | @retval -1 Operand is zero.\r |
ac644614 | 1757 | \r |
1758 | **/\r | |
1759 | INTN\r | |
1760 | EFIAPI\r | |
1761 | HighBitSet64 (\r | |
1762 | IN UINT64 Operand\r | |
1763 | );\r | |
1764 | \r | |
1765 | \r | |
1766 | /**\r | |
1767 | Returns the value of the highest bit set in a 32-bit value. Equivalent to\r | |
17f695ed | 1768 | 1 << log2(x).\r |
ac644614 | 1769 | \r |
1770 | This function computes the value of the highest bit set in the 32-bit value\r | |
1771 | specified by Operand. If Operand is zero, then zero is returned.\r | |
1772 | \r | |
1773 | @param Operand The 32-bit operand to evaluate.\r | |
1774 | \r | |
1775 | @return 1 << HighBitSet32(Operand)\r | |
1776 | @retval 0 Operand is zero.\r | |
1777 | \r | |
1778 | **/\r | |
1779 | UINT32\r | |
1780 | EFIAPI\r | |
1781 | GetPowerOfTwo32 (\r | |
1782 | IN UINT32 Operand\r | |
1783 | );\r | |
1784 | \r | |
1785 | \r | |
1786 | /**\r | |
1787 | Returns the value of the highest bit set in a 64-bit value. Equivalent to\r | |
17f695ed | 1788 | 1 << log2(x).\r |
ac644614 | 1789 | \r |
1790 | This function computes the value of the highest bit set in the 64-bit value\r | |
1791 | specified by Operand. If Operand is zero, then zero is returned.\r | |
1792 | \r | |
1793 | @param Operand The 64-bit operand to evaluate.\r | |
1794 | \r | |
1795 | @return 1 << HighBitSet64(Operand)\r | |
1796 | @retval 0 Operand is zero.\r | |
1797 | \r | |
1798 | **/\r | |
1799 | UINT64\r | |
1800 | EFIAPI\r | |
1801 | GetPowerOfTwo64 (\r | |
1802 | IN UINT64 Operand\r | |
1803 | );\r | |
1804 | \r | |
1805 | \r | |
1806 | /**\r | |
1807 | Switches the endianess of a 16-bit integer.\r | |
1808 | \r | |
1809 | This function swaps the bytes in a 16-bit unsigned value to switch the value\r | |
1810 | from little endian to big endian or vice versa. The byte swapped value is\r | |
1811 | returned.\r | |
1812 | \r | |
2a53dabf | 1813 | @param Value A 16-bit unsigned value.\r |
ac644614 | 1814 | \r |
efb23117 | 1815 | @return The byte swapped Value.\r |
ac644614 | 1816 | \r |
1817 | **/\r | |
1818 | UINT16\r | |
1819 | EFIAPI\r | |
1820 | SwapBytes16 (\r | |
1821 | IN UINT16 Value\r | |
1822 | );\r | |
1823 | \r | |
1824 | \r | |
1825 | /**\r | |
1826 | Switches the endianess of a 32-bit integer.\r | |
1827 | \r | |
1828 | This function swaps the bytes in a 32-bit unsigned value to switch the value\r | |
1829 | from little endian to big endian or vice versa. The byte swapped value is\r | |
1830 | returned.\r | |
1831 | \r | |
2a53dabf | 1832 | @param Value A 32-bit unsigned value.\r |
ac644614 | 1833 | \r |
efb23117 | 1834 | @return The byte swapped Value.\r |
ac644614 | 1835 | \r |
1836 | **/\r | |
1837 | UINT32\r | |
1838 | EFIAPI\r | |
1839 | SwapBytes32 (\r | |
1840 | IN UINT32 Value\r | |
1841 | );\r | |
1842 | \r | |
1843 | \r | |
1844 | /**\r | |
1845 | Switches the endianess of a 64-bit integer.\r | |
1846 | \r | |
1847 | This function swaps the bytes in a 64-bit unsigned value to switch the value\r | |
1848 | from little endian to big endian or vice versa. The byte swapped value is\r | |
1849 | returned.\r | |
1850 | \r | |
2a53dabf | 1851 | @param Value A 64-bit unsigned value.\r |
ac644614 | 1852 | \r |
efb23117 | 1853 | @return The byte swapped Value.\r |
ac644614 | 1854 | \r |
1855 | **/\r | |
1856 | UINT64\r | |
1857 | EFIAPI\r | |
1858 | SwapBytes64 (\r | |
1859 | IN UINT64 Value\r | |
1860 | );\r | |
1861 | \r | |
1862 | \r | |
1863 | /**\r | |
1864 | Multiples a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
1865 | generates a 64-bit unsigned result.\r | |
1866 | \r | |
1867 | This function multiples the 64-bit unsigned value Multiplicand by the 32-bit\r | |
1868 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
1869 | bit unsigned result is returned.\r | |
1870 | \r | |
ac644614 | 1871 | @param Multiplicand A 64-bit unsigned value.\r |
1872 | @param Multiplier A 32-bit unsigned value.\r | |
1873 | \r | |
1874 | @return Multiplicand * Multiplier\r | |
1875 | \r | |
1876 | **/\r | |
1877 | UINT64\r | |
1878 | EFIAPI\r | |
1879 | MultU64x32 (\r | |
1880 | IN UINT64 Multiplicand,\r | |
1881 | IN UINT32 Multiplier\r | |
1882 | );\r | |
1883 | \r | |
1884 | \r | |
1885 | /**\r | |
1886 | Multiples a 64-bit unsigned integer by a 64-bit unsigned integer and\r | |
1887 | generates a 64-bit unsigned result.\r | |
1888 | \r | |
1889 | This function multiples the 64-bit unsigned value Multiplicand by the 64-bit\r | |
1890 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
1891 | bit unsigned result is returned.\r | |
1892 | \r | |
ac644614 | 1893 | @param Multiplicand A 64-bit unsigned value.\r |
1894 | @param Multiplier A 64-bit unsigned value.\r | |
1895 | \r | |
1896 | @return Multiplicand * Multiplier\r | |
1897 | \r | |
1898 | **/\r | |
1899 | UINT64\r | |
1900 | EFIAPI\r | |
1901 | MultU64x64 (\r | |
1902 | IN UINT64 Multiplicand,\r | |
1903 | IN UINT64 Multiplier\r | |
1904 | );\r | |
1905 | \r | |
1906 | \r | |
1907 | /**\r | |
1908 | Multiples a 64-bit signed integer by a 64-bit signed integer and generates a\r | |
1909 | 64-bit signed result.\r | |
1910 | \r | |
1911 | This function multiples the 64-bit signed value Multiplicand by the 64-bit\r | |
1912 | signed value Multiplier and generates a 64-bit signed result. This 64-bit\r | |
1913 | signed result is returned.\r | |
1914 | \r | |
ac644614 | 1915 | @param Multiplicand A 64-bit signed value.\r |
1916 | @param Multiplier A 64-bit signed value.\r | |
1917 | \r | |
1918 | @return Multiplicand * Multiplier\r | |
1919 | \r | |
1920 | **/\r | |
1921 | INT64\r | |
1922 | EFIAPI\r | |
1923 | MultS64x64 (\r | |
1924 | IN INT64 Multiplicand,\r | |
1925 | IN INT64 Multiplier\r | |
1926 | );\r | |
1927 | \r | |
1928 | \r | |
1929 | /**\r | |
1930 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
1931 | a 64-bit unsigned result.\r | |
1932 | \r | |
1933 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
1934 | unsigned value Divisor and generates a 64-bit unsigned quotient. This\r | |
1935 | function returns the 64-bit unsigned quotient.\r | |
1936 | \r | |
1937 | If Divisor is 0, then ASSERT().\r | |
1938 | \r | |
1939 | @param Dividend A 64-bit unsigned value.\r | |
1940 | @param Divisor A 32-bit unsigned value.\r | |
1941 | \r | |
1942 | @return Dividend / Divisor\r | |
1943 | \r | |
1944 | **/\r | |
1945 | UINT64\r | |
1946 | EFIAPI\r | |
1947 | DivU64x32 (\r | |
1948 | IN UINT64 Dividend,\r | |
1949 | IN UINT32 Divisor\r | |
1950 | );\r | |
1951 | \r | |
1952 | \r | |
1953 | /**\r | |
1954 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
1955 | a 32-bit unsigned remainder.\r | |
1956 | \r | |
1957 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
1958 | unsigned value Divisor and generates a 32-bit remainder. This function\r | |
1959 | returns the 32-bit unsigned remainder.\r | |
1960 | \r | |
1961 | If Divisor is 0, then ASSERT().\r | |
1962 | \r | |
1963 | @param Dividend A 64-bit unsigned value.\r | |
1964 | @param Divisor A 32-bit unsigned value.\r | |
1965 | \r | |
1966 | @return Dividend % Divisor\r | |
1967 | \r | |
1968 | **/\r | |
1969 | UINT32\r | |
1970 | EFIAPI\r | |
1971 | ModU64x32 (\r | |
1972 | IN UINT64 Dividend,\r | |
1973 | IN UINT32 Divisor\r | |
1974 | );\r | |
1975 | \r | |
1976 | \r | |
1977 | /**\r | |
1978 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates\r | |
1979 | a 64-bit unsigned result and an optional 32-bit unsigned remainder.\r | |
1980 | \r | |
1981 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
1982 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
1983 | is not NULL, then the 32-bit unsigned remainder is returned in Remainder.\r | |
1984 | This function returns the 64-bit unsigned quotient.\r | |
1985 | \r | |
1986 | If Divisor is 0, then ASSERT().\r | |
1987 | \r | |
1988 | @param Dividend A 64-bit unsigned value.\r | |
1989 | @param Divisor A 32-bit unsigned value.\r | |
1990 | @param Remainder A pointer to a 32-bit unsigned value. This parameter is\r | |
1991 | optional and may be NULL.\r | |
1992 | \r | |
1993 | @return Dividend / Divisor\r | |
1994 | \r | |
1995 | **/\r | |
1996 | UINT64\r | |
1997 | EFIAPI\r | |
1998 | DivU64x32Remainder (\r | |
1999 | IN UINT64 Dividend,\r | |
2000 | IN UINT32 Divisor,\r | |
2001 | OUT UINT32 *Remainder OPTIONAL\r | |
2002 | );\r | |
2003 | \r | |
2004 | \r | |
2005 | /**\r | |
2006 | Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates\r | |
2007 | a 64-bit unsigned result and an optional 64-bit unsigned remainder.\r | |
2008 | \r | |
2009 | This function divides the 64-bit unsigned value Dividend by the 64-bit\r | |
2010 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
2011 | is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r | |
2012 | This function returns the 64-bit unsigned quotient.\r | |
2013 | \r | |
2014 | If Divisor is 0, then ASSERT().\r | |
2015 | \r | |
2016 | @param Dividend A 64-bit unsigned value.\r | |
2017 | @param Divisor A 64-bit unsigned value.\r | |
2018 | @param Remainder A pointer to a 64-bit unsigned value. This parameter is\r | |
2019 | optional and may be NULL.\r | |
2020 | \r | |
2021 | @return Dividend / Divisor\r | |
2022 | \r | |
2023 | **/\r | |
2024 | UINT64\r | |
2025 | EFIAPI\r | |
2026 | DivU64x64Remainder (\r | |
2027 | IN UINT64 Dividend,\r | |
2028 | IN UINT64 Divisor,\r | |
2029 | OUT UINT64 *Remainder OPTIONAL\r | |
2030 | );\r | |
2031 | \r | |
2032 | \r | |
2033 | /**\r | |
2034 | Divides a 64-bit signed integer by a 64-bit signed integer and generates a\r | |
2035 | 64-bit signed result and a optional 64-bit signed remainder.\r | |
2036 | \r | |
2037 | This function divides the 64-bit signed value Dividend by the 64-bit signed\r | |
2038 | value Divisor and generates a 64-bit signed quotient. If Remainder is not\r | |
2039 | NULL, then the 64-bit signed remainder is returned in Remainder. This\r | |
2040 | function returns the 64-bit signed quotient.\r | |
2041 | \r | |
9aa049d9 | 2042 | It is the caller's responsibility to not call this function with a Divisor of 0.\r |
17f695ed | 2043 | If Divisor is 0, then the quotient and remainder should be assumed to be \r |
2044 | the largest negative integer.\r | |
2045 | \r | |
ac644614 | 2046 | If Divisor is 0, then ASSERT().\r |
2047 | \r | |
2048 | @param Dividend A 64-bit signed value.\r | |
2049 | @param Divisor A 64-bit signed value.\r | |
2050 | @param Remainder A pointer to a 64-bit signed value. This parameter is\r | |
2051 | optional and may be NULL.\r | |
2052 | \r | |
2053 | @return Dividend / Divisor\r | |
2054 | \r | |
2055 | **/\r | |
2056 | INT64\r | |
2057 | EFIAPI\r | |
2058 | DivS64x64Remainder (\r | |
2059 | IN INT64 Dividend,\r | |
2060 | IN INT64 Divisor,\r | |
2061 | OUT INT64 *Remainder OPTIONAL\r | |
2062 | );\r | |
2063 | \r | |
2064 | \r | |
2065 | /**\r | |
2066 | Reads a 16-bit value from memory that may be unaligned.\r | |
2067 | \r | |
2068 | This function returns the 16-bit value pointed to by Buffer. The function\r | |
2069 | guarantees that the read operation does not produce an alignment fault.\r | |
2070 | \r | |
2071 | If the Buffer is NULL, then ASSERT().\r | |
2072 | \r | |
5385a579 | 2073 | @param Buffer Pointer to a 16-bit value that may be unaligned.\r |
ac644614 | 2074 | \r |
5385a579 | 2075 | @return The 16-bit value read from Buffer.\r |
ac644614 | 2076 | \r |
2077 | **/\r | |
2078 | UINT16\r | |
2079 | EFIAPI\r | |
2080 | ReadUnaligned16 (\r | |
5385a579 | 2081 | IN CONST UINT16 *Buffer\r |
ac644614 | 2082 | );\r |
2083 | \r | |
2084 | \r | |
2085 | /**\r | |
2086 | Writes a 16-bit value to memory that may be unaligned.\r | |
2087 | \r | |
2088 | This function writes the 16-bit value specified by Value to Buffer. Value is\r | |
2089 | returned. The function guarantees that the write operation does not produce\r | |
2090 | an alignment fault.\r | |
2091 | \r | |
2092 | If the Buffer is NULL, then ASSERT().\r | |
2093 | \r | |
5385a579 | 2094 | @param Buffer Pointer to a 16-bit value that may be unaligned.\r |
ac644614 | 2095 | @param Value 16-bit value to write to Buffer.\r |
2096 | \r | |
5385a579 | 2097 | @return The 16-bit value to write to Buffer.\r |
ac644614 | 2098 | \r |
2099 | **/\r | |
2100 | UINT16\r | |
2101 | EFIAPI\r | |
2102 | WriteUnaligned16 (\r | |
5385a579 | 2103 | OUT UINT16 *Buffer,\r |
2104 | IN UINT16 Value\r | |
ac644614 | 2105 | );\r |
2106 | \r | |
2107 | \r | |
2108 | /**\r | |
2109 | Reads a 24-bit value from memory that may be unaligned.\r | |
2110 | \r | |
2111 | This function returns the 24-bit value pointed to by Buffer. The function\r | |
2112 | guarantees that the read operation does not produce an alignment fault.\r | |
2113 | \r | |
2114 | If the Buffer is NULL, then ASSERT().\r | |
2115 | \r | |
2116 | @param Buffer Pointer to a 24-bit value that may be unaligned.\r | |
2117 | \r | |
5385a579 | 2118 | @return The 24-bit value read from Buffer.\r |
ac644614 | 2119 | \r |
2120 | **/\r | |
2121 | UINT32\r | |
2122 | EFIAPI\r | |
2123 | ReadUnaligned24 (\r | |
5385a579 | 2124 | IN CONST UINT32 *Buffer\r |
ac644614 | 2125 | );\r |
2126 | \r | |
2127 | \r | |
2128 | /**\r | |
2129 | Writes a 24-bit value to memory that may be unaligned.\r | |
2130 | \r | |
2131 | This function writes the 24-bit value specified by Value to Buffer. Value is\r | |
2132 | returned. The function guarantees that the write operation does not produce\r | |
2133 | an alignment fault.\r | |
2134 | \r | |
2135 | If the Buffer is NULL, then ASSERT().\r | |
2136 | \r | |
2137 | @param Buffer Pointer to a 24-bit value that may be unaligned.\r | |
2138 | @param Value 24-bit value to write to Buffer.\r | |
2139 | \r | |
5385a579 | 2140 | @return The 24-bit value to write to Buffer.\r |
ac644614 | 2141 | \r |
2142 | **/\r | |
2143 | UINT32\r | |
2144 | EFIAPI\r | |
2145 | WriteUnaligned24 (\r | |
5385a579 | 2146 | OUT UINT32 *Buffer,\r |
2147 | IN UINT32 Value\r | |
ac644614 | 2148 | );\r |
2149 | \r | |
2150 | \r | |
2151 | /**\r | |
2152 | Reads a 32-bit value from memory that may be unaligned.\r | |
2153 | \r | |
2154 | This function returns the 32-bit value pointed to by Buffer. The function\r | |
2155 | guarantees that the read operation does not produce an alignment fault.\r | |
2156 | \r | |
2157 | If the Buffer is NULL, then ASSERT().\r | |
2158 | \r | |
5385a579 | 2159 | @param Buffer Pointer to a 32-bit value that may be unaligned.\r |
ac644614 | 2160 | \r |
5385a579 | 2161 | @return The 32-bit value read from Buffer.\r |
ac644614 | 2162 | \r |
2163 | **/\r | |
2164 | UINT32\r | |
2165 | EFIAPI\r | |
2166 | ReadUnaligned32 (\r | |
5385a579 | 2167 | IN CONST UINT32 *Buffer\r |
ac644614 | 2168 | );\r |
2169 | \r | |
2170 | \r | |
2171 | /**\r | |
2172 | Writes a 32-bit value to memory that may be unaligned.\r | |
2173 | \r | |
2174 | This function writes the 32-bit value specified by Value to Buffer. Value is\r | |
2175 | returned. The function guarantees that the write operation does not produce\r | |
2176 | an alignment fault.\r | |
2177 | \r | |
2178 | If the Buffer is NULL, then ASSERT().\r | |
2179 | \r | |
5385a579 | 2180 | @param Buffer Pointer to a 32-bit value that may be unaligned.\r |
ac644614 | 2181 | @param Value 32-bit value to write to Buffer.\r |
2182 | \r | |
5385a579 | 2183 | @return The 32-bit value to write to Buffer.\r |
ac644614 | 2184 | \r |
2185 | **/\r | |
2186 | UINT32\r | |
2187 | EFIAPI\r | |
2188 | WriteUnaligned32 (\r | |
5385a579 | 2189 | OUT UINT32 *Buffer,\r |
2190 | IN UINT32 Value\r | |
ac644614 | 2191 | );\r |
2192 | \r | |
2193 | \r | |
2194 | /**\r | |
2195 | Reads a 64-bit value from memory that may be unaligned.\r | |
2196 | \r | |
2197 | This function returns the 64-bit value pointed to by Buffer. The function\r | |
2198 | guarantees that the read operation does not produce an alignment fault.\r | |
2199 | \r | |
2200 | If the Buffer is NULL, then ASSERT().\r | |
2201 | \r | |
5385a579 | 2202 | @param Buffer Pointer to a 64-bit value that may be unaligned.\r |
ac644614 | 2203 | \r |
5385a579 | 2204 | @return The 64-bit value read from Buffer.\r |
ac644614 | 2205 | \r |
2206 | **/\r | |
2207 | UINT64\r | |
2208 | EFIAPI\r | |
2209 | ReadUnaligned64 (\r | |
5385a579 | 2210 | IN CONST UINT64 *Buffer\r |
ac644614 | 2211 | );\r |
2212 | \r | |
2213 | \r | |
2214 | /**\r | |
2215 | Writes a 64-bit value to memory that may be unaligned.\r | |
2216 | \r | |
2217 | This function writes the 64-bit value specified by Value to Buffer. Value is\r | |
2218 | returned. The function guarantees that the write operation does not produce\r | |
2219 | an alignment fault.\r | |
2220 | \r | |
2221 | If the Buffer is NULL, then ASSERT().\r | |
2222 | \r | |
5385a579 | 2223 | @param Buffer Pointer to a 64-bit value that may be unaligned.\r |
ac644614 | 2224 | @param Value 64-bit value to write to Buffer.\r |
2225 | \r | |
5385a579 | 2226 | @return The 64-bit value to write to Buffer.\r |
ac644614 | 2227 | \r |
2228 | **/\r | |
2229 | UINT64\r | |
2230 | EFIAPI\r | |
2231 | WriteUnaligned64 (\r | |
5385a579 | 2232 | OUT UINT64 *Buffer,\r |
2233 | IN UINT64 Value\r | |
ac644614 | 2234 | );\r |
2235 | \r | |
2236 | \r | |
2237 | //\r | |
2238 | // Bit Field Functions\r | |
2239 | //\r | |
2240 | \r | |
2241 | /**\r | |
2242 | Returns a bit field from an 8-bit value.\r | |
2243 | \r | |
2244 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
2245 | \r | |
2246 | If 8-bit operations are not supported, then ASSERT().\r | |
2247 | If StartBit is greater than 7, then ASSERT().\r | |
2248 | If EndBit is greater than 7, then ASSERT().\r | |
2249 | If EndBit is less than StartBit, then ASSERT().\r | |
2250 | \r | |
2251 | @param Operand Operand on which to perform the bitfield operation.\r | |
2252 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2253 | Range 0..7.\r | |
2254 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2255 | Range 0..7.\r | |
2256 | \r | |
2257 | @return The bit field read.\r | |
2258 | \r | |
2259 | **/\r | |
2260 | UINT8\r | |
2261 | EFIAPI\r | |
2262 | BitFieldRead8 (\r | |
2263 | IN UINT8 Operand,\r | |
2264 | IN UINTN StartBit,\r | |
2265 | IN UINTN EndBit\r | |
2266 | );\r | |
2267 | \r | |
2268 | \r | |
2269 | /**\r | |
2270 | Writes a bit field to an 8-bit value, and returns the result.\r | |
2271 | \r | |
2272 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
2273 | Operand. All other bits in Operand are preserved. The new 8-bit value is\r | |
2274 | returned.\r | |
2275 | \r | |
2276 | If 8-bit operations are not supported, then ASSERT().\r | |
2277 | If StartBit is greater than 7, then ASSERT().\r | |
2278 | If EndBit is greater than 7, then ASSERT().\r | |
2279 | If EndBit is less than StartBit, then ASSERT().\r | |
2280 | \r | |
2281 | @param Operand Operand on which to perform the bitfield operation.\r | |
2282 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2283 | Range 0..7.\r | |
2284 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2285 | Range 0..7.\r | |
2286 | @param Value New value of the bit field.\r | |
2287 | \r | |
2288 | @return The new 8-bit value.\r | |
2289 | \r | |
2290 | **/\r | |
2291 | UINT8\r | |
2292 | EFIAPI\r | |
2293 | BitFieldWrite8 (\r | |
2294 | IN UINT8 Operand,\r | |
2295 | IN UINTN StartBit,\r | |
2296 | IN UINTN EndBit,\r | |
2297 | IN UINT8 Value\r | |
2298 | );\r | |
2299 | \r | |
2300 | \r | |
2301 | /**\r | |
2302 | Reads a bit field from an 8-bit value, performs a bitwise OR, and returns the\r | |
2303 | result.\r | |
2304 | \r | |
62991af2 | 2305 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 2306 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
2307 | Operand are preserved. The new 8-bit value is returned.\r | |
2308 | \r | |
2309 | If 8-bit operations are not supported, then ASSERT().\r | |
2310 | If StartBit is greater than 7, then ASSERT().\r | |
2311 | If EndBit is greater than 7, then ASSERT().\r | |
2312 | If EndBit is less than StartBit, then ASSERT().\r | |
2313 | \r | |
2314 | @param Operand Operand on which to perform the bitfield operation.\r | |
2315 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2316 | Range 0..7.\r | |
2317 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2318 | Range 0..7.\r | |
2319 | @param OrData The value to OR with the read value from the value\r | |
2320 | \r | |
2321 | @return The new 8-bit value.\r | |
2322 | \r | |
2323 | **/\r | |
2324 | UINT8\r | |
2325 | EFIAPI\r | |
2326 | BitFieldOr8 (\r | |
2327 | IN UINT8 Operand,\r | |
2328 | IN UINTN StartBit,\r | |
2329 | IN UINTN EndBit,\r | |
2330 | IN UINT8 OrData\r | |
2331 | );\r | |
2332 | \r | |
2333 | \r | |
2334 | /**\r | |
2335 | Reads a bit field from an 8-bit value, performs a bitwise AND, and returns\r | |
2336 | the result.\r | |
2337 | \r | |
2338 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
2339 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
2340 | preserved. The new 8-bit value is returned.\r | |
2341 | \r | |
2342 | If 8-bit operations are not supported, then ASSERT().\r | |
2343 | If StartBit is greater than 7, then ASSERT().\r | |
2344 | If EndBit is greater than 7, then ASSERT().\r | |
2345 | If EndBit is less than StartBit, then ASSERT().\r | |
2346 | \r | |
2347 | @param Operand Operand on which to perform the bitfield operation.\r | |
2348 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2349 | Range 0..7.\r | |
2350 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2351 | Range 0..7.\r | |
2352 | @param AndData The value to AND with the read value from the value.\r | |
2353 | \r | |
2354 | @return The new 8-bit value.\r | |
2355 | \r | |
2356 | **/\r | |
2357 | UINT8\r | |
2358 | EFIAPI\r | |
2359 | BitFieldAnd8 (\r | |
2360 | IN UINT8 Operand,\r | |
2361 | IN UINTN StartBit,\r | |
2362 | IN UINTN EndBit,\r | |
2363 | IN UINT8 AndData\r | |
2364 | );\r | |
2365 | \r | |
2366 | \r | |
2367 | /**\r | |
2368 | Reads a bit field from an 8-bit value, performs a bitwise AND followed by a\r | |
2369 | bitwise OR, and returns the result.\r | |
2370 | \r | |
2371 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 2372 | in Operand and the value specified by AndData, followed by a bitwise \r |
2373 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 2374 | preserved. The new 8-bit value is returned.\r |
2375 | \r | |
2376 | If 8-bit operations are not supported, then ASSERT().\r | |
2377 | If StartBit is greater than 7, then ASSERT().\r | |
2378 | If EndBit is greater than 7, then ASSERT().\r | |
2379 | If EndBit is less than StartBit, then ASSERT().\r | |
2380 | \r | |
2381 | @param Operand Operand on which to perform the bitfield operation.\r | |
2382 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2383 | Range 0..7.\r | |
2384 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2385 | Range 0..7.\r | |
2386 | @param AndData The value to AND with the read value from the value.\r | |
2387 | @param OrData The value to OR with the result of the AND operation.\r | |
2388 | \r | |
2389 | @return The new 8-bit value.\r | |
2390 | \r | |
2391 | **/\r | |
2392 | UINT8\r | |
2393 | EFIAPI\r | |
2394 | BitFieldAndThenOr8 (\r | |
2395 | IN UINT8 Operand,\r | |
2396 | IN UINTN StartBit,\r | |
2397 | IN UINTN EndBit,\r | |
2398 | IN UINT8 AndData,\r | |
2399 | IN UINT8 OrData\r | |
2400 | );\r | |
2401 | \r | |
2402 | \r | |
2403 | /**\r | |
2404 | Returns a bit field from a 16-bit value.\r | |
2405 | \r | |
2406 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
2407 | \r | |
2408 | If 16-bit operations are not supported, then ASSERT().\r | |
2409 | If StartBit is greater than 15, then ASSERT().\r | |
2410 | If EndBit is greater than 15, then ASSERT().\r | |
2411 | If EndBit is less than StartBit, then ASSERT().\r | |
2412 | \r | |
2413 | @param Operand Operand on which to perform the bitfield operation.\r | |
2414 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2415 | Range 0..15.\r | |
2416 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2417 | Range 0..15.\r | |
2418 | \r | |
2419 | @return The bit field read.\r | |
2420 | \r | |
2421 | **/\r | |
2422 | UINT16\r | |
2423 | EFIAPI\r | |
2424 | BitFieldRead16 (\r | |
2425 | IN UINT16 Operand,\r | |
2426 | IN UINTN StartBit,\r | |
2427 | IN UINTN EndBit\r | |
2428 | );\r | |
2429 | \r | |
2430 | \r | |
2431 | /**\r | |
2432 | Writes a bit field to a 16-bit value, and returns the result.\r | |
2433 | \r | |
2434 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
2435 | Operand. All other bits in Operand are preserved. The new 16-bit value is\r | |
2436 | returned.\r | |
2437 | \r | |
2438 | If 16-bit operations are not supported, then ASSERT().\r | |
2439 | If StartBit is greater than 15, then ASSERT().\r | |
2440 | If EndBit is greater than 15, then ASSERT().\r | |
2441 | If EndBit is less than StartBit, then ASSERT().\r | |
2442 | \r | |
2443 | @param Operand Operand on which to perform the bitfield operation.\r | |
2444 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2445 | Range 0..15.\r | |
2446 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2447 | Range 0..15.\r | |
2448 | @param Value New value of the bit field.\r | |
2449 | \r | |
2450 | @return The new 16-bit value.\r | |
2451 | \r | |
2452 | **/\r | |
2453 | UINT16\r | |
2454 | EFIAPI\r | |
2455 | BitFieldWrite16 (\r | |
2456 | IN UINT16 Operand,\r | |
2457 | IN UINTN StartBit,\r | |
2458 | IN UINTN EndBit,\r | |
2459 | IN UINT16 Value\r | |
2460 | );\r | |
2461 | \r | |
2462 | \r | |
2463 | /**\r | |
2464 | Reads a bit field from a 16-bit value, performs a bitwise OR, and returns the\r | |
2465 | result.\r | |
2466 | \r | |
62991af2 | 2467 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 2468 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
2469 | Operand are preserved. The new 16-bit value is returned.\r | |
2470 | \r | |
2471 | If 16-bit operations are not supported, then ASSERT().\r | |
2472 | If StartBit is greater than 15, then ASSERT().\r | |
2473 | If EndBit is greater than 15, then ASSERT().\r | |
2474 | If EndBit is less than StartBit, then ASSERT().\r | |
2475 | \r | |
2476 | @param Operand Operand on which to perform the bitfield operation.\r | |
2477 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2478 | Range 0..15.\r | |
2479 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2480 | Range 0..15.\r | |
2481 | @param OrData The value to OR with the read value from the value\r | |
2482 | \r | |
2483 | @return The new 16-bit value.\r | |
2484 | \r | |
2485 | **/\r | |
2486 | UINT16\r | |
2487 | EFIAPI\r | |
2488 | BitFieldOr16 (\r | |
2489 | IN UINT16 Operand,\r | |
2490 | IN UINTN StartBit,\r | |
2491 | IN UINTN EndBit,\r | |
2492 | IN UINT16 OrData\r | |
2493 | );\r | |
2494 | \r | |
2495 | \r | |
2496 | /**\r | |
2497 | Reads a bit field from a 16-bit value, performs a bitwise AND, and returns\r | |
2498 | the result.\r | |
2499 | \r | |
2500 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
2501 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
2502 | preserved. The new 16-bit value is returned.\r | |
2503 | \r | |
2504 | If 16-bit operations are not supported, then ASSERT().\r | |
2505 | If StartBit is greater than 15, then ASSERT().\r | |
2506 | If EndBit is greater than 15, then ASSERT().\r | |
2507 | If EndBit is less than StartBit, then ASSERT().\r | |
2508 | \r | |
2509 | @param Operand Operand on which to perform the bitfield operation.\r | |
2510 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2511 | Range 0..15.\r | |
2512 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2513 | Range 0..15.\r | |
2514 | @param AndData The value to AND with the read value from the value\r | |
2515 | \r | |
2516 | @return The new 16-bit value.\r | |
2517 | \r | |
2518 | **/\r | |
2519 | UINT16\r | |
2520 | EFIAPI\r | |
2521 | BitFieldAnd16 (\r | |
2522 | IN UINT16 Operand,\r | |
2523 | IN UINTN StartBit,\r | |
2524 | IN UINTN EndBit,\r | |
2525 | IN UINT16 AndData\r | |
2526 | );\r | |
2527 | \r | |
2528 | \r | |
2529 | /**\r | |
2530 | Reads a bit field from a 16-bit value, performs a bitwise AND followed by a\r | |
2531 | bitwise OR, and returns the result.\r | |
2532 | \r | |
2533 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 2534 | in Operand and the value specified by AndData, followed by a bitwise \r |
2535 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 2536 | preserved. The new 16-bit value is returned.\r |
2537 | \r | |
2538 | If 16-bit operations are not supported, then ASSERT().\r | |
2539 | If StartBit is greater than 15, then ASSERT().\r | |
2540 | If EndBit is greater than 15, then ASSERT().\r | |
2541 | If EndBit is less than StartBit, then ASSERT().\r | |
2542 | \r | |
2543 | @param Operand Operand on which to perform the bitfield operation.\r | |
2544 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2545 | Range 0..15.\r | |
2546 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2547 | Range 0..15.\r | |
2548 | @param AndData The value to AND with the read value from the value.\r | |
2549 | @param OrData The value to OR with the result of the AND operation.\r | |
2550 | \r | |
2551 | @return The new 16-bit value.\r | |
2552 | \r | |
2553 | **/\r | |
2554 | UINT16\r | |
2555 | EFIAPI\r | |
2556 | BitFieldAndThenOr16 (\r | |
2557 | IN UINT16 Operand,\r | |
2558 | IN UINTN StartBit,\r | |
2559 | IN UINTN EndBit,\r | |
2560 | IN UINT16 AndData,\r | |
2561 | IN UINT16 OrData\r | |
2562 | );\r | |
2563 | \r | |
2564 | \r | |
2565 | /**\r | |
2566 | Returns a bit field from a 32-bit value.\r | |
2567 | \r | |
2568 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
2569 | \r | |
2570 | If 32-bit operations are not supported, then ASSERT().\r | |
2571 | If StartBit is greater than 31, then ASSERT().\r | |
2572 | If EndBit is greater than 31, then ASSERT().\r | |
2573 | If EndBit is less than StartBit, then ASSERT().\r | |
2574 | \r | |
2575 | @param Operand Operand on which to perform the bitfield operation.\r | |
2576 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2577 | Range 0..31.\r | |
2578 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2579 | Range 0..31.\r | |
2580 | \r | |
2581 | @return The bit field read.\r | |
2582 | \r | |
2583 | **/\r | |
2584 | UINT32\r | |
2585 | EFIAPI\r | |
2586 | BitFieldRead32 (\r | |
2587 | IN UINT32 Operand,\r | |
2588 | IN UINTN StartBit,\r | |
2589 | IN UINTN EndBit\r | |
2590 | );\r | |
2591 | \r | |
2592 | \r | |
2593 | /**\r | |
2594 | Writes a bit field to a 32-bit value, and returns the result.\r | |
2595 | \r | |
2596 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
2597 | Operand. All other bits in Operand are preserved. The new 32-bit value is\r | |
2598 | returned.\r | |
2599 | \r | |
2600 | If 32-bit operations are not supported, then ASSERT().\r | |
2601 | If StartBit is greater than 31, then ASSERT().\r | |
2602 | If EndBit is greater than 31, then ASSERT().\r | |
2603 | If EndBit is less than StartBit, then ASSERT().\r | |
2604 | \r | |
2605 | @param Operand Operand on which to perform the bitfield operation.\r | |
2606 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2607 | Range 0..31.\r | |
2608 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2609 | Range 0..31.\r | |
2610 | @param Value New value of the bit field.\r | |
2611 | \r | |
2612 | @return The new 32-bit value.\r | |
2613 | \r | |
2614 | **/\r | |
2615 | UINT32\r | |
2616 | EFIAPI\r | |
2617 | BitFieldWrite32 (\r | |
2618 | IN UINT32 Operand,\r | |
2619 | IN UINTN StartBit,\r | |
2620 | IN UINTN EndBit,\r | |
2621 | IN UINT32 Value\r | |
2622 | );\r | |
2623 | \r | |
2624 | \r | |
2625 | /**\r | |
2626 | Reads a bit field from a 32-bit value, performs a bitwise OR, and returns the\r | |
2627 | result.\r | |
2628 | \r | |
62991af2 | 2629 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 2630 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
2631 | Operand are preserved. The new 32-bit value is returned.\r | |
2632 | \r | |
2633 | If 32-bit operations are not supported, then ASSERT().\r | |
2634 | If StartBit is greater than 31, then ASSERT().\r | |
2635 | If EndBit is greater than 31, then ASSERT().\r | |
2636 | If EndBit is less than StartBit, then ASSERT().\r | |
2637 | \r | |
2638 | @param Operand Operand on which to perform the bitfield operation.\r | |
2639 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2640 | Range 0..31.\r | |
2641 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2642 | Range 0..31.\r | |
2643 | @param OrData The value to OR with the read value from the value\r | |
2644 | \r | |
2645 | @return The new 32-bit value.\r | |
2646 | \r | |
2647 | **/\r | |
2648 | UINT32\r | |
2649 | EFIAPI\r | |
2650 | BitFieldOr32 (\r | |
2651 | IN UINT32 Operand,\r | |
2652 | IN UINTN StartBit,\r | |
2653 | IN UINTN EndBit,\r | |
2654 | IN UINT32 OrData\r | |
2655 | );\r | |
2656 | \r | |
2657 | \r | |
2658 | /**\r | |
2659 | Reads a bit field from a 32-bit value, performs a bitwise AND, and returns\r | |
2660 | the result.\r | |
2661 | \r | |
2662 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
2663 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
2664 | preserved. The new 32-bit value is returned.\r | |
2665 | \r | |
2666 | If 32-bit operations are not supported, then ASSERT().\r | |
2667 | If StartBit is greater than 31, then ASSERT().\r | |
2668 | If EndBit is greater than 31, then ASSERT().\r | |
2669 | If EndBit is less than StartBit, then ASSERT().\r | |
2670 | \r | |
2671 | @param Operand Operand on which to perform the bitfield operation.\r | |
2672 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2673 | Range 0..31.\r | |
2674 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2675 | Range 0..31.\r | |
2676 | @param AndData The value to AND with the read value from the value\r | |
2677 | \r | |
2678 | @return The new 32-bit value.\r | |
2679 | \r | |
2680 | **/\r | |
2681 | UINT32\r | |
2682 | EFIAPI\r | |
2683 | BitFieldAnd32 (\r | |
2684 | IN UINT32 Operand,\r | |
2685 | IN UINTN StartBit,\r | |
2686 | IN UINTN EndBit,\r | |
2687 | IN UINT32 AndData\r | |
2688 | );\r | |
2689 | \r | |
2690 | \r | |
2691 | /**\r | |
2692 | Reads a bit field from a 32-bit value, performs a bitwise AND followed by a\r | |
2693 | bitwise OR, and returns the result.\r | |
2694 | \r | |
2695 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 2696 | in Operand and the value specified by AndData, followed by a bitwise \r |
2697 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 2698 | preserved. The new 32-bit value is returned.\r |
2699 | \r | |
2700 | If 32-bit operations are not supported, then ASSERT().\r | |
2701 | If StartBit is greater than 31, then ASSERT().\r | |
2702 | If EndBit is greater than 31, then ASSERT().\r | |
2703 | If EndBit is less than StartBit, then ASSERT().\r | |
2704 | \r | |
2705 | @param Operand Operand on which to perform the bitfield operation.\r | |
2706 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2707 | Range 0..31.\r | |
2708 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2709 | Range 0..31.\r | |
2710 | @param AndData The value to AND with the read value from the value.\r | |
2711 | @param OrData The value to OR with the result of the AND operation.\r | |
2712 | \r | |
2713 | @return The new 32-bit value.\r | |
2714 | \r | |
2715 | **/\r | |
2716 | UINT32\r | |
2717 | EFIAPI\r | |
2718 | BitFieldAndThenOr32 (\r | |
2719 | IN UINT32 Operand,\r | |
2720 | IN UINTN StartBit,\r | |
2721 | IN UINTN EndBit,\r | |
2722 | IN UINT32 AndData,\r | |
2723 | IN UINT32 OrData\r | |
2724 | );\r | |
2725 | \r | |
2726 | \r | |
2727 | /**\r | |
2728 | Returns a bit field from a 64-bit value.\r | |
2729 | \r | |
2730 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
2731 | \r | |
2732 | If 64-bit operations are not supported, then ASSERT().\r | |
2733 | If StartBit is greater than 63, then ASSERT().\r | |
2734 | If EndBit is greater than 63, then ASSERT().\r | |
2735 | If EndBit is less than StartBit, then ASSERT().\r | |
2736 | \r | |
2737 | @param Operand Operand on which to perform the bitfield operation.\r | |
2738 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2739 | Range 0..63.\r | |
2740 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2741 | Range 0..63.\r | |
2742 | \r | |
2743 | @return The bit field read.\r | |
2744 | \r | |
2745 | **/\r | |
2746 | UINT64\r | |
2747 | EFIAPI\r | |
2748 | BitFieldRead64 (\r | |
2749 | IN UINT64 Operand,\r | |
2750 | IN UINTN StartBit,\r | |
2751 | IN UINTN EndBit\r | |
2752 | );\r | |
2753 | \r | |
2754 | \r | |
2755 | /**\r | |
2756 | Writes a bit field to a 64-bit value, and returns the result.\r | |
2757 | \r | |
2758 | Writes Value to the bit field specified by the StartBit and the EndBit in\r | |
2759 | Operand. All other bits in Operand are preserved. The new 64-bit value is\r | |
2760 | returned.\r | |
2761 | \r | |
2762 | If 64-bit operations are not supported, then ASSERT().\r | |
2763 | If StartBit is greater than 63, then ASSERT().\r | |
2764 | If EndBit is greater than 63, then ASSERT().\r | |
2765 | If EndBit is less than StartBit, then ASSERT().\r | |
2766 | \r | |
2767 | @param Operand Operand on which to perform the bitfield operation.\r | |
2768 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2769 | Range 0..63.\r | |
2770 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2771 | Range 0..63.\r | |
2772 | @param Value New value of the bit field.\r | |
2773 | \r | |
2774 | @return The new 64-bit value.\r | |
2775 | \r | |
2776 | **/\r | |
2777 | UINT64\r | |
2778 | EFIAPI\r | |
2779 | BitFieldWrite64 (\r | |
2780 | IN UINT64 Operand,\r | |
2781 | IN UINTN StartBit,\r | |
2782 | IN UINTN EndBit,\r | |
2783 | IN UINT64 Value\r | |
2784 | );\r | |
2785 | \r | |
2786 | \r | |
2787 | /**\r | |
2788 | Reads a bit field from a 64-bit value, performs a bitwise OR, and returns the\r | |
2789 | result.\r | |
2790 | \r | |
62991af2 | 2791 | Performs a bitwise OR between the bit field specified by StartBit\r |
ac644614 | 2792 | and EndBit in Operand and the value specified by OrData. All other bits in\r |
2793 | Operand are preserved. The new 64-bit value is returned.\r | |
2794 | \r | |
2795 | If 64-bit operations are not supported, then ASSERT().\r | |
2796 | If StartBit is greater than 63, then ASSERT().\r | |
2797 | If EndBit is greater than 63, then ASSERT().\r | |
2798 | If EndBit is less than StartBit, then ASSERT().\r | |
2799 | \r | |
2800 | @param Operand Operand on which to perform the bitfield operation.\r | |
2801 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2802 | Range 0..63.\r | |
2803 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2804 | Range 0..63.\r | |
2805 | @param OrData The value to OR with the read value from the value\r | |
2806 | \r | |
2807 | @return The new 64-bit value.\r | |
2808 | \r | |
2809 | **/\r | |
2810 | UINT64\r | |
2811 | EFIAPI\r | |
2812 | BitFieldOr64 (\r | |
2813 | IN UINT64 Operand,\r | |
2814 | IN UINTN StartBit,\r | |
2815 | IN UINTN EndBit,\r | |
2816 | IN UINT64 OrData\r | |
2817 | );\r | |
2818 | \r | |
2819 | \r | |
2820 | /**\r | |
2821 | Reads a bit field from a 64-bit value, performs a bitwise AND, and returns\r | |
2822 | the result.\r | |
2823 | \r | |
2824 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
2825 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
2826 | preserved. The new 64-bit value is returned.\r | |
2827 | \r | |
2828 | If 64-bit operations are not supported, then ASSERT().\r | |
2829 | If StartBit is greater than 63, then ASSERT().\r | |
2830 | If EndBit is greater than 63, then ASSERT().\r | |
2831 | If EndBit is less than StartBit, then ASSERT().\r | |
2832 | \r | |
2833 | @param Operand Operand on which to perform the bitfield operation.\r | |
2834 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2835 | Range 0..63.\r | |
2836 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2837 | Range 0..63.\r | |
2838 | @param AndData The value to AND with the read value from the value\r | |
2839 | \r | |
2840 | @return The new 64-bit value.\r | |
2841 | \r | |
2842 | **/\r | |
2843 | UINT64\r | |
2844 | EFIAPI\r | |
2845 | BitFieldAnd64 (\r | |
2846 | IN UINT64 Operand,\r | |
2847 | IN UINTN StartBit,\r | |
2848 | IN UINTN EndBit,\r | |
2849 | IN UINT64 AndData\r | |
2850 | );\r | |
2851 | \r | |
2852 | \r | |
2853 | /**\r | |
2854 | Reads a bit field from a 64-bit value, performs a bitwise AND followed by a\r | |
2855 | bitwise OR, and returns the result.\r | |
2856 | \r | |
2857 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
62991af2 | 2858 | in Operand and the value specified by AndData, followed by a bitwise \r |
2859 | OR with value specified by OrData. All other bits in Operand are\r | |
ac644614 | 2860 | preserved. The new 64-bit value is returned.\r |
2861 | \r | |
2862 | If 64-bit operations are not supported, then ASSERT().\r | |
2863 | If StartBit is greater than 63, then ASSERT().\r | |
2864 | If EndBit is greater than 63, then ASSERT().\r | |
2865 | If EndBit is less than StartBit, then ASSERT().\r | |
2866 | \r | |
2867 | @param Operand Operand on which to perform the bitfield operation.\r | |
2868 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
2869 | Range 0..63.\r | |
2870 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
2871 | Range 0..63.\r | |
2872 | @param AndData The value to AND with the read value from the value.\r | |
2873 | @param OrData The value to OR with the result of the AND operation.\r | |
2874 | \r | |
2875 | @return The new 64-bit value.\r | |
2876 | \r | |
2877 | **/\r | |
2878 | UINT64\r | |
2879 | EFIAPI\r | |
2880 | BitFieldAndThenOr64 (\r | |
2881 | IN UINT64 Operand,\r | |
2882 | IN UINTN StartBit,\r | |
2883 | IN UINTN EndBit,\r | |
2884 | IN UINT64 AndData,\r | |
2885 | IN UINT64 OrData\r | |
2886 | );\r | |
2887 | \r | |
ac644614 | 2888 | //\r |
2889 | // Base Library Checksum Functions\r | |
2890 | //\r | |
2891 | \r | |
2892 | /**\r | |
17f695ed | 2893 | Returns the sum of all elements in a buffer in unit of UINT8.\r |
ac644614 | 2894 | During calculation, the carry bits are dropped.\r |
2895 | \r | |
2896 | This function calculates the sum of all elements in a buffer\r | |
2897 | in unit of UINT8. The carry bits in result of addition are dropped.\r | |
2898 | The result is returned as UINT8. If Length is Zero, then Zero is\r | |
2899 | returned.\r | |
2900 | \r | |
2901 | If Buffer is NULL, then ASSERT().\r | |
2902 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
2903 | \r | |
1106ffe1 | 2904 | @param Buffer Pointer to the buffer to carry out the sum operation.\r |
17f695ed | 2905 | @param Length The size, in bytes, of Buffer.\r |
ac644614 | 2906 | \r |
2907 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
2908 | \r | |
2909 | **/\r | |
2910 | UINT8\r | |
2911 | EFIAPI\r | |
2912 | CalculateSum8 (\r | |
ee6c452c | 2913 | IN CONST UINT8 *Buffer,\r |
2914 | IN UINTN Length\r | |
ac644614 | 2915 | );\r |
2916 | \r | |
2917 | \r | |
2918 | /**\r | |
2919 | Returns the two's complement checksum of all elements in a buffer\r | |
2920 | of 8-bit values.\r | |
2921 | \r | |
2922 | This function first calculates the sum of the 8-bit values in the\r | |
2923 | buffer specified by Buffer and Length. The carry bits in the result\r | |
2924 | of addition are dropped. Then, the two's complement of the sum is\r | |
2925 | returned. If Length is 0, then 0 is returned.\r | |
2926 | \r | |
2927 | If Buffer is NULL, then ASSERT().\r | |
2928 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
2929 | \r | |
1106ffe1 | 2930 | @param Buffer Pointer to the buffer to carry out the checksum operation.\r |
2931 | @param Length The size, in bytes, of Buffer.\r | |
ac644614 | 2932 | \r |
ee6c452c | 2933 | @return Checksum The 2's complement checksum of Buffer.\r |
ac644614 | 2934 | \r |
2935 | **/\r | |
2936 | UINT8\r | |
2937 | EFIAPI\r | |
2938 | CalculateCheckSum8 (\r | |
ee6c452c | 2939 | IN CONST UINT8 *Buffer,\r |
2940 | IN UINTN Length\r | |
ac644614 | 2941 | );\r |
2942 | \r | |
2943 | \r | |
2944 | /**\r | |
2945 | Returns the sum of all elements in a buffer of 16-bit values. During\r | |
2946 | calculation, the carry bits are dropped.\r | |
2947 | \r | |
2948 | This function calculates the sum of the 16-bit values in the buffer\r | |
2949 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
2950 | The 16-bit result is returned. If Length is 0, then 0 is returned.\r | |
2951 | \r | |
2952 | If Buffer is NULL, then ASSERT().\r | |
2953 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
2954 | If Length is not aligned on a 16-bit boundary, then ASSERT().\r | |
2955 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
2956 | \r | |
1106ffe1 | 2957 | @param Buffer Pointer to the buffer to carry out the sum operation.\r |
2958 | @param Length The size, in bytes, of Buffer.\r | |
ac644614 | 2959 | \r |
2960 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
2961 | \r | |
2962 | **/\r | |
2963 | UINT16\r | |
2964 | EFIAPI\r | |
2965 | CalculateSum16 (\r | |
ee6c452c | 2966 | IN CONST UINT16 *Buffer,\r |
2967 | IN UINTN Length\r | |
ac644614 | 2968 | );\r |
2969 | \r | |
2970 | \r | |
2971 | /**\r | |
2972 | Returns the two's complement checksum of all elements in a buffer of\r | |
2973 | 16-bit values.\r | |
2974 | \r | |
2975 | This function first calculates the sum of the 16-bit values in the buffer\r | |
2976 | specified by Buffer and Length. The carry bits in the result of addition\r | |
2977 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
2978 | is 0, then 0 is returned.\r | |
2979 | \r | |
2980 | If Buffer is NULL, then ASSERT().\r | |
2981 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
2982 | If Length is not aligned on a 16-bit boundary, then ASSERT().\r | |
2983 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
2984 | \r | |
1106ffe1 | 2985 | @param Buffer Pointer to the buffer to carry out the checksum operation.\r |
2986 | @param Length The size, in bytes, of Buffer.\r | |
ac644614 | 2987 | \r |
ee6c452c | 2988 | @return Checksum The 2's complement checksum of Buffer.\r |
ac644614 | 2989 | \r |
2990 | **/\r | |
2991 | UINT16\r | |
2992 | EFIAPI\r | |
2993 | CalculateCheckSum16 (\r | |
ee6c452c | 2994 | IN CONST UINT16 *Buffer,\r |
2995 | IN UINTN Length\r | |
ac644614 | 2996 | );\r |
2997 | \r | |
2998 | \r | |
2999 | /**\r | |
17f695ed | 3000 | Returns the sum of all elements in a buffer of 32-bit values. During\r |
ac644614 | 3001 | calculation, the carry bits are dropped.\r |
3002 | \r | |
3003 | This function calculates the sum of the 32-bit values in the buffer\r | |
3004 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
17f695ed | 3005 | The 32-bit result is returned. If Length is 0, then 0 is returned.\r |
ac644614 | 3006 | \r |
3007 | If Buffer is NULL, then ASSERT().\r | |
3008 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
3009 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
3010 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
3011 | \r | |
1106ffe1 | 3012 | @param Buffer Pointer to the buffer to carry out the sum operation.\r |
3013 | @param Length The size, in bytes, of Buffer.\r | |
ac644614 | 3014 | \r |
3015 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
3016 | \r | |
3017 | **/\r | |
3018 | UINT32\r | |
3019 | EFIAPI\r | |
3020 | CalculateSum32 (\r | |
ee6c452c | 3021 | IN CONST UINT32 *Buffer,\r |
3022 | IN UINTN Length\r | |
ac644614 | 3023 | );\r |
3024 | \r | |
3025 | \r | |
3026 | /**\r | |
3027 | Returns the two's complement checksum of all elements in a buffer of\r | |
3028 | 32-bit values.\r | |
3029 | \r | |
3030 | This function first calculates the sum of the 32-bit values in the buffer\r | |
3031 | specified by Buffer and Length. The carry bits in the result of addition\r | |
3032 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
3033 | is 0, then 0 is returned.\r | |
3034 | \r | |
3035 | If Buffer is NULL, then ASSERT().\r | |
3036 | If Buffer is not aligned on a 32-bit boundary, then ASSERT().\r | |
3037 | If Length is not aligned on a 32-bit boundary, then ASSERT().\r | |
3038 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
3039 | \r | |
1106ffe1 | 3040 | @param Buffer Pointer to the buffer to carry out the checksum operation.\r |
3041 | @param Length The size, in bytes, of Buffer.\r | |
ac644614 | 3042 | \r |
ee6c452c | 3043 | @return Checksum The 2's complement checksum of Buffer.\r |
ac644614 | 3044 | \r |
3045 | **/\r | |
3046 | UINT32\r | |
3047 | EFIAPI\r | |
3048 | CalculateCheckSum32 (\r | |
ee6c452c | 3049 | IN CONST UINT32 *Buffer,\r |
3050 | IN UINTN Length\r | |
ac644614 | 3051 | );\r |
3052 | \r | |
3053 | \r | |
3054 | /**\r | |
3055 | Returns the sum of all elements in a buffer of 64-bit values. During\r | |
3056 | calculation, the carry bits are dropped.\r | |
3057 | \r | |
3058 | This function calculates the sum of the 64-bit values in the buffer\r | |
3059 | specified by Buffer and Length. The carry bits in result of addition are dropped.\r | |
3060 | The 64-bit result is returned. If Length is 0, then 0 is returned.\r | |
3061 | \r | |
3062 | If Buffer is NULL, then ASSERT().\r | |
3063 | If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r | |
3064 | If Length is not aligned on a 64-bit boundary, then ASSERT().\r | |
3065 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
3066 | \r | |
1106ffe1 | 3067 | @param Buffer Pointer to the buffer to carry out the sum operation.\r |
3068 | @param Length The size, in bytes, of Buffer.\r | |
ac644614 | 3069 | \r |
3070 | @return Sum The sum of Buffer with carry bits dropped during additions.\r | |
3071 | \r | |
3072 | **/\r | |
3073 | UINT64\r | |
3074 | EFIAPI\r | |
3075 | CalculateSum64 (\r | |
ee6c452c | 3076 | IN CONST UINT64 *Buffer,\r |
3077 | IN UINTN Length\r | |
ac644614 | 3078 | );\r |
3079 | \r | |
3080 | \r | |
3081 | /**\r | |
3082 | Returns the two's complement checksum of all elements in a buffer of\r | |
3083 | 64-bit values.\r | |
3084 | \r | |
3085 | This function first calculates the sum of the 64-bit values in the buffer\r | |
3086 | specified by Buffer and Length. The carry bits in the result of addition\r | |
3087 | are dropped. Then, the two's complement of the sum is returned. If Length\r | |
3088 | is 0, then 0 is returned.\r | |
3089 | \r | |
3090 | If Buffer is NULL, then ASSERT().\r | |
3091 | If Buffer is not aligned on a 64-bit boundary, then ASSERT().\r | |
3092 | If Length is not aligned on a 64-bit boundary, then ASSERT().\r | |
3093 | If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r | |
3094 | \r | |
1106ffe1 | 3095 | @param Buffer Pointer to the buffer to carry out the checksum operation.\r |
3096 | @param Length The size, in bytes, of Buffer.\r | |
ac644614 | 3097 | \r |
ee6c452c | 3098 | @return Checksum The 2's complement checksum of Buffer.\r |
ac644614 | 3099 | \r |
3100 | **/\r | |
3101 | UINT64\r | |
3102 | EFIAPI\r | |
3103 | CalculateCheckSum64 (\r | |
ee6c452c | 3104 | IN CONST UINT64 *Buffer,\r |
3105 | IN UINTN Length\r | |
ac644614 | 3106 | );\r |
3107 | \r | |
3108 | \r | |
d75f9fc2 | 3109 | //\r |
3110 | // Base Library CPU Functions\r | |
3111 | //\r | |
3112 | \r | |
3113 | /**\r | |
3114 | Function entry point used when a stack switch is requested with SwitchStack()\r | |
3115 | \r | |
3116 | @param Context1 Context1 parameter passed into SwitchStack().\r | |
3117 | @param Context2 Context2 parameter passed into SwitchStack().\r | |
3118 | \r | |
3119 | **/\r | |
ac644614 | 3120 | typedef\r |
3121 | VOID\r | |
9810cdd8 | 3122 | (EFIAPI *SWITCH_STACK_ENTRY_POINT)(\r |
ac644614 | 3123 | IN VOID *Context1, OPTIONAL\r |
3124 | IN VOID *Context2 OPTIONAL\r | |
3125 | );\r | |
3126 | \r | |
3127 | \r | |
3128 | /**\r | |
3129 | Used to serialize load and store operations.\r | |
3130 | \r | |
3131 | All loads and stores that proceed calls to this function are guaranteed to be\r | |
3132 | globally visible when this function returns.\r | |
3133 | \r | |
3134 | **/\r | |
3135 | VOID\r | |
3136 | EFIAPI\r | |
3137 | MemoryFence (\r | |
3138 | VOID\r | |
3139 | );\r | |
3140 | \r | |
3141 | \r | |
3142 | /**\r | |
3143 | Saves the current CPU context that can be restored with a call to LongJump()\r | |
3144 | and returns 0.\r | |
3145 | \r | |
3146 | Saves the current CPU context in the buffer specified by JumpBuffer and\r | |
3147 | returns 0. The initial call to SetJump() must always return 0. Subsequent\r | |
3148 | calls to LongJump() cause a non-zero value to be returned by SetJump().\r | |
3149 | \r | |
3150 | If JumpBuffer is NULL, then ASSERT().\r | |
3151 | For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
17f695ed | 3152 | \r |
3153 | NOTE: The structure BASE_LIBRARY_JUMP_BUFFER is CPU architecture specific.\r | |
3154 | The same structure must never be used for more than one CPU architecture context.\r | |
3155 | For example, a BASE_LIBRARY_JUMP_BUFFER allocated by an IA-32 module must never be used from an x64 module. \r | |
3156 | SetJump()/LongJump() is not currently supported for the EBC processor type. \r | |
ac644614 | 3157 | \r |
3158 | @param JumpBuffer A pointer to CPU context buffer.\r | |
3159 | \r | |
3160 | @retval 0 Indicates a return from SetJump().\r | |
3161 | \r | |
3162 | **/\r | |
3163 | UINTN\r | |
3164 | EFIAPI\r | |
3165 | SetJump (\r | |
3166 | OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r | |
3167 | );\r | |
3168 | \r | |
3169 | \r | |
3170 | /**\r | |
3171 | Restores the CPU context that was saved with SetJump().\r | |
3172 | \r | |
3173 | Restores the CPU context from the buffer specified by JumpBuffer. This\r | |
3174 | function never returns to the caller. Instead is resumes execution based on\r | |
3175 | the state of JumpBuffer.\r | |
3176 | \r | |
3177 | If JumpBuffer is NULL, then ASSERT().\r | |
3178 | For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
3179 | If Value is 0, then ASSERT().\r | |
3180 | \r | |
3181 | @param JumpBuffer A pointer to CPU context buffer.\r | |
3182 | @param Value The value to return when the SetJump() context is\r | |
3183 | restored and must be non-zero.\r | |
3184 | \r | |
3185 | **/\r | |
3186 | VOID\r | |
3187 | EFIAPI\r | |
3188 | LongJump (\r | |
3189 | IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,\r | |
3190 | IN UINTN Value\r | |
3191 | );\r | |
3192 | \r | |
3193 | \r | |
3194 | /**\r | |
3195 | Enables CPU interrupts.\r | |
3196 | \r | |
ac644614 | 3197 | **/\r |
3198 | VOID\r | |
3199 | EFIAPI\r | |
3200 | EnableInterrupts (\r | |
3201 | VOID\r | |
3202 | );\r | |
3203 | \r | |
3204 | \r | |
3205 | /**\r | |
3206 | Disables CPU interrupts.\r | |
3207 | \r | |
ac644614 | 3208 | **/\r |
3209 | VOID\r | |
3210 | EFIAPI\r | |
3211 | DisableInterrupts (\r | |
3212 | VOID\r | |
3213 | );\r | |
3214 | \r | |
3215 | \r | |
3216 | /**\r | |
3217 | Disables CPU interrupts and returns the interrupt state prior to the disable\r | |
3218 | operation.\r | |
3219 | \r | |
ac644614 | 3220 | @retval TRUE CPU interrupts were enabled on entry to this call.\r |
3221 | @retval FALSE CPU interrupts were disabled on entry to this call.\r | |
3222 | \r | |
3223 | **/\r | |
3224 | BOOLEAN\r | |
3225 | EFIAPI\r | |
3226 | SaveAndDisableInterrupts (\r | |
3227 | VOID\r | |
3228 | );\r | |
3229 | \r | |
3230 | \r | |
3231 | /**\r | |
3232 | Enables CPU interrupts for the smallest window required to capture any\r | |
3233 | pending interrupts.\r | |
3234 | \r | |
ac644614 | 3235 | **/\r |
3236 | VOID\r | |
3237 | EFIAPI\r | |
3238 | EnableDisableInterrupts (\r | |
3239 | VOID\r | |
3240 | );\r | |
3241 | \r | |
3242 | \r | |
3243 | /**\r | |
3244 | Retrieves the current CPU interrupt state.\r | |
3245 | \r | |
38bbd3d9 | 3246 | Returns TRUE is interrupts are currently enabled. Otherwise\r |
3247 | returns FALSE.\r | |
ac644614 | 3248 | \r |
3249 | @retval TRUE CPU interrupts are enabled.\r | |
3250 | @retval FALSE CPU interrupts are disabled.\r | |
3251 | \r | |
3252 | **/\r | |
3253 | BOOLEAN\r | |
3254 | EFIAPI\r | |
3255 | GetInterruptState (\r | |
3256 | VOID\r | |
3257 | );\r | |
3258 | \r | |
3259 | \r | |
3260 | /**\r | |
3261 | Set the current CPU interrupt state.\r | |
3262 | \r | |
3263 | Sets the current CPU interrupt state to the state specified by\r | |
3264 | InterruptState. If InterruptState is TRUE, then interrupts are enabled. If\r | |
3265 | InterruptState is FALSE, then interrupts are disabled. InterruptState is\r | |
3266 | returned.\r | |
3267 | \r | |
3268 | @param InterruptState TRUE if interrupts should enabled. FALSE if\r | |
3269 | interrupts should be disabled.\r | |
3270 | \r | |
3271 | @return InterruptState\r | |
3272 | \r | |
3273 | **/\r | |
3274 | BOOLEAN\r | |
3275 | EFIAPI\r | |
3276 | SetInterruptState (\r | |
3277 | IN BOOLEAN InterruptState\r | |
3278 | );\r | |
3279 | \r | |
3280 | \r | |
3281 | /**\r | |
3282 | Requests CPU to pause for a short period of time.\r | |
3283 | \r | |
3284 | Requests CPU to pause for a short period of time. Typically used in MP\r | |
3285 | systems to prevent memory starvation while waiting for a spin lock.\r | |
3286 | \r | |
3287 | **/\r | |
3288 | VOID\r | |
3289 | EFIAPI\r | |
3290 | CpuPause (\r | |
3291 | VOID\r | |
3292 | );\r | |
3293 | \r | |
3294 | \r | |
3295 | /**\r | |
3296 | Transfers control to a function starting with a new stack.\r | |
3297 | \r | |
3298 | Transfers control to the function specified by EntryPoint using the\r | |
3299 | new stack specified by NewStack and passing in the parameters specified\r | |
3300 | by Context1 and Context2. Context1 and Context2 are optional and may\r | |
3301 | be NULL. The function EntryPoint must never return. This function\r | |
3302 | supports a variable number of arguments following the NewStack parameter.\r | |
3303 | These additional arguments are ignored on IA-32, x64, and EBC.\r | |
3304 | IPF CPUs expect one additional parameter of type VOID * that specifies\r | |
3305 | the new backing store pointer.\r | |
3306 | \r | |
3307 | If EntryPoint is NULL, then ASSERT().\r | |
3308 | If NewStack is NULL, then ASSERT().\r | |
3309 | \r | |
3310 | @param EntryPoint A pointer to function to call with the new stack.\r | |
3311 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
3312 | function.\r | |
3313 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
3314 | function.\r | |
3315 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
3316 | function.\r | |
285010e7 | 3317 | @param ... This variable argument list is ignored for IA32, x64, and EBC. \r |
3318 | For IPF, this variable argument list is expected to contain \r | |
3319 | a single parameter of type VOID * that specifies the new backing \r | |
3320 | store pointer.\r | |
42eedea9 | 3321 | \r |
ac644614 | 3322 | \r |
3323 | **/\r | |
3324 | VOID\r | |
3325 | EFIAPI\r | |
3326 | SwitchStack (\r | |
3327 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
3328 | IN VOID *Context1, OPTIONAL\r | |
3329 | IN VOID *Context2, OPTIONAL\r | |
3330 | IN VOID *NewStack,\r | |
3331 | ...\r | |
3332 | );\r | |
3333 | \r | |
3334 | \r | |
3335 | /**\r | |
3336 | Generates a breakpoint on the CPU.\r | |
3337 | \r | |
3338 | Generates a breakpoint on the CPU. The breakpoint must be implemented such\r | |
3339 | that code can resume normal execution after the breakpoint.\r | |
3340 | \r | |
3341 | **/\r | |
3342 | VOID\r | |
3343 | EFIAPI\r | |
3344 | CpuBreakpoint (\r | |
3345 | VOID\r | |
3346 | );\r | |
3347 | \r | |
3348 | \r | |
3349 | /**\r | |
3350 | Executes an infinite loop.\r | |
3351 | \r | |
3352 | Forces the CPU to execute an infinite loop. A debugger may be used to skip\r | |
3353 | past the loop and the code that follows the loop must execute properly. This\r | |
3354 | implies that the infinite loop must not cause the code that follow it to be\r | |
3355 | optimized away.\r | |
3356 | \r | |
3357 | **/\r | |
3358 | VOID\r | |
3359 | EFIAPI\r | |
3360 | CpuDeadLoop (\r | |
3361 | VOID\r | |
3362 | );\r | |
2fe241a2 | 3363 | \r |
ac644614 | 3364 | #if defined (MDE_CPU_IPF)\r |
3365 | \r | |
3366 | /**\r | |
3367 | Flush a range of cache lines in the cache coherency domain of the calling\r | |
3368 | CPU.\r | |
3369 | \r | |
cc39b88b | 3370 | Flushes the cache lines specified by Address and Length. If Address is not aligned \r |
3371 | on a cache line boundary, then entire cache line containing Address is flushed. \r | |
3372 | If Address + Length is not aligned on a cache line boundary, then the entire cache \r | |
3373 | line containing Address + Length - 1 is flushed. This function may choose to flush \r | |
3374 | the entire cache if that is more efficient than flushing the specified range. If \r | |
3375 | Length is 0, the no cache lines are flushed. Address is returned. \r | |
3376 | This function is only available on IPF.\r | |
ac644614 | 3377 | \r |
3378 | If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r | |
3379 | \r | |
3380 | @param Address The base address of the instruction lines to invalidate. If\r | |
3381 | the CPU is in a physical addressing mode, then Address is a\r | |
3382 | physical address. If the CPU is in a virtual addressing mode,\r | |
3383 | then Address is a virtual address.\r | |
3384 | \r | |
3385 | @param Length The number of bytes to invalidate from the instruction cache.\r | |
3386 | \r | |
cc39b88b | 3387 | @return Address.\r |
ac644614 | 3388 | \r |
3389 | **/\r | |
3390 | VOID *\r | |
3391 | EFIAPI\r | |
cc39b88b | 3392 | AsmFlushCacheRange (\r |
ac644614 | 3393 | IN VOID *Address,\r |
3394 | IN UINTN Length\r | |
3395 | );\r | |
3396 | \r | |
3397 | \r | |
3398 | /**\r | |
3399 | Executes a FC instruction\r | |
3400 | Executes a FC instruction on the cache line specified by Address.\r | |
3401 | The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).\r | |
3402 | An implementation may flush a larger region. This function is only available on IPF.\r | |
3403 | \r | |
ee6c452c | 3404 | @param Address The Address of cache line to be flushed.\r |
ac644614 | 3405 | \r |
3406 | @return The address of FC instruction executed.\r | |
3407 | \r | |
3408 | **/\r | |
3409 | UINT64\r | |
3410 | EFIAPI\r | |
3411 | AsmFc (\r | |
3412 | IN UINT64 Address\r | |
3413 | );\r | |
3414 | \r | |
3415 | \r | |
3416 | /**\r | |
3417 | Executes a FC.I instruction.\r | |
3418 | Executes a FC.I instruction on the cache line specified by Address.\r | |
3419 | The cache line size affected is at least 32-bytes (aligned on a 32-byte boundary).\r | |
3420 | An implementation may flush a larger region. This function is only available on IPF.\r | |
3421 | \r | |
ee6c452c | 3422 | @param Address The Address of cache line to be flushed.\r |
ac644614 | 3423 | \r |
3424 | @return The address of FC.I instruction executed.\r | |
3425 | \r | |
3426 | **/\r | |
3427 | UINT64\r | |
3428 | EFIAPI\r | |
3429 | AsmFci (\r | |
3430 | IN UINT64 Address\r | |
3431 | );\r | |
3432 | \r | |
3433 | \r | |
3434 | /**\r | |
3435 | Reads the current value of a Processor Identifier Register (CPUID).\r | |
17f695ed | 3436 | \r |
3437 | Reads and returns the current value of Processor Identifier Register specified by Index. \r | |
ac644614 | 3438 | The Index of largest implemented CPUID (One less than the number of implemented CPUID\r |
3439 | registers) is determined by CPUID [3] bits {7:0}.\r | |
3440 | No parameter checking is performed on Index. If the Index value is beyond the\r | |
3441 | implemented CPUID register range, a Reserved Register/Field fault may occur. The caller\r | |
3442 | must either guarantee that Index is valid, or the caller must set up fault handlers to\r | |
3443 | catch the faults. This function is only available on IPF.\r | |
3444 | \r | |
ee6c452c | 3445 | @param Index The 8-bit Processor Identifier Register index to read.\r |
ac644614 | 3446 | \r |
3447 | @return The current value of Processor Identifier Register specified by Index.\r | |
3448 | \r | |
3449 | **/\r | |
3450 | UINT64\r | |
3451 | EFIAPI\r | |
3452 | AsmReadCpuid (\r | |
3453 | IN UINT8 Index\r | |
3454 | );\r | |
3455 | \r | |
3456 | \r | |
3457 | /**\r | |
3458 | Reads the current value of 64-bit Processor Status Register (PSR).\r | |
3459 | This function is only available on IPF.\r | |
3460 | \r | |
3461 | @return The current value of PSR.\r | |
3462 | \r | |
3463 | **/\r | |
3464 | UINT64\r | |
3465 | EFIAPI\r | |
3466 | AsmReadPsr (\r | |
3467 | VOID\r | |
3468 | );\r | |
3469 | \r | |
3470 | \r | |
3471 | /**\r | |
3472 | Writes the current value of 64-bit Processor Status Register (PSR).\r | |
22388319 | 3473 | \r |
ac644614 | 3474 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
22388319 | 3475 | reserved fields of PSR must be 0 or a Reserved Register/Field fault may occur.\r |
3476 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
3477 | fault handlers to catch the faults. This function is only available on IPF.\r | |
ac644614 | 3478 | \r |
ee6c452c | 3479 | @param Value The 64-bit value to write to PSR.\r |
ac644614 | 3480 | \r |
3481 | @return The 64-bit value written to the PSR.\r | |
3482 | \r | |
3483 | **/\r | |
3484 | UINT64\r | |
3485 | EFIAPI\r | |
3486 | AsmWritePsr (\r | |
3487 | IN UINT64 Value\r | |
3488 | );\r | |
3489 | \r | |
3490 | \r | |
3491 | /**\r | |
3492 | Reads the current value of 64-bit Kernel Register #0 (KR0).\r | |
2fe241a2 | 3493 | \r |
3494 | Reads and returns the current value of KR0. \r | |
ac644614 | 3495 | This function is only available on IPF.\r |
3496 | \r | |
3497 | @return The current value of KR0.\r | |
3498 | \r | |
3499 | **/\r | |
3500 | UINT64\r | |
3501 | EFIAPI\r | |
3502 | AsmReadKr0 (\r | |
3503 | VOID\r | |
3504 | );\r | |
3505 | \r | |
3506 | \r | |
3507 | /**\r | |
3508 | Reads the current value of 64-bit Kernel Register #1 (KR1).\r | |
2fe241a2 | 3509 | \r |
3510 | Reads and returns the current value of KR1. \r | |
ac644614 | 3511 | This function is only available on IPF.\r |
3512 | \r | |
3513 | @return The current value of KR1.\r | |
3514 | \r | |
3515 | **/\r | |
3516 | UINT64\r | |
3517 | EFIAPI\r | |
3518 | AsmReadKr1 (\r | |
3519 | VOID\r | |
3520 | );\r | |
3521 | \r | |
3522 | \r | |
3523 | /**\r | |
3524 | Reads the current value of 64-bit Kernel Register #2 (KR2).\r | |
2fe241a2 | 3525 | \r |
3526 | Reads and returns the current value of KR2. \r | |
ac644614 | 3527 | This function is only available on IPF.\r |
3528 | \r | |
3529 | @return The current value of KR2.\r | |
3530 | \r | |
3531 | **/\r | |
3532 | UINT64\r | |
3533 | EFIAPI\r | |
3534 | AsmReadKr2 (\r | |
3535 | VOID\r | |
3536 | );\r | |
3537 | \r | |
3538 | \r | |
3539 | /**\r | |
3540 | Reads the current value of 64-bit Kernel Register #3 (KR3).\r | |
2fe241a2 | 3541 | \r |
3542 | Reads and returns the current value of KR3. \r | |
ac644614 | 3543 | This function is only available on IPF.\r |
3544 | \r | |
3545 | @return The current value of KR3.\r | |
3546 | \r | |
3547 | **/\r | |
3548 | UINT64\r | |
3549 | EFIAPI\r | |
3550 | AsmReadKr3 (\r | |
3551 | VOID\r | |
3552 | );\r | |
3553 | \r | |
3554 | \r | |
3555 | /**\r | |
3556 | Reads the current value of 64-bit Kernel Register #4 (KR4).\r | |
ac644614 | 3557 | \r |
2fe241a2 | 3558 | Reads and returns the current value of KR4. \r |
3559 | This function is only available on IPF.\r | |
3560 | \r | |
ac644614 | 3561 | @return The current value of KR4.\r |
3562 | \r | |
3563 | **/\r | |
3564 | UINT64\r | |
3565 | EFIAPI\r | |
3566 | AsmReadKr4 (\r | |
3567 | VOID\r | |
3568 | );\r | |
3569 | \r | |
3570 | \r | |
3571 | /**\r | |
3572 | Reads the current value of 64-bit Kernel Register #5 (KR5).\r | |
2fe241a2 | 3573 | \r |
3574 | Reads and returns the current value of KR5. \r | |
ac644614 | 3575 | This function is only available on IPF.\r |
3576 | \r | |
3577 | @return The current value of KR5.\r | |
3578 | \r | |
3579 | **/\r | |
3580 | UINT64\r | |
3581 | EFIAPI\r | |
3582 | AsmReadKr5 (\r | |
3583 | VOID\r | |
3584 | );\r | |
3585 | \r | |
3586 | \r | |
3587 | /**\r | |
3588 | Reads the current value of 64-bit Kernel Register #6 (KR6).\r | |
2fe241a2 | 3589 | \r |
3590 | Reads and returns the current value of KR6. \r | |
ac644614 | 3591 | This function is only available on IPF.\r |
3592 | \r | |
3593 | @return The current value of KR6.\r | |
3594 | \r | |
3595 | **/\r | |
3596 | UINT64\r | |
3597 | EFIAPI\r | |
3598 | AsmReadKr6 (\r | |
3599 | VOID\r | |
3600 | );\r | |
3601 | \r | |
3602 | \r | |
3603 | /**\r | |
3604 | Reads the current value of 64-bit Kernel Register #7 (KR7).\r | |
2fe241a2 | 3605 | \r |
3606 | Reads and returns the current value of KR7. \r | |
ac644614 | 3607 | This function is only available on IPF.\r |
3608 | \r | |
3609 | @return The current value of KR7.\r | |
3610 | \r | |
3611 | **/\r | |
3612 | UINT64\r | |
3613 | EFIAPI\r | |
3614 | AsmReadKr7 (\r | |
3615 | VOID\r | |
3616 | );\r | |
3617 | \r | |
3618 | \r | |
3619 | /**\r | |
3620 | Write the current value of 64-bit Kernel Register #0 (KR0).\r | |
2fe241a2 | 3621 | \r |
3622 | Writes the current value of KR0. The 64-bit value written to \r | |
3623 | the KR0 is returned. This function is only available on IPF.\r | |
ac644614 | 3624 | \r |
ee6c452c | 3625 | @param Value The 64-bit value to write to KR0.\r |
ac644614 | 3626 | \r |
3627 | @return The 64-bit value written to the KR0.\r | |
3628 | \r | |
3629 | **/\r | |
3630 | UINT64\r | |
3631 | EFIAPI\r | |
3632 | AsmWriteKr0 (\r | |
3633 | IN UINT64 Value\r | |
3634 | );\r | |
3635 | \r | |
3636 | \r | |
3637 | /**\r | |
3638 | Write the current value of 64-bit Kernel Register #1 (KR1).\r | |
2fe241a2 | 3639 | \r |
3640 | Writes the current value of KR1. The 64-bit value written to \r | |
3641 | the KR1 is returned. This function is only available on IPF.\r | |
ac644614 | 3642 | \r |
ee6c452c | 3643 | @param Value The 64-bit value to write to KR1.\r |
ac644614 | 3644 | \r |
3645 | @return The 64-bit value written to the KR1.\r | |
3646 | \r | |
3647 | **/\r | |
3648 | UINT64\r | |
3649 | EFIAPI\r | |
3650 | AsmWriteKr1 (\r | |
3651 | IN UINT64 Value\r | |
3652 | );\r | |
3653 | \r | |
3654 | \r | |
3655 | /**\r | |
3656 | Write the current value of 64-bit Kernel Register #2 (KR2).\r | |
2fe241a2 | 3657 | \r |
3658 | Writes the current value of KR2. The 64-bit value written to \r | |
3659 | the KR2 is returned. This function is only available on IPF.\r | |
ac644614 | 3660 | \r |
ee6c452c | 3661 | @param Value The 64-bit value to write to KR2.\r |
ac644614 | 3662 | \r |
3663 | @return The 64-bit value written to the KR2.\r | |
3664 | \r | |
3665 | **/\r | |
3666 | UINT64\r | |
3667 | EFIAPI\r | |
3668 | AsmWriteKr2 (\r | |
3669 | IN UINT64 Value\r | |
3670 | );\r | |
3671 | \r | |
3672 | \r | |
3673 | /**\r | |
3674 | Write the current value of 64-bit Kernel Register #3 (KR3).\r | |
2fe241a2 | 3675 | \r |
3676 | Writes the current value of KR3. The 64-bit value written to \r | |
3677 | the KR3 is returned. This function is only available on IPF.\r | |
ac644614 | 3678 | \r |
ee6c452c | 3679 | @param Value The 64-bit value to write to KR3.\r |
ac644614 | 3680 | \r |
3681 | @return The 64-bit value written to the KR3.\r | |
3682 | \r | |
3683 | **/\r | |
3684 | UINT64\r | |
3685 | EFIAPI\r | |
3686 | AsmWriteKr3 (\r | |
3687 | IN UINT64 Value\r | |
3688 | );\r | |
3689 | \r | |
3690 | \r | |
3691 | /**\r | |
3692 | Write the current value of 64-bit Kernel Register #4 (KR4).\r | |
2fe241a2 | 3693 | \r |
3694 | Writes the current value of KR4. The 64-bit value written to \r | |
3695 | the KR4 is returned. This function is only available on IPF.\r | |
ac644614 | 3696 | \r |
ee6c452c | 3697 | @param Value The 64-bit value to write to KR4.\r |
ac644614 | 3698 | \r |
3699 | @return The 64-bit value written to the KR4.\r | |
3700 | \r | |
3701 | **/\r | |
3702 | UINT64\r | |
3703 | EFIAPI\r | |
3704 | AsmWriteKr4 (\r | |
3705 | IN UINT64 Value\r | |
3706 | );\r | |
3707 | \r | |
3708 | \r | |
3709 | /**\r | |
3710 | Write the current value of 64-bit Kernel Register #5 (KR5).\r | |
2fe241a2 | 3711 | \r |
3712 | Writes the current value of KR5. The 64-bit value written to \r | |
3713 | the KR5 is returned. This function is only available on IPF.\r | |
ac644614 | 3714 | \r |
ee6c452c | 3715 | @param Value The 64-bit value to write to KR5.\r |
ac644614 | 3716 | \r |
3717 | @return The 64-bit value written to the KR5.\r | |
3718 | \r | |
3719 | **/\r | |
3720 | UINT64\r | |
3721 | EFIAPI\r | |
3722 | AsmWriteKr5 (\r | |
3723 | IN UINT64 Value\r | |
3724 | );\r | |
3725 | \r | |
3726 | \r | |
3727 | /**\r | |
3728 | Write the current value of 64-bit Kernel Register #6 (KR6).\r | |
2fe241a2 | 3729 | \r |
3730 | Writes the current value of KR6. The 64-bit value written to \r | |
3731 | the KR6 is returned. This function is only available on IPF.\r | |
ac644614 | 3732 | \r |
ee6c452c | 3733 | @param Value The 64-bit value to write to KR6.\r |
ac644614 | 3734 | \r |
3735 | @return The 64-bit value written to the KR6.\r | |
3736 | \r | |
3737 | **/\r | |
3738 | UINT64\r | |
3739 | EFIAPI\r | |
3740 | AsmWriteKr6 (\r | |
3741 | IN UINT64 Value\r | |
3742 | );\r | |
3743 | \r | |
3744 | \r | |
3745 | /**\r | |
3746 | Write the current value of 64-bit Kernel Register #7 (KR7).\r | |
2fe241a2 | 3747 | \r |
3748 | Writes the current value of KR7. The 64-bit value written to \r | |
3749 | the KR7 is returned. This function is only available on IPF.\r | |
ac644614 | 3750 | \r |
ee6c452c | 3751 | @param Value The 64-bit value to write to KR7.\r |
ac644614 | 3752 | \r |
3753 | @return The 64-bit value written to the KR7.\r | |
3754 | \r | |
3755 | **/\r | |
3756 | UINT64\r | |
3757 | EFIAPI\r | |
3758 | AsmWriteKr7 (\r | |
3759 | IN UINT64 Value\r | |
3760 | );\r | |
3761 | \r | |
3762 | \r | |
3763 | /**\r | |
3764 | Reads the current value of Interval Timer Counter Register (ITC).\r | |
2fe241a2 | 3765 | \r |
3766 | Reads and returns the current value of ITC.\r | |
ac644614 | 3767 | This function is only available on IPF.\r |
3768 | \r | |
3769 | @return The current value of ITC.\r | |
3770 | \r | |
3771 | **/\r | |
3772 | UINT64\r | |
3773 | EFIAPI\r | |
3774 | AsmReadItc (\r | |
3775 | VOID\r | |
3776 | );\r | |
3777 | \r | |
3778 | \r | |
3779 | /**\r | |
3780 | Reads the current value of Interval Timer Vector Register (ITV).\r | |
2fe241a2 | 3781 | \r |
3782 | Reads and returns the current value of ITV. \r | |
ac644614 | 3783 | This function is only available on IPF.\r |
3784 | \r | |
3785 | @return The current value of ITV.\r | |
3786 | \r | |
3787 | **/\r | |
3788 | UINT64\r | |
3789 | EFIAPI\r | |
3790 | AsmReadItv (\r | |
3791 | VOID\r | |
3792 | );\r | |
3793 | \r | |
3794 | \r | |
3795 | /**\r | |
3796 | Reads the current value of Interval Timer Match Register (ITM).\r | |
2fe241a2 | 3797 | \r |
3798 | Reads and returns the current value of ITM.\r | |
ac644614 | 3799 | This function is only available on IPF.\r |
3800 | \r | |
3801 | @return The current value of ITM.\r | |
3802 | **/\r | |
3803 | UINT64\r | |
3804 | EFIAPI\r | |
3805 | AsmReadItm (\r | |
3806 | VOID\r | |
3807 | );\r | |
3808 | \r | |
3809 | \r | |
3810 | /**\r | |
3811 | Writes the current value of 64-bit Interval Timer Counter Register (ITC).\r | |
2fe241a2 | 3812 | \r |
3813 | Writes the current value of ITC. The 64-bit value written to the ITC is returned. \r | |
ac644614 | 3814 | This function is only available on IPF.\r |
3815 | \r | |
ee6c452c | 3816 | @param Value The 64-bit value to write to ITC.\r |
ac644614 | 3817 | \r |
3818 | @return The 64-bit value written to the ITC.\r | |
3819 | \r | |
3820 | **/\r | |
3821 | UINT64\r | |
3822 | EFIAPI\r | |
3823 | AsmWriteItc (\r | |
3824 | IN UINT64 Value\r | |
3825 | );\r | |
3826 | \r | |
3827 | \r | |
3828 | /**\r | |
3829 | Writes the current value of 64-bit Interval Timer Match Register (ITM).\r | |
2fe241a2 | 3830 | \r |
3831 | Writes the current value of ITM. The 64-bit value written to the ITM is returned. \r | |
ac644614 | 3832 | This function is only available on IPF.\r |
3833 | \r | |
ee6c452c | 3834 | @param Value The 64-bit value to write to ITM.\r |
ac644614 | 3835 | \r |
3836 | @return The 64-bit value written to the ITM.\r | |
3837 | \r | |
3838 | **/\r | |
3839 | UINT64\r | |
3840 | EFIAPI\r | |
3841 | AsmWriteItm (\r | |
3842 | IN UINT64 Value\r | |
3843 | );\r | |
3844 | \r | |
3845 | \r | |
3846 | /**\r | |
3847 | Writes the current value of 64-bit Interval Timer Vector Register (ITV).\r | |
2fe241a2 | 3848 | \r |
3849 | Writes the current value of ITV. The 64-bit value written to the ITV is returned. \r | |
ac644614 | 3850 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
3851 | reserved fields of ITV must be 0 or a Reserved Register/Field fault may occur.\r | |
3852 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
3853 | fault handlers to catch the faults.\r | |
3854 | This function is only available on IPF.\r | |
3855 | \r | |
ee6c452c | 3856 | @param Value The 64-bit value to write to ITV.\r |
ac644614 | 3857 | \r |
3858 | @return The 64-bit value written to the ITV.\r | |
3859 | \r | |
3860 | **/\r | |
3861 | UINT64\r | |
3862 | EFIAPI\r | |
3863 | AsmWriteItv (\r | |
3864 | IN UINT64 Value\r | |
3865 | );\r | |
3866 | \r | |
3867 | \r | |
3868 | /**\r | |
3869 | Reads the current value of Default Control Register (DCR).\r | |
2fe241a2 | 3870 | \r |
3871 | Reads and returns the current value of DCR. This function is only available on IPF.\r | |
ac644614 | 3872 | \r |
3873 | @return The current value of DCR.\r | |
3874 | \r | |
3875 | **/\r | |
3876 | UINT64\r | |
3877 | EFIAPI\r | |
3878 | AsmReadDcr (\r | |
3879 | VOID\r | |
3880 | );\r | |
3881 | \r | |
3882 | \r | |
3883 | /**\r | |
3884 | Reads the current value of Interruption Vector Address Register (IVA).\r | |
2fe241a2 | 3885 | \r |
3886 | Reads and returns the current value of IVA. This function is only available on IPF.\r | |
ac644614 | 3887 | \r |
3888 | @return The current value of IVA.\r | |
3889 | **/\r | |
3890 | UINT64\r | |
3891 | EFIAPI\r | |
3892 | AsmReadIva (\r | |
3893 | VOID\r | |
3894 | );\r | |
3895 | \r | |
3896 | \r | |
3897 | /**\r | |
3898 | Reads the current value of Page Table Address Register (PTA).\r | |
2fe241a2 | 3899 | \r |
3900 | Reads and returns the current value of PTA. This function is only available on IPF.\r | |
ac644614 | 3901 | \r |
3902 | @return The current value of PTA.\r | |
3903 | \r | |
3904 | **/\r | |
3905 | UINT64\r | |
3906 | EFIAPI\r | |
3907 | AsmReadPta (\r | |
3908 | VOID\r | |
3909 | );\r | |
3910 | \r | |
3911 | \r | |
3912 | /**\r | |
3913 | Writes the current value of 64-bit Default Control Register (DCR).\r | |
2fe241a2 | 3914 | \r |
3915 | Writes the current value of DCR. The 64-bit value written to the DCR is returned. \r | |
ac644614 | 3916 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
3917 | reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.\r | |
3918 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
3919 | fault handlers to catch the faults.\r | |
3920 | This function is only available on IPF.\r | |
3921 | \r | |
ee6c452c | 3922 | @param Value The 64-bit value to write to DCR.\r |
ac644614 | 3923 | \r |
3924 | @return The 64-bit value written to the DCR.\r | |
3925 | \r | |
3926 | **/\r | |
3927 | UINT64\r | |
3928 | EFIAPI\r | |
3929 | AsmWriteDcr (\r | |
3930 | IN UINT64 Value\r | |
3931 | );\r | |
3932 | \r | |
3933 | \r | |
3934 | /**\r | |
3935 | Writes the current value of 64-bit Interruption Vector Address Register (IVA).\r | |
2fe241a2 | 3936 | \r |
3937 | Writes the current value of IVA. The 64-bit value written to the IVA is returned. \r | |
ac644614 | 3938 | The size of vector table is 32 K bytes and is 32 K bytes aligned\r |
3939 | the low 15 bits of Value is ignored when written.\r | |
3940 | This function is only available on IPF.\r | |
3941 | \r | |
ee6c452c | 3942 | @param Value The 64-bit value to write to IVA.\r |
ac644614 | 3943 | \r |
3944 | @return The 64-bit value written to the IVA.\r | |
3945 | \r | |
3946 | **/\r | |
3947 | UINT64\r | |
3948 | EFIAPI\r | |
3949 | AsmWriteIva (\r | |
3950 | IN UINT64 Value\r | |
3951 | );\r | |
3952 | \r | |
3953 | \r | |
3954 | /**\r | |
3955 | Writes the current value of 64-bit Page Table Address Register (PTA).\r | |
2fe241a2 | 3956 | \r |
3957 | Writes the current value of PTA. The 64-bit value written to the PTA is returned. \r | |
ac644614 | 3958 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
3959 | reserved fields of DCR must be 0 or a Reserved Register/Field fault may occur.\r | |
3960 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
3961 | fault handlers to catch the faults.\r | |
3962 | This function is only available on IPF.\r | |
3963 | \r | |
ee6c452c | 3964 | @param Value The 64-bit value to write to PTA.\r |
ac644614 | 3965 | \r |
3966 | @return The 64-bit value written to the PTA.\r | |
3967 | **/\r | |
3968 | UINT64\r | |
3969 | EFIAPI\r | |
3970 | AsmWritePta (\r | |
3971 | IN UINT64 Value\r | |
3972 | );\r | |
3973 | \r | |
3974 | \r | |
3975 | /**\r | |
3976 | Reads the current value of Local Interrupt ID Register (LID).\r | |
2fe241a2 | 3977 | \r |
3978 | Reads and returns the current value of LID. This function is only available on IPF.\r | |
ac644614 | 3979 | \r |
3980 | @return The current value of LID.\r | |
3981 | \r | |
3982 | **/\r | |
3983 | UINT64\r | |
3984 | EFIAPI\r | |
3985 | AsmReadLid (\r | |
3986 | VOID\r | |
3987 | );\r | |
3988 | \r | |
3989 | \r | |
3990 | /**\r | |
3991 | Reads the current value of External Interrupt Vector Register (IVR).\r | |
2fe241a2 | 3992 | \r |
3993 | Reads and returns the current value of IVR. This function is only available on IPF. \r | |
ac644614 | 3994 | \r |
3995 | @return The current value of IVR.\r | |
3996 | \r | |
3997 | **/\r | |
3998 | UINT64\r | |
3999 | EFIAPI\r | |
4000 | AsmReadIvr (\r | |
4001 | VOID\r | |
4002 | );\r | |
4003 | \r | |
4004 | \r | |
4005 | /**\r | |
4006 | Reads the current value of Task Priority Register (TPR).\r | |
2fe241a2 | 4007 | \r |
4008 | Reads and returns the current value of TPR. This function is only available on IPF. \r | |
ac644614 | 4009 | \r |
4010 | @return The current value of TPR.\r | |
4011 | \r | |
4012 | **/\r | |
4013 | UINT64\r | |
4014 | EFIAPI\r | |
4015 | AsmReadTpr (\r | |
4016 | VOID\r | |
4017 | );\r | |
4018 | \r | |
4019 | \r | |
4020 | /**\r | |
4021 | Reads the current value of External Interrupt Request Register #0 (IRR0).\r | |
2fe241a2 | 4022 | \r |
4023 | Reads and returns the current value of IRR0. This function is only available on IPF. \r | |
ac644614 | 4024 | \r |
4025 | @return The current value of IRR0.\r | |
4026 | \r | |
4027 | **/\r | |
4028 | UINT64\r | |
4029 | EFIAPI\r | |
4030 | AsmReadIrr0 (\r | |
4031 | VOID\r | |
4032 | );\r | |
4033 | \r | |
4034 | \r | |
4035 | /**\r | |
4036 | Reads the current value of External Interrupt Request Register #1 (IRR1).\r | |
2fe241a2 | 4037 | \r |
4038 | Reads and returns the current value of IRR1. This function is only available on IPF. \r | |
ac644614 | 4039 | \r |
4040 | @return The current value of IRR1.\r | |
4041 | \r | |
4042 | **/\r | |
4043 | UINT64\r | |
4044 | EFIAPI\r | |
4045 | AsmReadIrr1 (\r | |
4046 | VOID\r | |
4047 | );\r | |
4048 | \r | |
4049 | \r | |
4050 | /**\r | |
4051 | Reads the current value of External Interrupt Request Register #2 (IRR2).\r | |
2fe241a2 | 4052 | \r |
4053 | Reads and returns the current value of IRR2. This function is only available on IPF.\r | |
ac644614 | 4054 | \r |
4055 | @return The current value of IRR2.\r | |
4056 | \r | |
4057 | **/\r | |
4058 | UINT64\r | |
4059 | EFIAPI\r | |
4060 | AsmReadIrr2 (\r | |
4061 | VOID\r | |
4062 | );\r | |
4063 | \r | |
4064 | \r | |
4065 | /**\r | |
4066 | Reads the current value of External Interrupt Request Register #3 (IRR3).\r | |
2fe241a2 | 4067 | \r |
4068 | Reads and returns the current value of IRR3. This function is only available on IPF. \r | |
ac644614 | 4069 | \r |
4070 | @return The current value of IRR3.\r | |
4071 | \r | |
4072 | **/\r | |
4073 | UINT64\r | |
4074 | EFIAPI\r | |
4075 | AsmReadIrr3 (\r | |
4076 | VOID\r | |
4077 | );\r | |
4078 | \r | |
4079 | \r | |
4080 | /**\r | |
4081 | Reads the current value of Performance Monitor Vector Register (PMV).\r | |
2fe241a2 | 4082 | \r |
4083 | Reads and returns the current value of PMV. This function is only available on IPF. \r | |
ac644614 | 4084 | \r |
4085 | @return The current value of PMV.\r | |
4086 | \r | |
4087 | **/\r | |
4088 | UINT64\r | |
4089 | EFIAPI\r | |
4090 | AsmReadPmv (\r | |
4091 | VOID\r | |
4092 | );\r | |
4093 | \r | |
4094 | \r | |
4095 | /**\r | |
4096 | Reads the current value of Corrected Machine Check Vector Register (CMCV).\r | |
2fe241a2 | 4097 | \r |
4098 | Reads and returns the current value of CMCV. This function is only available on IPF.\r | |
ac644614 | 4099 | \r |
4100 | @return The current value of CMCV.\r | |
4101 | \r | |
4102 | **/\r | |
4103 | UINT64\r | |
4104 | EFIAPI\r | |
4105 | AsmReadCmcv (\r | |
4106 | VOID\r | |
4107 | );\r | |
4108 | \r | |
4109 | \r | |
4110 | /**\r | |
4111 | Reads the current value of Local Redirection Register #0 (LRR0).\r | |
2fe241a2 | 4112 | \r |
4113 | Reads and returns the current value of LRR0. This function is only available on IPF. \r | |
ac644614 | 4114 | \r |
4115 | @return The current value of LRR0.\r | |
4116 | \r | |
4117 | **/\r | |
4118 | UINT64\r | |
4119 | EFIAPI\r | |
4120 | AsmReadLrr0 (\r | |
4121 | VOID\r | |
4122 | );\r | |
4123 | \r | |
4124 | \r | |
4125 | /**\r | |
4126 | Reads the current value of Local Redirection Register #1 (LRR1).\r | |
2fe241a2 | 4127 | \r |
4128 | Reads and returns the current value of LRR1. This function is only available on IPF.\r | |
ac644614 | 4129 | \r |
4130 | @return The current value of LRR1.\r | |
4131 | \r | |
4132 | **/\r | |
4133 | UINT64\r | |
4134 | EFIAPI\r | |
4135 | AsmReadLrr1 (\r | |
4136 | VOID\r | |
4137 | );\r | |
4138 | \r | |
4139 | \r | |
4140 | /**\r | |
4141 | Writes the current value of 64-bit Page Local Interrupt ID Register (LID).\r | |
2fe241a2 | 4142 | \r |
4143 | Writes the current value of LID. The 64-bit value written to the LID is returned. \r | |
ac644614 | 4144 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
4145 | reserved fields of LID must be 0 or a Reserved Register/Field fault may occur.\r | |
4146 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
4147 | fault handlers to catch the faults.\r | |
4148 | This function is only available on IPF.\r | |
4149 | \r | |
ee6c452c | 4150 | @param Value The 64-bit value to write to LID.\r |
ac644614 | 4151 | \r |
4152 | @return The 64-bit value written to the LID.\r | |
4153 | \r | |
4154 | **/\r | |
4155 | UINT64\r | |
4156 | EFIAPI\r | |
4157 | AsmWriteLid (\r | |
4158 | IN UINT64 Value\r | |
4159 | );\r | |
4160 | \r | |
4161 | \r | |
4162 | /**\r | |
4163 | Writes the current value of 64-bit Task Priority Register (TPR).\r | |
2fe241a2 | 4164 | \r |
4165 | Writes the current value of TPR. The 64-bit value written to the TPR is returned. \r | |
ac644614 | 4166 | No parameter checking is performed on Value. All bits of Value corresponding to\r |
4167 | reserved fields of TPR must be 0 or a Reserved Register/Field fault may occur.\r | |
4168 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
4169 | fault handlers to catch the faults.\r | |
4170 | This function is only available on IPF.\r | |
4171 | \r | |
ee6c452c | 4172 | @param Value The 64-bit value to write to TPR.\r |
ac644614 | 4173 | \r |
4174 | @return The 64-bit value written to the TPR.\r | |
4175 | \r | |
4176 | **/\r | |
4177 | UINT64\r | |
4178 | EFIAPI\r | |
4179 | AsmWriteTpr (\r | |
4180 | IN UINT64 Value\r | |
4181 | );\r | |
4182 | \r | |
4183 | \r | |
4184 | /**\r | |
4185 | Performs a write operation on End OF External Interrupt Register (EOI).\r | |
2fe241a2 | 4186 | \r |
ac644614 | 4187 | Writes a value of 0 to the EOI Register. This function is only available on IPF.\r |
4188 | \r | |
4189 | **/\r | |
4190 | VOID\r | |
4191 | EFIAPI\r | |
4192 | AsmWriteEoi (\r | |
4193 | VOID\r | |
4194 | );\r | |
4195 | \r | |
4196 | \r | |
4197 | /**\r | |
4198 | Writes the current value of 64-bit Performance Monitor Vector Register (PMV).\r | |
2fe241a2 | 4199 | \r |
4200 | Writes the current value of PMV. The 64-bit value written to the PMV is returned. \r | |
ac644614 | 4201 | No parameter checking is performed on Value. All bits of Value corresponding\r |
4202 | to reserved fields of PMV must be 0 or a Reserved Register/Field fault may occur.\r | |
4203 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
4204 | fault handlers to catch the faults.\r | |
4205 | This function is only available on IPF.\r | |
4206 | \r | |
ee6c452c | 4207 | @param Value The 64-bit value to write to PMV.\r |
ac644614 | 4208 | \r |
4209 | @return The 64-bit value written to the PMV.\r | |
4210 | \r | |
4211 | **/\r | |
4212 | UINT64\r | |
4213 | EFIAPI\r | |
4214 | AsmWritePmv (\r | |
4215 | IN UINT64 Value\r | |
4216 | );\r | |
4217 | \r | |
4218 | \r | |
4219 | /**\r | |
4220 | Writes the current value of 64-bit Corrected Machine Check Vector Register (CMCV).\r | |
2fe241a2 | 4221 | \r |
4222 | Writes the current value of CMCV. The 64-bit value written to the CMCV is returned. \r | |
ac644614 | 4223 | No parameter checking is performed on Value. All bits of Value corresponding\r |
4224 | to reserved fields of CMCV must be 0 or a Reserved Register/Field fault may occur.\r | |
4225 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
4226 | fault handlers to catch the faults.\r | |
4227 | This function is only available on IPF.\r | |
4228 | \r | |
ee6c452c | 4229 | @param Value The 64-bit value to write to CMCV.\r |
ac644614 | 4230 | \r |
4231 | @return The 64-bit value written to the CMCV.\r | |
4232 | \r | |
4233 | **/\r | |
4234 | UINT64\r | |
4235 | EFIAPI\r | |
4236 | AsmWriteCmcv (\r | |
4237 | IN UINT64 Value\r | |
4238 | );\r | |
4239 | \r | |
4240 | \r | |
4241 | /**\r | |
4242 | Writes the current value of 64-bit Local Redirection Register #0 (LRR0).\r | |
2fe241a2 | 4243 | \r |
4244 | Writes the current value of LRR0. The 64-bit value written to the LRR0 is returned. \r | |
ac644614 | 4245 | No parameter checking is performed on Value. All bits of Value corresponding\r |
4246 | to reserved fields of LRR0 must be 0 or a Reserved Register/Field fault may occur.\r | |
4247 | The caller must either guarantee that Value is valid, or the caller must set up\r | |
4248 | fault handlers to catch the faults.\r | |
4249 | This function is only available on IPF.\r | |
4250 | \r | |
ee6c452c | 4251 | @param Value The 64-bit value to write to LRR0.\r |
ac644614 | 4252 | \r |
4253 | @return The 64-bit value written to the LRR0.\r | |
4254 | \r | |
4255 | **/\r | |
4256 | UINT64\r | |
4257 | EFIAPI\r | |
4258 | AsmWriteLrr0 (\r | |
4259 | IN UINT64 Value\r | |
4260 | );\r | |
4261 | \r | |
4262 | \r | |
4263 | /**\r | |
4264 | Writes the current value of 64-bit Local Redirection Register #1 (LRR1).\r | |
2fe241a2 | 4265 | \r |
4266 | Writes the current value of LRR1. The 64-bit value written to the LRR1 is returned. \r | |
ac644614 | 4267 | No parameter checking is performed on Value. All bits of Value corresponding\r |
4268 | to reserved fields of LRR1 must be 0 or a Reserved Register/Field fault may occur.\r | |
4269 | The caller must either guarantee that Value is valid, or the caller must\r | |
4270 | set up fault handlers to catch the faults.\r | |
4271 | This function is only available on IPF.\r | |
4272 | \r | |
ee6c452c | 4273 | @param Value The 64-bit value to write to LRR1.\r |
ac644614 | 4274 | \r |
4275 | @return The 64-bit value written to the LRR1.\r | |
4276 | \r | |
4277 | **/\r | |
4278 | UINT64\r | |
4279 | EFIAPI\r | |
4280 | AsmWriteLrr1 (\r | |
4281 | IN UINT64 Value\r | |
4282 | );\r | |
4283 | \r | |
4284 | \r | |
4285 | /**\r | |
4286 | Reads the current value of Instruction Breakpoint Register (IBR).\r | |
4287 | \r | |
4288 | The Instruction Breakpoint Registers are used in pairs. The even numbered\r | |
4289 | registers contain breakpoint addresses, and the odd numbered registers contain\r | |
4290 | breakpoint mask conditions. At least 4 instruction registers pairs are implemented\r | |
4291 | on all processor models. Implemented registers are contiguous starting with\r | |
4292 | register 0. No parameter checking is performed on Index, and if the Index value\r | |
4293 | is beyond the implemented IBR register range, a Reserved Register/Field fault may\r | |
4294 | occur. The caller must either guarantee that Index is valid, or the caller must\r | |
4295 | set up fault handlers to catch the faults.\r | |
4296 | This function is only available on IPF.\r | |
4297 | \r | |
ee6c452c | 4298 | @param Index The 8-bit Instruction Breakpoint Register index to read.\r |
ac644614 | 4299 | \r |
4300 | @return The current value of Instruction Breakpoint Register specified by Index.\r | |
4301 | \r | |
4302 | **/\r | |
4303 | UINT64\r | |
4304 | EFIAPI\r | |
4305 | AsmReadIbr (\r | |
4306 | IN UINT8 Index\r | |
4307 | );\r | |
4308 | \r | |
4309 | \r | |
4310 | /**\r | |
4311 | Reads the current value of Data Breakpoint Register (DBR).\r | |
4312 | \r | |
4313 | The Data Breakpoint Registers are used in pairs. The even numbered registers\r | |
4314 | contain breakpoint addresses, and odd numbered registers contain breakpoint\r | |
4315 | mask conditions. At least 4 data registers pairs are implemented on all processor\r | |
4316 | models. Implemented registers are contiguous starting with register 0.\r | |
4317 | No parameter checking is performed on Index. If the Index value is beyond\r | |
4318 | the implemented DBR register range, a Reserved Register/Field fault may occur.\r | |
4319 | The caller must either guarantee that Index is valid, or the caller must set up\r | |
4320 | fault handlers to catch the faults.\r | |
4321 | This function is only available on IPF.\r | |
4322 | \r | |
ee6c452c | 4323 | @param Index The 8-bit Data Breakpoint Register index to read.\r |
ac644614 | 4324 | \r |
4325 | @return The current value of Data Breakpoint Register specified by Index.\r | |
4326 | \r | |
4327 | **/\r | |
4328 | UINT64\r | |
4329 | EFIAPI\r | |
4330 | AsmReadDbr (\r | |
4331 | IN UINT8 Index\r | |
4332 | );\r | |
4333 | \r | |
4334 | \r | |
4335 | /**\r | |
4336 | Reads the current value of Performance Monitor Configuration Register (PMC).\r | |
4337 | \r | |
4338 | All processor implementations provide at least 4 performance counters\r | |
4339 | (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow\r | |
4340 | status registers (PMC [0]... PMC [3]). Processor implementations may provide\r | |
4341 | additional implementation-dependent PMC and PMD to increase the number of\r | |
4342 | 'generic' performance counters (PMC/PMD pairs). The remainder of PMC and PMD\r | |
4343 | register set is implementation dependent. No parameter checking is performed\r | |
4344 | on Index. If the Index value is beyond the implemented PMC register range,\r | |
4345 | zero value will be returned.\r | |
4346 | This function is only available on IPF.\r | |
4347 | \r | |
ee6c452c | 4348 | @param Index The 8-bit Performance Monitor Configuration Register index to read.\r |
ac644614 | 4349 | \r |
2fe241a2 | 4350 | @return The current value of Performance Monitor Configuration Register\r |
4351 | specified by Index.\r | |
ac644614 | 4352 | \r |
4353 | **/\r | |
4354 | UINT64\r | |
4355 | EFIAPI\r | |
4356 | AsmReadPmc (\r | |
4357 | IN UINT8 Index\r | |
4358 | );\r | |
4359 | \r | |
4360 | \r | |
4361 | /**\r | |
4362 | Reads the current value of Performance Monitor Data Register (PMD).\r | |
4363 | \r | |
4364 | All processor implementations provide at least 4 performance counters\r | |
4365 | (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter\r | |
4366 | overflow status registers (PMC [0]... PMC [3]). Processor implementations may\r | |
4367 | provide additional implementation-dependent PMC and PMD to increase the number\r | |
4368 | of 'generic' performance counters (PMC/PMD pairs). The remainder of PMC and PMD\r | |
4369 | register set is implementation dependent. No parameter checking is performed\r | |
4370 | on Index. If the Index value is beyond the implemented PMD register range,\r | |
4371 | zero value will be returned.\r | |
4372 | This function is only available on IPF.\r | |
4373 | \r | |
ee6c452c | 4374 | @param Index The 8-bit Performance Monitor Data Register index to read.\r |
ac644614 | 4375 | \r |
4376 | @return The current value of Performance Monitor Data Register specified by Index.\r | |
4377 | \r | |
4378 | **/\r | |
4379 | UINT64\r | |
4380 | EFIAPI\r | |
4381 | AsmReadPmd (\r | |
4382 | IN UINT8 Index\r | |
4383 | );\r | |
4384 | \r | |
4385 | \r | |
4386 | /**\r | |
4387 | Writes the current value of 64-bit Instruction Breakpoint Register (IBR).\r | |
4388 | \r | |
4389 | Writes current value of Instruction Breakpoint Register specified by Index.\r | |
4390 | The Instruction Breakpoint Registers are used in pairs. The even numbered\r | |
4391 | registers contain breakpoint addresses, and odd numbered registers contain\r | |
4392 | breakpoint mask conditions. At least 4 instruction registers pairs are implemented\r | |
4393 | on all processor models. Implemented registers are contiguous starting with\r | |
4394 | register 0. No parameter checking is performed on Index. If the Index value\r | |
4395 | is beyond the implemented IBR register range, a Reserved Register/Field fault may\r | |
4396 | occur. The caller must either guarantee that Index is valid, or the caller must\r | |
4397 | set up fault handlers to catch the faults.\r | |
4398 | This function is only available on IPF.\r | |
4399 | \r | |
ee6c452c | 4400 | @param Index The 8-bit Instruction Breakpoint Register index to write.\r |
4401 | @param Value The 64-bit value to write to IBR.\r | |
ac644614 | 4402 | \r |
4403 | @return The 64-bit value written to the IBR.\r | |
4404 | \r | |
4405 | **/\r | |
4406 | UINT64\r | |
4407 | EFIAPI\r | |
4408 | AsmWriteIbr (\r | |
4409 | IN UINT8 Index,\r | |
4410 | IN UINT64 Value\r | |
4411 | );\r | |
4412 | \r | |
4413 | \r | |
4414 | /**\r | |
4415 | Writes the current value of 64-bit Data Breakpoint Register (DBR).\r | |
4416 | \r | |
4417 | Writes current value of Data Breakpoint Register specified by Index.\r | |
4418 | The Data Breakpoint Registers are used in pairs. The even numbered registers\r | |
4419 | contain breakpoint addresses, and odd numbered registers contain breakpoint\r | |
4420 | mask conditions. At least 4 data registers pairs are implemented on all processor\r | |
4421 | models. Implemented registers are contiguous starting with register 0. No parameter\r | |
4422 | checking is performed on Index. If the Index value is beyond the implemented\r | |
4423 | DBR register range, a Reserved Register/Field fault may occur. The caller must\r | |
4424 | either guarantee that Index is valid, or the caller must set up fault handlers to\r | |
4425 | catch the faults.\r | |
4426 | This function is only available on IPF.\r | |
4427 | \r | |
ee6c452c | 4428 | @param Index The 8-bit Data Breakpoint Register index to write.\r |
4429 | @param Value The 64-bit value to write to DBR.\r | |
ac644614 | 4430 | \r |
4431 | @return The 64-bit value written to the DBR.\r | |
4432 | \r | |
4433 | **/\r | |
4434 | UINT64\r | |
4435 | EFIAPI\r | |
4436 | AsmWriteDbr (\r | |
4437 | IN UINT8 Index,\r | |
4438 | IN UINT64 Value\r | |
4439 | );\r | |
4440 | \r | |
4441 | \r | |
4442 | /**\r | |
4443 | Writes the current value of 64-bit Performance Monitor Configuration Register (PMC).\r | |
4444 | \r | |
4445 | Writes current value of Performance Monitor Configuration Register specified by Index.\r | |
4446 | All processor implementations provide at least 4 performance counters\r | |
4447 | (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow status\r | |
4448 | registers (PMC [0]... PMC [3]). Processor implementations may provide additional\r | |
4449 | implementation-dependent PMC and PMD to increase the number of 'generic' performance\r | |
4450 | counters (PMC/PMD pairs). The remainder of PMC and PMD register set is implementation\r | |
4451 | dependent. No parameter checking is performed on Index. If the Index value is\r | |
4452 | beyond the implemented PMC register range, the write is ignored.\r | |
4453 | This function is only available on IPF.\r | |
4454 | \r | |
ee6c452c | 4455 | @param Index The 8-bit Performance Monitor Configuration Register index to write.\r |
4456 | @param Value The 64-bit value to write to PMC.\r | |
ac644614 | 4457 | \r |
4458 | @return The 64-bit value written to the PMC.\r | |
4459 | \r | |
4460 | **/\r | |
4461 | UINT64\r | |
4462 | EFIAPI\r | |
4463 | AsmWritePmc (\r | |
4464 | IN UINT8 Index,\r | |
4465 | IN UINT64 Value\r | |
4466 | );\r | |
4467 | \r | |
4468 | \r | |
4469 | /**\r | |
4470 | Writes the current value of 64-bit Performance Monitor Data Register (PMD).\r | |
4471 | \r | |
4472 | Writes current value of Performance Monitor Data Register specified by Index.\r | |
4473 | All processor implementations provide at least 4 performance counters\r | |
4474 | (PMC/PMD [4]...PMC/PMD [7] pairs), and 4 performance monitor counter overflow\r | |
4475 | status registers (PMC [0]... PMC [3]). Processor implementations may provide\r | |
4476 | additional implementation-dependent PMC and PMD to increase the number of 'generic'\r | |
4477 | performance counters (PMC/PMD pairs). The remainder of PMC and PMD register set\r | |
4478 | is implementation dependent. No parameter checking is performed on Index. If the\r | |
4479 | Index value is beyond the implemented PMD register range, the write is ignored.\r | |
4480 | This function is only available on IPF.\r | |
4481 | \r | |
ee6c452c | 4482 | @param Index The 8-bit Performance Monitor Data Register index to write.\r |
4483 | @param Value The 64-bit value to write to PMD.\r | |
ac644614 | 4484 | \r |
4485 | @return The 64-bit value written to the PMD.\r | |
4486 | \r | |
4487 | **/\r | |
4488 | UINT64\r | |
4489 | EFIAPI\r | |
4490 | AsmWritePmd (\r | |
4491 | IN UINT8 Index,\r | |
4492 | IN UINT64 Value\r | |
4493 | );\r | |
4494 | \r | |
4495 | \r | |
4496 | /**\r | |
4497 | Reads the current value of 64-bit Global Pointer (GP).\r | |
4498 | \r | |
4499 | Reads and returns the current value of GP.\r | |
4500 | This function is only available on IPF.\r | |
4501 | \r | |
4502 | @return The current value of GP.\r | |
4503 | \r | |
4504 | **/\r | |
4505 | UINT64\r | |
4506 | EFIAPI\r | |
4507 | AsmReadGp (\r | |
4508 | VOID\r | |
4509 | );\r | |
4510 | \r | |
4511 | \r | |
4512 | /**\r | |
4513 | Write the current value of 64-bit Global Pointer (GP).\r | |
4514 | \r | |
4515 | Writes the current value of GP. The 64-bit value written to the GP is returned.\r | |
4516 | No parameter checking is performed on Value.\r | |
4517 | This function is only available on IPF.\r | |
4518 | \r | |
4519 | @param Value The 64-bit value to write to GP.\r | |
4520 | \r | |
4521 | @return The 64-bit value written to the GP.\r | |
4522 | \r | |
4523 | **/\r | |
4524 | UINT64\r | |
4525 | EFIAPI\r | |
4526 | AsmWriteGp (\r | |
4527 | IN UINT64 Value\r | |
4528 | );\r | |
4529 | \r | |
4530 | \r | |
4531 | /**\r | |
4532 | Reads the current value of 64-bit Stack Pointer (SP).\r | |
4533 | \r | |
4534 | Reads and returns the current value of SP.\r | |
4535 | This function is only available on IPF.\r | |
4536 | \r | |
4537 | @return The current value of SP.\r | |
4538 | \r | |
4539 | **/\r | |
4540 | UINT64\r | |
4541 | EFIAPI\r | |
4542 | AsmReadSp (\r | |
4543 | VOID\r | |
4544 | );\r | |
4545 | \r | |
4546 | \r | |
aad6137d | 4547 | ///\r |
4548 | /// Valid Index value for AsmReadControlRegister()\r | |
4549 | ///\r | |
4550 | #define IPF_CONTROL_REGISTER_DCR 0\r | |
4551 | #define IPF_CONTROL_REGISTER_ITM 1\r | |
4552 | #define IPF_CONTROL_REGISTER_IVA 2\r | |
4553 | #define IPF_CONTROL_REGISTER_PTA 8\r | |
4554 | #define IPF_CONTROL_REGISTER_IPSR 16\r | |
4555 | #define IPF_CONTROL_REGISTER_ISR 17\r | |
4556 | #define IPF_CONTROL_REGISTER_IIP 19\r | |
4557 | #define IPF_CONTROL_REGISTER_IFA 20\r | |
4558 | #define IPF_CONTROL_REGISTER_ITIR 21\r | |
4559 | #define IPF_CONTROL_REGISTER_IIPA 22\r | |
4560 | #define IPF_CONTROL_REGISTER_IFS 23\r | |
4561 | #define IPF_CONTROL_REGISTER_IIM 24\r | |
4562 | #define IPF_CONTROL_REGISTER_IHA 25\r | |
4563 | #define IPF_CONTROL_REGISTER_LID 64\r | |
4564 | #define IPF_CONTROL_REGISTER_IVR 65\r | |
4565 | #define IPF_CONTROL_REGISTER_TPR 66\r | |
4566 | #define IPF_CONTROL_REGISTER_EOI 67\r | |
4567 | #define IPF_CONTROL_REGISTER_IRR0 68\r | |
4568 | #define IPF_CONTROL_REGISTER_IRR1 69\r | |
4569 | #define IPF_CONTROL_REGISTER_IRR2 70\r | |
4570 | #define IPF_CONTROL_REGISTER_IRR3 71\r | |
4571 | #define IPF_CONTROL_REGISTER_ITV 72\r | |
4572 | #define IPF_CONTROL_REGISTER_PMV 73\r | |
4573 | #define IPF_CONTROL_REGISTER_CMCV 74\r | |
4574 | #define IPF_CONTROL_REGISTER_LRR0 80\r | |
4575 | #define IPF_CONTROL_REGISTER_LRR1 81\r | |
4576 | \r | |
4577 | /**\r | |
4578 | Reads a 64-bit control register.\r | |
4579 | \r | |
4580 | Reads and returns the control register specified by Index. The valid Index valued are defined\r | |
4581 | above in "Related Definitions".\r | |
4582 | If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF.\r | |
4583 | \r | |
4584 | @param Index The index of the control register to read.\r | |
4585 | \r | |
4586 | @return The control register specified by Index.\r | |
4587 | \r | |
4588 | **/\r | |
4589 | UINT64\r | |
4590 | EFIAPI\r | |
4591 | AsmReadControlRegister (\r | |
4592 | IN UINT64 Index\r | |
4593 | );\r | |
4594 | \r | |
4595 | \r | |
4596 | ///\r | |
4597 | /// Valid Index value for AsmReadApplicationRegister()\r | |
4598 | ///\r | |
4599 | #define IPF_APPLICATION_REGISTER_K0 0\r | |
4600 | #define IPF_APPLICATION_REGISTER_K1 1\r | |
4601 | #define IPF_APPLICATION_REGISTER_K2 2\r | |
4602 | #define IPF_APPLICATION_REGISTER_K3 3\r | |
4603 | #define IPF_APPLICATION_REGISTER_K4 4\r | |
4604 | #define IPF_APPLICATION_REGISTER_K5 5\r | |
4605 | #define IPF_APPLICATION_REGISTER_K6 6\r | |
4606 | #define IPF_APPLICATION_REGISTER_K7 7\r | |
4607 | #define IPF_APPLICATION_REGISTER_RSC 16\r | |
4608 | #define IPF_APPLICATION_REGISTER_BSP 17\r | |
4609 | #define IPF_APPLICATION_REGISTER_BSPSTORE 18\r | |
4610 | #define IPF_APPLICATION_REGISTER_RNAT 19\r | |
4611 | #define IPF_APPLICATION_REGISTER_FCR 21\r | |
4612 | #define IPF_APPLICATION_REGISTER_EFLAG 24\r | |
4613 | #define IPF_APPLICATION_REGISTER_CSD 25\r | |
4614 | #define IPF_APPLICATION_REGISTER_SSD 26\r | |
4615 | #define IPF_APPLICATION_REGISTER_CFLG 27\r | |
4616 | #define IPF_APPLICATION_REGISTER_FSR 28\r | |
4617 | #define IPF_APPLICATION_REGISTER_FIR 29\r | |
4618 | #define IPF_APPLICATION_REGISTER_FDR 30\r | |
4619 | #define IPF_APPLICATION_REGISTER_CCV 32\r | |
4620 | #define IPF_APPLICATION_REGISTER_UNAT 36\r | |
4621 | #define IPF_APPLICATION_REGISTER_FPSR 40\r | |
4622 | #define IPF_APPLICATION_REGISTER_ITC 44\r | |
4623 | #define IPF_APPLICATION_REGISTER_PFS 64\r | |
4624 | #define IPF_APPLICATION_REGISTER_LC 65\r | |
4625 | #define IPF_APPLICATION_REGISTER_EC 66\r | |
4626 | \r | |
4627 | /**\r | |
4628 | Reads a 64-bit application register.\r | |
4629 | \r | |
4630 | Reads and returns the application register specified by Index. The valid Index valued are defined\r | |
4631 | above in "Related Definitions".\r | |
4632 | If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF.\r | |
4633 | \r | |
4634 | @param Index The index of the application register to read.\r | |
4635 | \r | |
4636 | @return The application register specified by Index.\r | |
4637 | \r | |
4638 | **/\r | |
4639 | UINT64\r | |
4640 | EFIAPI\r | |
4641 | AsmReadApplicationRegister (\r | |
4642 | IN UINT64 Index\r | |
4643 | );\r | |
4644 | \r | |
4645 | \r | |
59e0bb0c | 4646 | /**\r |
4647 | Reads the current value of a Machine Specific Register (MSR).\r | |
4648 | \r | |
4649 | Reads and returns the current value of the Machine Specific Register specified by Index. No\r | |
4650 | parameter checking is performed on Index, and if the Index value is beyond the implemented MSR\r | |
4651 | register range, a Reserved Register/Field fault may occur. The caller must either guarantee that\r | |
4652 | Index is valid, or the caller must set up fault handlers to catch the faults. This function is\r | |
4653 | only available on IPF.\r | |
4654 | \r | |
4655 | @param Index The 8-bit Machine Specific Register index to read.\r | |
4656 | \r | |
4657 | @return The current value of the Machine Specific Register specified by Index. \r | |
4658 | \r | |
4659 | **/\r | |
4660 | UINT64\r | |
4661 | EFIAPI\r | |
4662 | AsmReadMsr (\r | |
4663 | IN UINT8 Index \r | |
4664 | );\r | |
4665 | \r | |
4666 | \r | |
4667 | /**\r | |
4668 | Writes the current value of a Machine Specific Register (MSR).\r | |
4669 | \r | |
4670 | Writes Value to the Machine Specific Register specified by Index. Value is returned. No\r | |
4671 | parameter checking is performed on Index, and if the Index value is beyond the implemented MSR\r | |
4672 | register range, a Reserved Register/Field fault may occur. The caller must either guarantee that\r | |
4673 | Index is valid, or the caller must set up fault handlers to catch the faults. This function is\r | |
4674 | only available on IPF.\r | |
4675 | \r | |
4676 | @param Index The 8-bit Machine Specific Register index to write.\r | |
4677 | @param Value The 64-bit value to write to the Machine Specific Register.\r | |
4678 | \r | |
4679 | @return The 64-bit value to write to the Machine Specific Register. \r | |
4680 | \r | |
4681 | **/\r | |
4682 | UINT64\r | |
4683 | EFIAPI\r | |
4684 | AsmWriteMsr (\r | |
4685 | IN UINT8 Index, \r | |
4686 | IN UINT64 Value \r | |
4687 | );\r | |
4688 | \r | |
4689 | \r | |
ac644614 | 4690 | /**\r |
4691 | Determines if the CPU is currently executing in virtual, physical, or mixed mode.\r | |
4692 | \r | |
4693 | Determines the current execution mode of the CPU.\r | |
4694 | If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.\r | |
4695 | If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.\r | |
4696 | If the CPU is not in physical mode or virtual mode, then it is in mixed mode,\r | |
4697 | and -1 is returned.\r | |
4698 | This function is only available on IPF.\r | |
4699 | \r | |
17f695ed | 4700 | @retval 1 The CPU is in virtual mode.\r |
4701 | @retval 0 The CPU is in physical mode.\r | |
4702 | @retval -1 The CPU is in mixed mode.\r | |
ac644614 | 4703 | \r |
4704 | **/\r | |
4705 | INT64\r | |
4706 | EFIAPI\r | |
4707 | AsmCpuVirtual (\r | |
4708 | VOID\r | |
4709 | );\r | |
4710 | \r | |
4711 | \r | |
4712 | /**\r | |
4713 | Makes a PAL procedure call.\r | |
4714 | \r | |
4715 | This is a wrapper function to make a PAL procedure call. Based on the Index\r | |
4716 | value this API will make static or stacked PAL call. The following table\r | |
4717 | describes the usage of PAL Procedure Index Assignment. Architected procedures\r | |
4718 | may be designated as required or optional. If a PAL procedure is specified\r | |
4719 | as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the\r | |
4720 | Status field of the PAL_CALL_RETURN structure.\r | |
4721 | This indicates that the procedure is not present in this PAL implementation.\r | |
4722 | It is the caller's responsibility to check for this return code after calling\r | |
4723 | any optional PAL procedure.\r | |
4724 | No parameter checking is performed on the 5 input parameters, but there are\r | |
4725 | some common rules that the caller should follow when making a PAL call. Any\r | |
4726 | address passed to PAL as buffers for return parameters must be 8-byte aligned.\r | |
4727 | Unaligned addresses may cause undefined results. For those parameters defined\r | |
4728 | as reserved or some fields defined as reserved must be zero filled or the invalid\r | |
4729 | argument return value may be returned or undefined result may occur during the\r | |
4730 | execution of the procedure. If the PalEntryPoint does not point to a valid\r | |
4731 | PAL entry point then the system behavior is undefined. This function is only\r | |
4732 | available on IPF.\r | |
4733 | \r | |
ee6c452c | 4734 | @param PalEntryPoint The PAL procedure calls entry point.\r |
4735 | @param Index The PAL procedure Index number.\r | |
4736 | @param Arg2 The 2nd parameter for PAL procedure calls.\r | |
4737 | @param Arg3 The 3rd parameter for PAL procedure calls.\r | |
4738 | @param Arg4 The 4th parameter for PAL procedure calls.\r | |
ac644614 | 4739 | \r |
4740 | @return structure returned from the PAL Call procedure, including the status and return value.\r | |
4741 | \r | |
4742 | **/\r | |
4743 | PAL_CALL_RETURN\r | |
4744 | EFIAPI\r | |
4745 | AsmPalCall (\r | |
4746 | IN UINT64 PalEntryPoint,\r | |
4747 | IN UINT64 Index,\r | |
4748 | IN UINT64 Arg2,\r | |
4749 | IN UINT64 Arg3,\r | |
4750 | IN UINT64 Arg4\r | |
4751 | );\r | |
fd163050 | 4752 | #endif\r |
ac644614 | 4753 | \r |
fd163050 | 4754 | #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)\r |
1106ffe1 | 4755 | ///\r |
030cd1a2 | 4756 | /// IA32 and x64 Specific Functions\r |
1106ffe1 | 4757 | /// Byte packed structure for 16-bit Real Mode EFLAGS\r |
4758 | ///\r | |
ac644614 | 4759 | typedef union {\r |
4760 | struct {\r | |
2a53dabf LG |
4761 | UINT32 CF:1; ///< Carry Flag\r |
4762 | UINT32 Reserved_0:1; ///< Reserved\r | |
4763 | UINT32 PF:1; ///< Parity Flag\r | |
4764 | UINT32 Reserved_1:1; ///< Reserved\r | |
4765 | UINT32 AF:1; ///< Auxiliary Carry Flag\r | |
4766 | UINT32 Reserved_2:1; ///< Reserved\r | |
4767 | UINT32 ZF:1; ///< Zero Flag\r | |
4768 | UINT32 SF:1; ///< Sign Flag\r | |
4769 | UINT32 TF:1; ///< Trap Flag\r | |
4770 | UINT32 IF:1; ///< Interrupt Enable Flag\r | |
4771 | UINT32 DF:1; ///< Direction Flag\r | |
4772 | UINT32 OF:1; ///< Overflow Flag\r | |
4773 | UINT32 IOPL:2; ///< I/O Privilege Level\r | |
4774 | UINT32 NT:1; ///< Nested Task\r | |
4775 | UINT32 Reserved_3:1; ///< Reserved\r | |
ac644614 | 4776 | } Bits;\r |
4777 | UINT16 Uint16;\r | |
4778 | } IA32_FLAGS16;\r | |
4779 | \r | |
1106ffe1 | 4780 | ///\r |
4781 | /// Byte packed structure for EFLAGS/RFLAGS\r | |
4782 | /// 32-bits on IA-32\r | |
030cd1a2 | 4783 | /// 64-bits on x64. The upper 32-bits on x64 are reserved\r |
1106ffe1 | 4784 | ///\r |
ac644614 | 4785 | typedef union {\r |
4786 | struct {\r | |
2a53dabf LG |
4787 | UINT32 CF:1; ///< Carry Flag\r |
4788 | UINT32 Reserved_0:1; ///< Reserved\r | |
4789 | UINT32 PF:1; ///< Parity Flag\r | |
4790 | UINT32 Reserved_1:1; ///< Reserved\r | |
4791 | UINT32 AF:1; ///< Auxiliary Carry Flag\r | |
4792 | UINT32 Reserved_2:1; ///< Reserved\r | |
4793 | UINT32 ZF:1; ///< Zero Flag\r | |
4794 | UINT32 SF:1; ///< Sign Flag\r | |
4795 | UINT32 TF:1; ///< Trap Flag\r | |
4796 | UINT32 IF:1; ///< Interrupt Enable Flag\r | |
4797 | UINT32 DF:1; ///< Direction Flag\r | |
4798 | UINT32 OF:1; ///< Overflow Flag\r | |
4799 | UINT32 IOPL:2; ///< I/O Privilege Level\r | |
4800 | UINT32 NT:1; ///< Nested Task\r | |
4801 | UINT32 Reserved_3:1; ///< Reserved\r | |
4802 | UINT32 RF:1; ///< Resume Flag\r | |
4803 | UINT32 VM:1; ///< Virtual 8086 Mode\r | |
4804 | UINT32 AC:1; ///< Alignment Check\r | |
4805 | UINT32 VIF:1; ///< Virtual Interrupt Flag\r | |
4806 | UINT32 VIP:1; ///< Virtual Interrupt Pending\r | |
4807 | UINT32 ID:1; ///< ID Flag\r | |
4808 | UINT32 Reserved_4:10; ///< Reserved\r | |
ac644614 | 4809 | } Bits;\r |
4810 | UINTN UintN;\r | |
4811 | } IA32_EFLAGS32;\r | |
4812 | \r | |
1106ffe1 | 4813 | ///\r |
4814 | /// Byte packed structure for Control Register 0 (CR0)\r | |
4815 | /// 32-bits on IA-32\r | |
030cd1a2 | 4816 | /// 64-bits on x64. The upper 32-bits on x64 are reserved\r |
1106ffe1 | 4817 | ///\r |
ac644614 | 4818 | typedef union {\r |
4819 | struct {\r | |
2a53dabf LG |
4820 | UINT32 PE:1; ///< Protection Enable\r |
4821 | UINT32 MP:1; ///< Monitor Coprocessor\r | |
4822 | UINT32 EM:1; ///< Emulation\r | |
4823 | UINT32 TS:1; ///< Task Switched\r | |
4824 | UINT32 ET:1; ///< Extension Type\r | |
4825 | UINT32 NE:1; ///< Numeric Error\r | |
4826 | UINT32 Reserved_0:10; ///< Reserved\r | |
4827 | UINT32 WP:1; ///< Write Protect\r | |
4828 | UINT32 Reserved_1:1; ///< Reserved\r | |
4829 | UINT32 AM:1; ///< Alignment Mask\r | |
4830 | UINT32 Reserved_2:10; ///< Reserved\r | |
4831 | UINT32 NW:1; ///< Mot Write-through\r | |
4832 | UINT32 CD:1; ///< Cache Disable\r | |
4833 | UINT32 PG:1; ///< Paging\r | |
ac644614 | 4834 | } Bits;\r |
4835 | UINTN UintN;\r | |
4836 | } IA32_CR0;\r | |
4837 | \r | |
1106ffe1 | 4838 | ///\r |
4839 | /// Byte packed structure for Control Register 4 (CR4)\r | |
4840 | /// 32-bits on IA-32\r | |
030cd1a2 | 4841 | /// 64-bits on x64. The upper 32-bits on x64 are reserved\r |
1106ffe1 | 4842 | ///\r |
ac644614 | 4843 | typedef union {\r |
4844 | struct {\r | |
2a53dabf LG |
4845 | UINT32 VME:1; ///< Virtual-8086 Mode Extensions\r |
4846 | UINT32 PVI:1; ///< Protected-Mode Virtual Interrupts\r | |
4847 | UINT32 TSD:1; ///< Time Stamp Disable\r | |
4848 | UINT32 DE:1; ///< Debugging Extensions\r | |
4849 | UINT32 PSE:1; ///< Page Size Extensions\r | |
4850 | UINT32 PAE:1; ///< Physical Address Extension\r | |
4851 | UINT32 MCE:1; ///< Machine Check Enable\r | |
4852 | UINT32 PGE:1; ///< Page Global Enable\r | |
4853 | UINT32 PCE:1; ///< Performance Monitoring Counter\r | |
4854 | ///< Enable\r | |
4855 | UINT32 OSFXSR:1; ///< Operating System Support for\r | |
4856 | ///< FXSAVE and FXRSTOR instructions\r | |
4857 | UINT32 OSXMMEXCPT:1; ///< Operating System Support for\r | |
4858 | ///< Unmasked SIMD Floating Point\r | |
4859 | ///< Exceptions\r | |
4860 | UINT32 Reserved_0:2; ///< Reserved\r | |
4861 | UINT32 VMXE:1; ///< VMX Enable\r | |
77f863ee | 4862 | UINT32 Reserved_1:18; ///< Reserved\r |
ac644614 | 4863 | } Bits;\r |
4864 | UINTN UintN;\r | |
4865 | } IA32_CR4;\r | |
4866 | \r | |
1106ffe1 | 4867 | ///\r |
4868 | /// Byte packed structure for an IDTR, GDTR, LDTR descriptor\r | |
1106ffe1 | 4869 | ///\r |
ac644614 | 4870 | #pragma pack (1)\r |
4871 | typedef struct {\r | |
4872 | UINT16 Limit;\r | |
4873 | UINTN Base;\r | |
4874 | } IA32_DESCRIPTOR;\r | |
4875 | #pragma pack ()\r | |
4876 | \r | |
4877 | #define IA32_IDT_GATE_TYPE_TASK 0x85\r | |
4878 | #define IA32_IDT_GATE_TYPE_INTERRUPT_16 0x86\r | |
4879 | #define IA32_IDT_GATE_TYPE_TRAP_16 0x87\r | |
4880 | #define IA32_IDT_GATE_TYPE_INTERRUPT_32 0x8E\r | |
4881 | #define IA32_IDT_GATE_TYPE_TRAP_32 0x8F\r | |
4882 | \r | |
6f4aad3b | 4883 | \r |
4884 | #if defined (MDE_CPU_IA32)\r | |
1106ffe1 | 4885 | ///\r |
6f4aad3b | 4886 | /// Byte packed structure for an IA32 Interrupt Gate Descriptor\r |
1106ffe1 | 4887 | ///\r |
dc317713 | 4888 | typedef union {\r |
4889 | struct {\r | |
6f4aad3b | 4890 | UINT32 OffsetLow:16; ///< Offset bits 15..0\r |
4891 | UINT32 Selector:16; ///< Selector\r | |
4892 | UINT32 Reserved_0:8; ///< Reserved\r | |
4893 | UINT32 GateType:8; ///< Gate Type. See #defines above\r | |
4894 | UINT32 OffsetHigh:16; ///< Offset bits 31..16\r | |
dc317713 | 4895 | } Bits;\r |
4896 | UINT64 Uint64;\r | |
4897 | } IA32_IDT_GATE_DESCRIPTOR;\r | |
4898 | \r | |
4899 | #endif\r | |
4900 | \r | |
4901 | #if defined (MDE_CPU_X64)\r | |
6f4aad3b | 4902 | ///\r |
4903 | /// Byte packed structure for an x64 Interrupt Gate Descriptor\r | |
4904 | ///\r | |
ac644614 | 4905 | typedef union {\r |
4906 | struct {\r | |
6f4aad3b | 4907 | UINT32 OffsetLow:16; ///< Offset bits 15..0\r |
4908 | UINT32 Selector:16; ///< Selector\r | |
4909 | UINT32 Reserved_0:8; ///< Reserved\r | |
4910 | UINT32 GateType:8; ///< Gate Type. See #defines above\r | |
4911 | UINT32 OffsetHigh:16; ///< Offset bits 31..16\r | |
4912 | UINT32 OffsetUpper:32; ///< Offset bits 63..32\r | |
4913 | UINT32 Reserved_1:32; ///< Reserved\r | |
ac644614 | 4914 | } Bits;\r |
6f4aad3b | 4915 | struct {\r |
4916 | UINT64 Uint64;\r | |
4917 | UINT64 Uint64_1;\r | |
4918 | } Uint128; \r | |
ac644614 | 4919 | } IA32_IDT_GATE_DESCRIPTOR;\r |
4920 | \r | |
dc317713 | 4921 | #endif\r |
4922 | \r | |
1106ffe1 | 4923 | ///\r |
4924 | /// Byte packed structure for an FP/SSE/SSE2 context\r | |
4925 | ///\r | |
ac644614 | 4926 | typedef struct {\r |
4927 | UINT8 Buffer[512];\r | |
4928 | } IA32_FX_BUFFER;\r | |
4929 | \r | |
1106ffe1 | 4930 | ///\r |
4931 | /// Structures for the 16-bit real mode thunks\r | |
4932 | ///\r | |
ac644614 | 4933 | typedef struct {\r |
4934 | UINT32 Reserved1;\r | |
4935 | UINT32 Reserved2;\r | |
4936 | UINT32 Reserved3;\r | |
4937 | UINT32 Reserved4;\r | |
4938 | UINT8 BL;\r | |
4939 | UINT8 BH;\r | |
4940 | UINT16 Reserved5;\r | |
4941 | UINT8 DL;\r | |
4942 | UINT8 DH;\r | |
4943 | UINT16 Reserved6;\r | |
4944 | UINT8 CL;\r | |
4945 | UINT8 CH;\r | |
4946 | UINT16 Reserved7;\r | |
4947 | UINT8 AL;\r | |
4948 | UINT8 AH;\r | |
4949 | UINT16 Reserved8;\r | |
4950 | } IA32_BYTE_REGS;\r | |
4951 | \r | |
4952 | typedef struct {\r | |
4953 | UINT16 DI;\r | |
4954 | UINT16 Reserved1;\r | |
4955 | UINT16 SI;\r | |
4956 | UINT16 Reserved2;\r | |
4957 | UINT16 BP;\r | |
4958 | UINT16 Reserved3;\r | |
4959 | UINT16 SP;\r | |
4960 | UINT16 Reserved4;\r | |
4961 | UINT16 BX;\r | |
4962 | UINT16 Reserved5;\r | |
4963 | UINT16 DX;\r | |
4964 | UINT16 Reserved6;\r | |
4965 | UINT16 CX;\r | |
4966 | UINT16 Reserved7;\r | |
4967 | UINT16 AX;\r | |
4968 | UINT16 Reserved8;\r | |
4969 | } IA32_WORD_REGS;\r | |
4970 | \r | |
4971 | typedef struct {\r | |
4972 | UINT32 EDI;\r | |
4973 | UINT32 ESI;\r | |
4974 | UINT32 EBP;\r | |
4975 | UINT32 ESP;\r | |
4976 | UINT32 EBX;\r | |
4977 | UINT32 EDX;\r | |
4978 | UINT32 ECX;\r | |
4979 | UINT32 EAX;\r | |
4980 | UINT16 DS;\r | |
4981 | UINT16 ES;\r | |
4982 | UINT16 FS;\r | |
4983 | UINT16 GS;\r | |
4984 | IA32_EFLAGS32 EFLAGS;\r | |
4985 | UINT32 Eip;\r | |
4986 | UINT16 CS;\r | |
4987 | UINT16 SS;\r | |
4988 | } IA32_DWORD_REGS;\r | |
4989 | \r | |
4990 | typedef union {\r | |
4991 | IA32_DWORD_REGS E;\r | |
4992 | IA32_WORD_REGS X;\r | |
4993 | IA32_BYTE_REGS H;\r | |
4994 | } IA32_REGISTER_SET;\r | |
4995 | \r | |
1106ffe1 | 4996 | ///\r |
4997 | /// Byte packed structure for an 16-bit real mode thunks\r | |
4998 | ///\r | |
ac644614 | 4999 | typedef struct {\r |
5000 | IA32_REGISTER_SET *RealModeState;\r | |
5001 | VOID *RealModeBuffer;\r | |
5002 | UINT32 RealModeBufferSize;\r | |
5003 | UINT32 ThunkAttributes;\r | |
5004 | } THUNK_CONTEXT;\r | |
5005 | \r | |
5006 | #define THUNK_ATTRIBUTE_BIG_REAL_MODE 0x00000001\r | |
5007 | #define THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 0x00000002\r | |
5008 | #define THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL 0x00000004\r | |
5009 | \r | |
5010 | /**\r | |
5011 | Retrieves CPUID information.\r | |
5012 | \r | |
5013 | Executes the CPUID instruction with EAX set to the value specified by Index.\r | |
5014 | This function always returns Index.\r | |
5015 | If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.\r | |
5016 | If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.\r | |
5017 | If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.\r | |
5018 | If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.\r | |
030cd1a2 | 5019 | This function is only available on IA-32 and x64.\r |
ac644614 | 5020 | \r |
5021 | @param Index The 32-bit value to load into EAX prior to invoking the CPUID\r | |
5022 | instruction.\r | |
5023 | @param Eax Pointer to the 32-bit EAX value returned by the CPUID\r | |
5024 | instruction. This is an optional parameter that may be NULL.\r | |
5025 | @param Ebx Pointer to the 32-bit EBX value returned by the CPUID\r | |
5026 | instruction. This is an optional parameter that may be NULL.\r | |
5027 | @param Ecx Pointer to the 32-bit ECX value returned by the CPUID\r | |
5028 | instruction. This is an optional parameter that may be NULL.\r | |
5029 | @param Edx Pointer to the 32-bit EDX value returned by the CPUID\r | |
5030 | instruction. This is an optional parameter that may be NULL.\r | |
5031 | \r | |
2fe241a2 | 5032 | @return Index.\r |
ac644614 | 5033 | \r |
5034 | **/\r | |
5035 | UINT32\r | |
5036 | EFIAPI\r | |
5037 | AsmCpuid (\r | |
5038 | IN UINT32 Index,\r | |
5039 | OUT UINT32 *Eax, OPTIONAL\r | |
5040 | OUT UINT32 *Ebx, OPTIONAL\r | |
5041 | OUT UINT32 *Ecx, OPTIONAL\r | |
5042 | OUT UINT32 *Edx OPTIONAL\r | |
5043 | );\r | |
5044 | \r | |
5045 | \r | |
5046 | /**\r | |
5047 | Retrieves CPUID information using an extended leaf identifier.\r | |
5048 | \r | |
5049 | Executes the CPUID instruction with EAX set to the value specified by Index\r | |
5050 | and ECX set to the value specified by SubIndex. This function always returns\r | |
5051 | Index. This function is only available on IA-32 and x64.\r | |
5052 | \r | |
5053 | If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.\r | |
5054 | If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.\r | |
5055 | If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.\r | |
5056 | If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.\r | |
5057 | \r | |
5058 | @param Index The 32-bit value to load into EAX prior to invoking the\r | |
5059 | CPUID instruction.\r | |
5060 | @param SubIndex The 32-bit value to load into ECX prior to invoking the\r | |
5061 | CPUID instruction.\r | |
5062 | @param Eax Pointer to the 32-bit EAX value returned by the CPUID\r | |
5063 | instruction. This is an optional parameter that may be\r | |
5064 | NULL.\r | |
5065 | @param Ebx Pointer to the 32-bit EBX value returned by the CPUID\r | |
5066 | instruction. This is an optional parameter that may be\r | |
5067 | NULL.\r | |
5068 | @param Ecx Pointer to the 32-bit ECX value returned by the CPUID\r | |
5069 | instruction. This is an optional parameter that may be\r | |
5070 | NULL.\r | |
5071 | @param Edx Pointer to the 32-bit EDX value returned by the CPUID\r | |
5072 | instruction. This is an optional parameter that may be\r | |
5073 | NULL.\r | |
5074 | \r | |
2fe241a2 | 5075 | @return Index.\r |
ac644614 | 5076 | \r |
5077 | **/\r | |
5078 | UINT32\r | |
5079 | EFIAPI\r | |
5080 | AsmCpuidEx (\r | |
5081 | IN UINT32 Index,\r | |
5082 | IN UINT32 SubIndex,\r | |
5083 | OUT UINT32 *Eax, OPTIONAL\r | |
5084 | OUT UINT32 *Ebx, OPTIONAL\r | |
5085 | OUT UINT32 *Ecx, OPTIONAL\r | |
5086 | OUT UINT32 *Edx OPTIONAL\r | |
5087 | );\r | |
5088 | \r | |
5089 | \r | |
be5f1614 | 5090 | /**\r |
5091 | Set CD bit and clear NW bit of CR0 followed by a WBINVD.\r | |
5092 | \r | |
5093 | Disables the caches by setting the CD bit of CR0 to 1, clearing the NW bit of CR0 to 0,\r | |
5094 | and executing a WBINVD instruction. This function is only available on IA-32 and x64.\r | |
5095 | \r | |
5096 | **/\r | |
5097 | VOID\r | |
5098 | EFIAPI\r | |
5099 | AsmDisableCache (\r | |
5100 | VOID\r | |
5101 | );\r | |
5102 | \r | |
5103 | \r | |
5104 | /**\r | |
5105 | Perform a WBINVD and clear both the CD and NW bits of CR0.\r | |
5106 | \r | |
5107 | Enables the caches by executing a WBINVD instruction and then clear both the CD and NW\r | |
5108 | bits of CR0 to 0. This function is only available on IA-32 and x64.\r | |
5109 | \r | |
5110 | **/\r | |
5111 | VOID\r | |
5112 | EFIAPI\r | |
5113 | AsmEnableCache (\r | |
5114 | VOID\r | |
5115 | );\r | |
5116 | \r | |
5117 | \r | |
ac644614 | 5118 | /**\r |
5119 | Returns the lower 32-bits of a Machine Specific Register(MSR).\r | |
5120 | \r | |
5121 | Reads and returns the lower 32-bits of the MSR specified by Index.\r | |
5122 | No parameter checking is performed on Index, and some Index values may cause\r | |
5123 | CPU exceptions. The caller must either guarantee that Index is valid, or the\r | |
5124 | caller must set up exception handlers to catch the exceptions. This function\r | |
030cd1a2 | 5125 | is only available on IA-32 and x64.\r |
ac644614 | 5126 | \r |
5127 | @param Index The 32-bit MSR index to read.\r | |
5128 | \r | |
5129 | @return The lower 32 bits of the MSR identified by Index.\r | |
5130 | \r | |
5131 | **/\r | |
5132 | UINT32\r | |
5133 | EFIAPI\r | |
5134 | AsmReadMsr32 (\r | |
5135 | IN UINT32 Index\r | |
5136 | );\r | |
5137 | \r | |
5138 | \r | |
5139 | /**\r | |
17f695ed | 5140 | Writes a 32-bit value to a Machine Specific Register(MSR), and returns the value.\r |
5141 | The upper 32-bits of the MSR are set to zero.\r | |
ac644614 | 5142 | \r |
5143 | Writes the 32-bit value specified by Value to the MSR specified by Index. The\r | |
5144 | upper 32-bits of the MSR write are set to zero. The 32-bit value written to\r | |
5145 | the MSR is returned. No parameter checking is performed on Index or Value,\r | |
5146 | and some of these may cause CPU exceptions. The caller must either guarantee\r | |
5147 | that Index and Value are valid, or the caller must establish proper exception\r | |
030cd1a2 | 5148 | handlers. This function is only available on IA-32 and x64.\r |
ac644614 | 5149 | \r |
5150 | @param Index The 32-bit MSR index to write.\r | |
5151 | @param Value The 32-bit value to write to the MSR.\r | |
5152 | \r | |
5153 | @return Value\r | |
5154 | \r | |
5155 | **/\r | |
5156 | UINT32\r | |
5157 | EFIAPI\r | |
5158 | AsmWriteMsr32 (\r | |
5159 | IN UINT32 Index,\r | |
5160 | IN UINT32 Value\r | |
5161 | );\r | |
5162 | \r | |
5163 | \r | |
5164 | /**\r | |
62991af2 | 5165 | Reads a 64-bit MSR, performs a bitwise OR on the lower 32-bits, and\r |
ac644614 | 5166 | writes the result back to the 64-bit MSR.\r |
5167 | \r | |
62991af2 | 5168 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 5169 | between the lower 32-bits of the read result and the value specified by\r |
5170 | OrData, and writes the result to the 64-bit MSR specified by Index. The lower\r | |
5171 | 32-bits of the value written to the MSR is returned. No parameter checking is\r | |
5172 | performed on Index or OrData, and some of these may cause CPU exceptions. The\r | |
5173 | caller must either guarantee that Index and OrData are valid, or the caller\r | |
5174 | must establish proper exception handlers. This function is only available on\r | |
030cd1a2 | 5175 | IA-32 and x64.\r |
ac644614 | 5176 | \r |
5177 | @param Index The 32-bit MSR index to write.\r | |
5178 | @param OrData The value to OR with the read value from the MSR.\r | |
5179 | \r | |
5180 | @return The lower 32-bit value written to the MSR.\r | |
5181 | \r | |
5182 | **/\r | |
5183 | UINT32\r | |
5184 | EFIAPI\r | |
5185 | AsmMsrOr32 (\r | |
5186 | IN UINT32 Index,\r | |
5187 | IN UINT32 OrData\r | |
5188 | );\r | |
5189 | \r | |
5190 | \r | |
5191 | /**\r | |
5192 | Reads a 64-bit MSR, performs a bitwise AND on the lower 32-bits, and writes\r | |
5193 | the result back to the 64-bit MSR.\r | |
5194 | \r | |
5195 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
5196 | lower 32-bits of the read result and the value specified by AndData, and\r | |
5197 | writes the result to the 64-bit MSR specified by Index. The lower 32-bits of\r | |
5198 | the value written to the MSR is returned. No parameter checking is performed\r | |
5199 | on Index or AndData, and some of these may cause CPU exceptions. The caller\r | |
5200 | must either guarantee that Index and AndData are valid, or the caller must\r | |
5201 | establish proper exception handlers. This function is only available on IA-32\r | |
030cd1a2 | 5202 | and x64.\r |
ac644614 | 5203 | \r |
5204 | @param Index The 32-bit MSR index to write.\r | |
5205 | @param AndData The value to AND with the read value from the MSR.\r | |
5206 | \r | |
5207 | @return The lower 32-bit value written to the MSR.\r | |
5208 | \r | |
5209 | **/\r | |
5210 | UINT32\r | |
5211 | EFIAPI\r | |
5212 | AsmMsrAnd32 (\r | |
5213 | IN UINT32 Index,\r | |
5214 | IN UINT32 AndData\r | |
5215 | );\r | |
5216 | \r | |
5217 | \r | |
5218 | /**\r | |
62991af2 | 5219 | Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise OR\r |
ac644614 | 5220 | on the lower 32-bits, and writes the result back to the 64-bit MSR.\r |
5221 | \r | |
5222 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
5223 | lower 32-bits of the read result and the value specified by AndData\r | |
62991af2 | 5224 | preserving the upper 32-bits, performs a bitwise OR between the\r |
ac644614 | 5225 | result of the AND operation and the value specified by OrData, and writes the\r |
5226 | result to the 64-bit MSR specified by Address. The lower 32-bits of the value\r | |
5227 | written to the MSR is returned. No parameter checking is performed on Index,\r | |
5228 | AndData, or OrData, and some of these may cause CPU exceptions. The caller\r | |
5229 | must either guarantee that Index, AndData, and OrData are valid, or the\r | |
5230 | caller must establish proper exception handlers. This function is only\r | |
030cd1a2 | 5231 | available on IA-32 and x64.\r |
ac644614 | 5232 | \r |
5233 | @param Index The 32-bit MSR index to write.\r | |
5234 | @param AndData The value to AND with the read value from the MSR.\r | |
5235 | @param OrData The value to OR with the result of the AND operation.\r | |
5236 | \r | |
5237 | @return The lower 32-bit value written to the MSR.\r | |
5238 | \r | |
5239 | **/\r | |
5240 | UINT32\r | |
5241 | EFIAPI\r | |
5242 | AsmMsrAndThenOr32 (\r | |
5243 | IN UINT32 Index,\r | |
5244 | IN UINT32 AndData,\r | |
5245 | IN UINT32 OrData\r | |
5246 | );\r | |
5247 | \r | |
5248 | \r | |
5249 | /**\r | |
5250 | Reads a bit field of an MSR.\r | |
5251 | \r | |
5252 | Reads the bit field in the lower 32-bits of a 64-bit MSR. The bit field is\r | |
5253 | specified by the StartBit and the EndBit. The value of the bit field is\r | |
5254 | returned. The caller must either guarantee that Index is valid, or the caller\r | |
5255 | must set up exception handlers to catch the exceptions. This function is only\r | |
030cd1a2 | 5256 | available on IA-32 and x64.\r |
ac644614 | 5257 | \r |
5258 | If StartBit is greater than 31, then ASSERT().\r | |
5259 | If EndBit is greater than 31, then ASSERT().\r | |
5260 | If EndBit is less than StartBit, then ASSERT().\r | |
5261 | \r | |
5262 | @param Index The 32-bit MSR index to read.\r | |
5263 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5264 | Range 0..31.\r | |
5265 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5266 | Range 0..31.\r | |
5267 | \r | |
5268 | @return The bit field read from the MSR.\r | |
5269 | \r | |
5270 | **/\r | |
5271 | UINT32\r | |
5272 | EFIAPI\r | |
5273 | AsmMsrBitFieldRead32 (\r | |
5274 | IN UINT32 Index,\r | |
5275 | IN UINTN StartBit,\r | |
5276 | IN UINTN EndBit\r | |
5277 | );\r | |
5278 | \r | |
5279 | \r | |
5280 | /**\r | |
5281 | Writes a bit field to an MSR.\r | |
5282 | \r | |
2fe241a2 | 5283 | Writes Value to a bit field in the lower 32-bits of a 64-bit MSR. The bit\r |
ac644614 | 5284 | field is specified by the StartBit and the EndBit. All other bits in the\r |
5285 | destination MSR are preserved. The lower 32-bits of the MSR written is\r | |
62991af2 | 5286 | returned. The caller must either guarantee that Index and the data written \r |
5287 | is valid, or the caller must set up exception handlers to catch the exceptions. \r | |
5288 | This function is only available on IA-32 and x64.\r | |
ac644614 | 5289 | \r |
5290 | If StartBit is greater than 31, then ASSERT().\r | |
5291 | If EndBit is greater than 31, then ASSERT().\r | |
5292 | If EndBit is less than StartBit, then ASSERT().\r | |
5293 | \r | |
5294 | @param Index The 32-bit MSR index to write.\r | |
5295 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5296 | Range 0..31.\r | |
5297 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5298 | Range 0..31.\r | |
5299 | @param Value New value of the bit field.\r | |
5300 | \r | |
5301 | @return The lower 32-bit of the value written to the MSR.\r | |
5302 | \r | |
5303 | **/\r | |
5304 | UINT32\r | |
5305 | EFIAPI\r | |
5306 | AsmMsrBitFieldWrite32 (\r | |
5307 | IN UINT32 Index,\r | |
5308 | IN UINTN StartBit,\r | |
5309 | IN UINTN EndBit,\r | |
5310 | IN UINT32 Value\r | |
5311 | );\r | |
5312 | \r | |
5313 | \r | |
5314 | /**\r | |
5315 | Reads a bit field in a 64-bit MSR, performs a bitwise OR, and writes the\r | |
5316 | result back to the bit field in the 64-bit MSR.\r | |
5317 | \r | |
62991af2 | 5318 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 5319 | between the read result and the value specified by OrData, and writes the\r |
5320 | result to the 64-bit MSR specified by Index. The lower 32-bits of the value\r | |
5321 | written to the MSR are returned. Extra left bits in OrData are stripped. The\r | |
5322 | caller must either guarantee that Index and the data written is valid, or\r | |
5323 | the caller must set up exception handlers to catch the exceptions. This\r | |
030cd1a2 | 5324 | function is only available on IA-32 and x64.\r |
ac644614 | 5325 | \r |
5326 | If StartBit is greater than 31, then ASSERT().\r | |
5327 | If EndBit is greater than 31, then ASSERT().\r | |
5328 | If EndBit is less than StartBit, then ASSERT().\r | |
5329 | \r | |
5330 | @param Index The 32-bit MSR index to write.\r | |
5331 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5332 | Range 0..31.\r | |
5333 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5334 | Range 0..31.\r | |
5335 | @param OrData The value to OR with the read value from the MSR.\r | |
5336 | \r | |
5337 | @return The lower 32-bit of the value written to the MSR.\r | |
5338 | \r | |
5339 | **/\r | |
5340 | UINT32\r | |
5341 | EFIAPI\r | |
5342 | AsmMsrBitFieldOr32 (\r | |
5343 | IN UINT32 Index,\r | |
5344 | IN UINTN StartBit,\r | |
5345 | IN UINTN EndBit,\r | |
5346 | IN UINT32 OrData\r | |
5347 | );\r | |
5348 | \r | |
5349 | \r | |
5350 | /**\r | |
5351 | Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r | |
5352 | result back to the bit field in the 64-bit MSR.\r | |
5353 | \r | |
5354 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
5355 | read result and the value specified by AndData, and writes the result to the\r | |
5356 | 64-bit MSR specified by Index. The lower 32-bits of the value written to the\r | |
5357 | MSR are returned. Extra left bits in AndData are stripped. The caller must\r | |
5358 | either guarantee that Index and the data written is valid, or the caller must\r | |
5359 | set up exception handlers to catch the exceptions. This function is only\r | |
030cd1a2 | 5360 | available on IA-32 and x64.\r |
ac644614 | 5361 | \r |
5362 | If StartBit is greater than 31, then ASSERT().\r | |
5363 | If EndBit is greater than 31, then ASSERT().\r | |
5364 | If EndBit is less than StartBit, then ASSERT().\r | |
5365 | \r | |
5366 | @param Index The 32-bit MSR index to write.\r | |
5367 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5368 | Range 0..31.\r | |
5369 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5370 | Range 0..31.\r | |
5371 | @param AndData The value to AND with the read value from the MSR.\r | |
5372 | \r | |
5373 | @return The lower 32-bit of the value written to the MSR.\r | |
5374 | \r | |
5375 | **/\r | |
5376 | UINT32\r | |
5377 | EFIAPI\r | |
5378 | AsmMsrBitFieldAnd32 (\r | |
5379 | IN UINT32 Index,\r | |
5380 | IN UINTN StartBit,\r | |
5381 | IN UINTN EndBit,\r | |
5382 | IN UINT32 AndData\r | |
5383 | );\r | |
5384 | \r | |
5385 | \r | |
5386 | /**\r | |
5387 | Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r | |
62991af2 | 5388 | bitwise OR, and writes the result back to the bit field in the\r |
ac644614 | 5389 | 64-bit MSR.\r |
5390 | \r | |
5391 | Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by a\r | |
62991af2 | 5392 | bitwise OR between the read result and the value specified by\r |
ac644614 | 5393 | AndData, and writes the result to the 64-bit MSR specified by Index. The\r |
5394 | lower 32-bits of the value written to the MSR are returned. Extra left bits\r | |
5395 | in both AndData and OrData are stripped. The caller must either guarantee\r | |
5396 | that Index and the data written is valid, or the caller must set up exception\r | |
5397 | handlers to catch the exceptions. This function is only available on IA-32\r | |
030cd1a2 | 5398 | and x64.\r |
ac644614 | 5399 | \r |
5400 | If StartBit is greater than 31, then ASSERT().\r | |
5401 | If EndBit is greater than 31, then ASSERT().\r | |
5402 | If EndBit is less than StartBit, then ASSERT().\r | |
5403 | \r | |
5404 | @param Index The 32-bit MSR index to write.\r | |
5405 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5406 | Range 0..31.\r | |
5407 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5408 | Range 0..31.\r | |
5409 | @param AndData The value to AND with the read value from the MSR.\r | |
5410 | @param OrData The value to OR with the result of the AND operation.\r | |
5411 | \r | |
5412 | @return The lower 32-bit of the value written to the MSR.\r | |
5413 | \r | |
5414 | **/\r | |
5415 | UINT32\r | |
5416 | EFIAPI\r | |
5417 | AsmMsrBitFieldAndThenOr32 (\r | |
5418 | IN UINT32 Index,\r | |
5419 | IN UINTN StartBit,\r | |
5420 | IN UINTN EndBit,\r | |
5421 | IN UINT32 AndData,\r | |
5422 | IN UINT32 OrData\r | |
5423 | );\r | |
5424 | \r | |
5425 | \r | |
5426 | /**\r | |
5427 | Returns a 64-bit Machine Specific Register(MSR).\r | |
5428 | \r | |
5429 | Reads and returns the 64-bit MSR specified by Index. No parameter checking is\r | |
5430 | performed on Index, and some Index values may cause CPU exceptions. The\r | |
5431 | caller must either guarantee that Index is valid, or the caller must set up\r | |
5432 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 5433 | on IA-32 and x64.\r |
ac644614 | 5434 | \r |
5435 | @param Index The 32-bit MSR index to read.\r | |
5436 | \r | |
5437 | @return The value of the MSR identified by Index.\r | |
5438 | \r | |
5439 | **/\r | |
5440 | UINT64\r | |
5441 | EFIAPI\r | |
5442 | AsmReadMsr64 (\r | |
5443 | IN UINT32 Index\r | |
5444 | );\r | |
5445 | \r | |
5446 | \r | |
5447 | /**\r | |
5448 | Writes a 64-bit value to a Machine Specific Register(MSR), and returns the\r | |
5449 | value.\r | |
5450 | \r | |
5451 | Writes the 64-bit value specified by Value to the MSR specified by Index. The\r | |
5452 | 64-bit value written to the MSR is returned. No parameter checking is\r | |
5453 | performed on Index or Value, and some of these may cause CPU exceptions. The\r | |
5454 | caller must either guarantee that Index and Value are valid, or the caller\r | |
5455 | must establish proper exception handlers. This function is only available on\r | |
030cd1a2 | 5456 | IA-32 and x64.\r |
ac644614 | 5457 | \r |
5458 | @param Index The 32-bit MSR index to write.\r | |
5459 | @param Value The 64-bit value to write to the MSR.\r | |
5460 | \r | |
5461 | @return Value\r | |
5462 | \r | |
5463 | **/\r | |
5464 | UINT64\r | |
5465 | EFIAPI\r | |
5466 | AsmWriteMsr64 (\r | |
5467 | IN UINT32 Index,\r | |
5468 | IN UINT64 Value\r | |
5469 | );\r | |
5470 | \r | |
5471 | \r | |
5472 | /**\r | |
62991af2 | 5473 | Reads a 64-bit MSR, performs a bitwise OR, and writes the result\r |
ac644614 | 5474 | back to the 64-bit MSR.\r |
5475 | \r | |
62991af2 | 5476 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 5477 | between the read result and the value specified by OrData, and writes the\r |
5478 | result to the 64-bit MSR specified by Index. The value written to the MSR is\r | |
5479 | returned. No parameter checking is performed on Index or OrData, and some of\r | |
5480 | these may cause CPU exceptions. The caller must either guarantee that Index\r | |
5481 | and OrData are valid, or the caller must establish proper exception handlers.\r | |
030cd1a2 | 5482 | This function is only available on IA-32 and x64.\r |
ac644614 | 5483 | \r |
5484 | @param Index The 32-bit MSR index to write.\r | |
5485 | @param OrData The value to OR with the read value from the MSR.\r | |
5486 | \r | |
5487 | @return The value written back to the MSR.\r | |
5488 | \r | |
5489 | **/\r | |
5490 | UINT64\r | |
5491 | EFIAPI\r | |
5492 | AsmMsrOr64 (\r | |
5493 | IN UINT32 Index,\r | |
5494 | IN UINT64 OrData\r | |
5495 | );\r | |
5496 | \r | |
5497 | \r | |
5498 | /**\r | |
5499 | Reads a 64-bit MSR, performs a bitwise AND, and writes the result back to the\r | |
5500 | 64-bit MSR.\r | |
5501 | \r | |
5502 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
5503 | read result and the value specified by OrData, and writes the result to the\r | |
5504 | 64-bit MSR specified by Index. The value written to the MSR is returned. No\r | |
5505 | parameter checking is performed on Index or OrData, and some of these may\r | |
5506 | cause CPU exceptions. The caller must either guarantee that Index and OrData\r | |
5507 | are valid, or the caller must establish proper exception handlers. This\r | |
030cd1a2 | 5508 | function is only available on IA-32 and x64.\r |
ac644614 | 5509 | \r |
5510 | @param Index The 32-bit MSR index to write.\r | |
5511 | @param AndData The value to AND with the read value from the MSR.\r | |
5512 | \r | |
5513 | @return The value written back to the MSR.\r | |
5514 | \r | |
5515 | **/\r | |
5516 | UINT64\r | |
5517 | EFIAPI\r | |
5518 | AsmMsrAnd64 (\r | |
5519 | IN UINT32 Index,\r | |
5520 | IN UINT64 AndData\r | |
5521 | );\r | |
5522 | \r | |
5523 | \r | |
5524 | /**\r | |
62991af2 | 5525 | Reads a 64-bit MSR, performs a bitwise AND followed by a bitwise \r |
ac644614 | 5526 | OR, and writes the result back to the 64-bit MSR.\r |
5527 | \r | |
5528 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between read\r | |
62991af2 | 5529 | result and the value specified by AndData, performs a bitwise OR\r |
ac644614 | 5530 | between the result of the AND operation and the value specified by OrData,\r |
5531 | and writes the result to the 64-bit MSR specified by Index. The value written\r | |
5532 | to the MSR is returned. No parameter checking is performed on Index, AndData,\r | |
5533 | or OrData, and some of these may cause CPU exceptions. The caller must either\r | |
5534 | guarantee that Index, AndData, and OrData are valid, or the caller must\r | |
5535 | establish proper exception handlers. This function is only available on IA-32\r | |
030cd1a2 | 5536 | and x64.\r |
ac644614 | 5537 | \r |
5538 | @param Index The 32-bit MSR index to write.\r | |
5539 | @param AndData The value to AND with the read value from the MSR.\r | |
5540 | @param OrData The value to OR with the result of the AND operation.\r | |
5541 | \r | |
5542 | @return The value written back to the MSR.\r | |
5543 | \r | |
5544 | **/\r | |
5545 | UINT64\r | |
5546 | EFIAPI\r | |
5547 | AsmMsrAndThenOr64 (\r | |
5548 | IN UINT32 Index,\r | |
5549 | IN UINT64 AndData,\r | |
5550 | IN UINT64 OrData\r | |
5551 | );\r | |
5552 | \r | |
5553 | \r | |
5554 | /**\r | |
5555 | Reads a bit field of an MSR.\r | |
5556 | \r | |
5557 | Reads the bit field in the 64-bit MSR. The bit field is specified by the\r | |
5558 | StartBit and the EndBit. The value of the bit field is returned. The caller\r | |
5559 | must either guarantee that Index is valid, or the caller must set up\r | |
5560 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 5561 | on IA-32 and x64.\r |
ac644614 | 5562 | \r |
5563 | If StartBit is greater than 63, then ASSERT().\r | |
5564 | If EndBit is greater than 63, then ASSERT().\r | |
5565 | If EndBit is less than StartBit, then ASSERT().\r | |
5566 | \r | |
5567 | @param Index The 32-bit MSR index to read.\r | |
5568 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5569 | Range 0..63.\r | |
5570 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5571 | Range 0..63.\r | |
5572 | \r | |
5573 | @return The value read from the MSR.\r | |
5574 | \r | |
5575 | **/\r | |
5576 | UINT64\r | |
5577 | EFIAPI\r | |
5578 | AsmMsrBitFieldRead64 (\r | |
5579 | IN UINT32 Index,\r | |
5580 | IN UINTN StartBit,\r | |
5581 | IN UINTN EndBit\r | |
5582 | );\r | |
5583 | \r | |
5584 | \r | |
5585 | /**\r | |
5586 | Writes a bit field to an MSR.\r | |
5587 | \r | |
5588 | Writes Value to a bit field in a 64-bit MSR. The bit field is specified by\r | |
5589 | the StartBit and the EndBit. All other bits in the destination MSR are\r | |
62991af2 | 5590 | preserved. The MSR written is returned. The caller must either guarantee \r |
5591 | that Index and the data written is valid, or the caller must set up exception \r | |
5592 | handlers to catch the exceptions. This function is only available on IA-32 and x64.\r | |
ac644614 | 5593 | \r |
5594 | If StartBit is greater than 63, then ASSERT().\r | |
5595 | If EndBit is greater than 63, then ASSERT().\r | |
5596 | If EndBit is less than StartBit, then ASSERT().\r | |
5597 | \r | |
5598 | @param Index The 32-bit MSR index to write.\r | |
5599 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5600 | Range 0..63.\r | |
5601 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5602 | Range 0..63.\r | |
5603 | @param Value New value of the bit field.\r | |
5604 | \r | |
5605 | @return The value written back to the MSR.\r | |
5606 | \r | |
5607 | **/\r | |
5608 | UINT64\r | |
5609 | EFIAPI\r | |
5610 | AsmMsrBitFieldWrite64 (\r | |
5611 | IN UINT32 Index,\r | |
5612 | IN UINTN StartBit,\r | |
5613 | IN UINTN EndBit,\r | |
5614 | IN UINT64 Value\r | |
5615 | );\r | |
5616 | \r | |
5617 | \r | |
5618 | /**\r | |
62991af2 | 5619 | Reads a bit field in a 64-bit MSR, performs a bitwise OR, and\r |
ac644614 | 5620 | writes the result back to the bit field in the 64-bit MSR.\r |
5621 | \r | |
62991af2 | 5622 | Reads the 64-bit MSR specified by Index, performs a bitwise OR\r |
ac644614 | 5623 | between the read result and the value specified by OrData, and writes the\r |
5624 | result to the 64-bit MSR specified by Index. The value written to the MSR is\r | |
5625 | returned. Extra left bits in OrData are stripped. The caller must either\r | |
5626 | guarantee that Index and the data written is valid, or the caller must set up\r | |
5627 | exception handlers to catch the exceptions. This function is only available\r | |
030cd1a2 | 5628 | on IA-32 and x64.\r |
ac644614 | 5629 | \r |
5630 | If StartBit is greater than 63, then ASSERT().\r | |
5631 | If EndBit is greater than 63, then ASSERT().\r | |
5632 | If EndBit is less than StartBit, then ASSERT().\r | |
5633 | \r | |
5634 | @param Index The 32-bit MSR index to write.\r | |
5635 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5636 | Range 0..63.\r | |
5637 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5638 | Range 0..63.\r | |
5639 | @param OrData The value to OR with the read value from the bit field.\r | |
5640 | \r | |
5641 | @return The value written back to the MSR.\r | |
5642 | \r | |
5643 | **/\r | |
5644 | UINT64\r | |
5645 | EFIAPI\r | |
5646 | AsmMsrBitFieldOr64 (\r | |
5647 | IN UINT32 Index,\r | |
5648 | IN UINTN StartBit,\r | |
5649 | IN UINTN EndBit,\r | |
5650 | IN UINT64 OrData\r | |
5651 | );\r | |
5652 | \r | |
5653 | \r | |
5654 | /**\r | |
5655 | Reads a bit field in a 64-bit MSR, performs a bitwise AND, and writes the\r | |
5656 | result back to the bit field in the 64-bit MSR.\r | |
5657 | \r | |
5658 | Reads the 64-bit MSR specified by Index, performs a bitwise AND between the\r | |
5659 | read result and the value specified by AndData, and writes the result to the\r | |
5660 | 64-bit MSR specified by Index. The value written to the MSR is returned.\r | |
5661 | Extra left bits in AndData are stripped. The caller must either guarantee\r | |
5662 | that Index and the data written is valid, or the caller must set up exception\r | |
5663 | handlers to catch the exceptions. This function is only available on IA-32\r | |
030cd1a2 | 5664 | and x64.\r |
ac644614 | 5665 | \r |
5666 | If StartBit is greater than 63, then ASSERT().\r | |
5667 | If EndBit is greater than 63, then ASSERT().\r | |
5668 | If EndBit is less than StartBit, then ASSERT().\r | |
5669 | \r | |
5670 | @param Index The 32-bit MSR index to write.\r | |
5671 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5672 | Range 0..63.\r | |
5673 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5674 | Range 0..63.\r | |
5675 | @param AndData The value to AND with the read value from the bit field.\r | |
5676 | \r | |
5677 | @return The value written back to the MSR.\r | |
5678 | \r | |
5679 | **/\r | |
5680 | UINT64\r | |
5681 | EFIAPI\r | |
5682 | AsmMsrBitFieldAnd64 (\r | |
5683 | IN UINT32 Index,\r | |
5684 | IN UINTN StartBit,\r | |
5685 | IN UINTN EndBit,\r | |
5686 | IN UINT64 AndData\r | |
5687 | );\r | |
5688 | \r | |
5689 | \r | |
5690 | /**\r | |
5691 | Reads a bit field in a 64-bit MSR, performs a bitwise AND followed by a\r | |
62991af2 | 5692 | bitwise OR, and writes the result back to the bit field in the\r |
ac644614 | 5693 | 64-bit MSR.\r |
5694 | \r | |
5695 | Reads the 64-bit MSR specified by Index, performs a bitwise AND followed by\r | |
62991af2 | 5696 | a bitwise OR between the read result and the value specified by\r |
ac644614 | 5697 | AndData, and writes the result to the 64-bit MSR specified by Index. The\r |
5698 | value written to the MSR is returned. Extra left bits in both AndData and\r | |
5699 | OrData are stripped. The caller must either guarantee that Index and the data\r | |
5700 | written is valid, or the caller must set up exception handlers to catch the\r | |
030cd1a2 | 5701 | exceptions. This function is only available on IA-32 and x64.\r |
ac644614 | 5702 | \r |
5703 | If StartBit is greater than 63, then ASSERT().\r | |
5704 | If EndBit is greater than 63, then ASSERT().\r | |
5705 | If EndBit is less than StartBit, then ASSERT().\r | |
5706 | \r | |
5707 | @param Index The 32-bit MSR index to write.\r | |
5708 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
5709 | Range 0..63.\r | |
5710 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
5711 | Range 0..63.\r | |
5712 | @param AndData The value to AND with the read value from the bit field.\r | |
5713 | @param OrData The value to OR with the result of the AND operation.\r | |
5714 | \r | |
5715 | @return The value written back to the MSR.\r | |
5716 | \r | |
5717 | **/\r | |
5718 | UINT64\r | |
5719 | EFIAPI\r | |
5720 | AsmMsrBitFieldAndThenOr64 (\r | |
5721 | IN UINT32 Index,\r | |
5722 | IN UINTN StartBit,\r | |
5723 | IN UINTN EndBit,\r | |
5724 | IN UINT64 AndData,\r | |
5725 | IN UINT64 OrData\r | |
5726 | );\r | |
5727 | \r | |
5728 | \r | |
5729 | /**\r | |
5730 | Reads the current value of the EFLAGS register.\r | |
5731 | \r | |
5732 | Reads and returns the current value of the EFLAGS register. This function is\r | |
030cd1a2 | 5733 | only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a\r |
5734 | 64-bit value on x64.\r | |
ac644614 | 5735 | \r |
030cd1a2 | 5736 | @return EFLAGS on IA-32 or RFLAGS on x64.\r |
ac644614 | 5737 | \r |
5738 | **/\r | |
5739 | UINTN\r | |
5740 | EFIAPI\r | |
5741 | AsmReadEflags (\r | |
5742 | VOID\r | |
5743 | );\r | |
5744 | \r | |
5745 | \r | |
5746 | /**\r | |
5747 | Reads the current value of the Control Register 0 (CR0).\r | |
5748 | \r | |
5749 | Reads and returns the current value of CR0. This function is only available\r | |
030cd1a2 | 5750 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5751 | x64.\r | |
ac644614 | 5752 | \r |
5753 | @return The value of the Control Register 0 (CR0).\r | |
5754 | \r | |
5755 | **/\r | |
5756 | UINTN\r | |
5757 | EFIAPI\r | |
5758 | AsmReadCr0 (\r | |
5759 | VOID\r | |
5760 | );\r | |
5761 | \r | |
5762 | \r | |
5763 | /**\r | |
5764 | Reads the current value of the Control Register 2 (CR2).\r | |
5765 | \r | |
5766 | Reads and returns the current value of CR2. This function is only available\r | |
030cd1a2 | 5767 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5768 | x64.\r | |
ac644614 | 5769 | \r |
5770 | @return The value of the Control Register 2 (CR2).\r | |
5771 | \r | |
5772 | **/\r | |
5773 | UINTN\r | |
5774 | EFIAPI\r | |
5775 | AsmReadCr2 (\r | |
5776 | VOID\r | |
5777 | );\r | |
5778 | \r | |
5779 | \r | |
5780 | /**\r | |
5781 | Reads the current value of the Control Register 3 (CR3).\r | |
5782 | \r | |
5783 | Reads and returns the current value of CR3. This function is only available\r | |
030cd1a2 | 5784 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5785 | x64.\r | |
ac644614 | 5786 | \r |
5787 | @return The value of the Control Register 3 (CR3).\r | |
5788 | \r | |
5789 | **/\r | |
5790 | UINTN\r | |
5791 | EFIAPI\r | |
5792 | AsmReadCr3 (\r | |
5793 | VOID\r | |
5794 | );\r | |
5795 | \r | |
5796 | \r | |
5797 | /**\r | |
5798 | Reads the current value of the Control Register 4 (CR4).\r | |
5799 | \r | |
5800 | Reads and returns the current value of CR4. This function is only available\r | |
030cd1a2 | 5801 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5802 | x64.\r | |
ac644614 | 5803 | \r |
5804 | @return The value of the Control Register 4 (CR4).\r | |
5805 | \r | |
5806 | **/\r | |
5807 | UINTN\r | |
5808 | EFIAPI\r | |
5809 | AsmReadCr4 (\r | |
5810 | VOID\r | |
5811 | );\r | |
5812 | \r | |
5813 | \r | |
5814 | /**\r | |
5815 | Writes a value to Control Register 0 (CR0).\r | |
5816 | \r | |
5817 | Writes and returns a new value to CR0. This function is only available on\r | |
030cd1a2 | 5818 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 5819 | \r |
5820 | @param Cr0 The value to write to CR0.\r | |
5821 | \r | |
5822 | @return The value written to CR0.\r | |
5823 | \r | |
5824 | **/\r | |
5825 | UINTN\r | |
5826 | EFIAPI\r | |
5827 | AsmWriteCr0 (\r | |
5828 | UINTN Cr0\r | |
5829 | );\r | |
5830 | \r | |
5831 | \r | |
5832 | /**\r | |
5833 | Writes a value to Control Register 2 (CR2).\r | |
5834 | \r | |
5835 | Writes and returns a new value to CR2. This function is only available on\r | |
030cd1a2 | 5836 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 5837 | \r |
5838 | @param Cr2 The value to write to CR2.\r | |
5839 | \r | |
5840 | @return The value written to CR2.\r | |
5841 | \r | |
5842 | **/\r | |
5843 | UINTN\r | |
5844 | EFIAPI\r | |
5845 | AsmWriteCr2 (\r | |
5846 | UINTN Cr2\r | |
5847 | );\r | |
5848 | \r | |
5849 | \r | |
5850 | /**\r | |
5851 | Writes a value to Control Register 3 (CR3).\r | |
5852 | \r | |
5853 | Writes and returns a new value to CR3. This function is only available on\r | |
030cd1a2 | 5854 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 5855 | \r |
5856 | @param Cr3 The value to write to CR3.\r | |
5857 | \r | |
5858 | @return The value written to CR3.\r | |
5859 | \r | |
5860 | **/\r | |
5861 | UINTN\r | |
5862 | EFIAPI\r | |
5863 | AsmWriteCr3 (\r | |
5864 | UINTN Cr3\r | |
5865 | );\r | |
5866 | \r | |
5867 | \r | |
5868 | /**\r | |
5869 | Writes a value to Control Register 4 (CR4).\r | |
5870 | \r | |
5871 | Writes and returns a new value to CR4. This function is only available on\r | |
030cd1a2 | 5872 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 5873 | \r |
5874 | @param Cr4 The value to write to CR4.\r | |
5875 | \r | |
5876 | @return The value written to CR4.\r | |
5877 | \r | |
5878 | **/\r | |
5879 | UINTN\r | |
5880 | EFIAPI\r | |
5881 | AsmWriteCr4 (\r | |
5882 | UINTN Cr4\r | |
5883 | );\r | |
5884 | \r | |
5885 | \r | |
5886 | /**\r | |
5887 | Reads the current value of Debug Register 0 (DR0).\r | |
5888 | \r | |
5889 | Reads and returns the current value of DR0. This function is only available\r | |
030cd1a2 | 5890 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5891 | x64.\r | |
ac644614 | 5892 | \r |
5893 | @return The value of Debug Register 0 (DR0).\r | |
5894 | \r | |
5895 | **/\r | |
5896 | UINTN\r | |
5897 | EFIAPI\r | |
5898 | AsmReadDr0 (\r | |
5899 | VOID\r | |
5900 | );\r | |
5901 | \r | |
5902 | \r | |
5903 | /**\r | |
5904 | Reads the current value of Debug Register 1 (DR1).\r | |
5905 | \r | |
5906 | Reads and returns the current value of DR1. This function is only available\r | |
030cd1a2 | 5907 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5908 | x64.\r | |
ac644614 | 5909 | \r |
5910 | @return The value of Debug Register 1 (DR1).\r | |
5911 | \r | |
5912 | **/\r | |
5913 | UINTN\r | |
5914 | EFIAPI\r | |
5915 | AsmReadDr1 (\r | |
5916 | VOID\r | |
5917 | );\r | |
5918 | \r | |
5919 | \r | |
5920 | /**\r | |
5921 | Reads the current value of Debug Register 2 (DR2).\r | |
5922 | \r | |
5923 | Reads and returns the current value of DR2. This function is only available\r | |
030cd1a2 | 5924 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5925 | x64.\r | |
ac644614 | 5926 | \r |
5927 | @return The value of Debug Register 2 (DR2).\r | |
5928 | \r | |
5929 | **/\r | |
5930 | UINTN\r | |
5931 | EFIAPI\r | |
5932 | AsmReadDr2 (\r | |
5933 | VOID\r | |
5934 | );\r | |
5935 | \r | |
5936 | \r | |
5937 | /**\r | |
5938 | Reads the current value of Debug Register 3 (DR3).\r | |
5939 | \r | |
5940 | Reads and returns the current value of DR3. This function is only available\r | |
030cd1a2 | 5941 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5942 | x64.\r | |
ac644614 | 5943 | \r |
5944 | @return The value of Debug Register 3 (DR3).\r | |
5945 | \r | |
5946 | **/\r | |
5947 | UINTN\r | |
5948 | EFIAPI\r | |
5949 | AsmReadDr3 (\r | |
5950 | VOID\r | |
5951 | );\r | |
5952 | \r | |
5953 | \r | |
5954 | /**\r | |
5955 | Reads the current value of Debug Register 4 (DR4).\r | |
5956 | \r | |
5957 | Reads and returns the current value of DR4. This function is only available\r | |
030cd1a2 | 5958 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5959 | x64.\r | |
ac644614 | 5960 | \r |
5961 | @return The value of Debug Register 4 (DR4).\r | |
5962 | \r | |
5963 | **/\r | |
5964 | UINTN\r | |
5965 | EFIAPI\r | |
5966 | AsmReadDr4 (\r | |
5967 | VOID\r | |
5968 | );\r | |
5969 | \r | |
5970 | \r | |
5971 | /**\r | |
5972 | Reads the current value of Debug Register 5 (DR5).\r | |
5973 | \r | |
5974 | Reads and returns the current value of DR5. This function is only available\r | |
030cd1a2 | 5975 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5976 | x64.\r | |
ac644614 | 5977 | \r |
5978 | @return The value of Debug Register 5 (DR5).\r | |
5979 | \r | |
5980 | **/\r | |
5981 | UINTN\r | |
5982 | EFIAPI\r | |
5983 | AsmReadDr5 (\r | |
5984 | VOID\r | |
5985 | );\r | |
5986 | \r | |
5987 | \r | |
5988 | /**\r | |
5989 | Reads the current value of Debug Register 6 (DR6).\r | |
5990 | \r | |
5991 | Reads and returns the current value of DR6. This function is only available\r | |
030cd1a2 | 5992 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
5993 | x64.\r | |
ac644614 | 5994 | \r |
5995 | @return The value of Debug Register 6 (DR6).\r | |
5996 | \r | |
5997 | **/\r | |
5998 | UINTN\r | |
5999 | EFIAPI\r | |
6000 | AsmReadDr6 (\r | |
6001 | VOID\r | |
6002 | );\r | |
6003 | \r | |
6004 | \r | |
6005 | /**\r | |
6006 | Reads the current value of Debug Register 7 (DR7).\r | |
6007 | \r | |
6008 | Reads and returns the current value of DR7. This function is only available\r | |
030cd1a2 | 6009 | on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on\r |
6010 | x64.\r | |
ac644614 | 6011 | \r |
6012 | @return The value of Debug Register 7 (DR7).\r | |
6013 | \r | |
6014 | **/\r | |
6015 | UINTN\r | |
6016 | EFIAPI\r | |
6017 | AsmReadDr7 (\r | |
6018 | VOID\r | |
6019 | );\r | |
6020 | \r | |
6021 | \r | |
6022 | /**\r | |
6023 | Writes a value to Debug Register 0 (DR0).\r | |
6024 | \r | |
6025 | Writes and returns a new value to DR0. This function is only available on\r | |
030cd1a2 | 6026 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6027 | \r |
6028 | @param Dr0 The value to write to Dr0.\r | |
6029 | \r | |
6030 | @return The value written to Debug Register 0 (DR0).\r | |
6031 | \r | |
6032 | **/\r | |
6033 | UINTN\r | |
6034 | EFIAPI\r | |
6035 | AsmWriteDr0 (\r | |
6036 | UINTN Dr0\r | |
6037 | );\r | |
6038 | \r | |
6039 | \r | |
6040 | /**\r | |
6041 | Writes a value to Debug Register 1 (DR1).\r | |
6042 | \r | |
6043 | Writes and returns a new value to DR1. This function is only available on\r | |
030cd1a2 | 6044 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6045 | \r |
6046 | @param Dr1 The value to write to Dr1.\r | |
6047 | \r | |
6048 | @return The value written to Debug Register 1 (DR1).\r | |
6049 | \r | |
6050 | **/\r | |
6051 | UINTN\r | |
6052 | EFIAPI\r | |
6053 | AsmWriteDr1 (\r | |
6054 | UINTN Dr1\r | |
6055 | );\r | |
6056 | \r | |
6057 | \r | |
6058 | /**\r | |
6059 | Writes a value to Debug Register 2 (DR2).\r | |
6060 | \r | |
6061 | Writes and returns a new value to DR2. This function is only available on\r | |
030cd1a2 | 6062 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6063 | \r |
6064 | @param Dr2 The value to write to Dr2.\r | |
6065 | \r | |
6066 | @return The value written to Debug Register 2 (DR2).\r | |
6067 | \r | |
6068 | **/\r | |
6069 | UINTN\r | |
6070 | EFIAPI\r | |
6071 | AsmWriteDr2 (\r | |
6072 | UINTN Dr2\r | |
6073 | );\r | |
6074 | \r | |
6075 | \r | |
6076 | /**\r | |
6077 | Writes a value to Debug Register 3 (DR3).\r | |
6078 | \r | |
6079 | Writes and returns a new value to DR3. This function is only available on\r | |
030cd1a2 | 6080 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6081 | \r |
6082 | @param Dr3 The value to write to Dr3.\r | |
6083 | \r | |
6084 | @return The value written to Debug Register 3 (DR3).\r | |
6085 | \r | |
6086 | **/\r | |
6087 | UINTN\r | |
6088 | EFIAPI\r | |
6089 | AsmWriteDr3 (\r | |
6090 | UINTN Dr3\r | |
6091 | );\r | |
6092 | \r | |
6093 | \r | |
6094 | /**\r | |
6095 | Writes a value to Debug Register 4 (DR4).\r | |
6096 | \r | |
6097 | Writes and returns a new value to DR4. This function is only available on\r | |
030cd1a2 | 6098 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6099 | \r |
6100 | @param Dr4 The value to write to Dr4.\r | |
6101 | \r | |
6102 | @return The value written to Debug Register 4 (DR4).\r | |
6103 | \r | |
6104 | **/\r | |
6105 | UINTN\r | |
6106 | EFIAPI\r | |
6107 | AsmWriteDr4 (\r | |
6108 | UINTN Dr4\r | |
6109 | );\r | |
6110 | \r | |
6111 | \r | |
6112 | /**\r | |
6113 | Writes a value to Debug Register 5 (DR5).\r | |
6114 | \r | |
6115 | Writes and returns a new value to DR5. This function is only available on\r | |
030cd1a2 | 6116 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6117 | \r |
6118 | @param Dr5 The value to write to Dr5.\r | |
6119 | \r | |
6120 | @return The value written to Debug Register 5 (DR5).\r | |
6121 | \r | |
6122 | **/\r | |
6123 | UINTN\r | |
6124 | EFIAPI\r | |
6125 | AsmWriteDr5 (\r | |
6126 | UINTN Dr5\r | |
6127 | );\r | |
6128 | \r | |
6129 | \r | |
6130 | /**\r | |
6131 | Writes a value to Debug Register 6 (DR6).\r | |
6132 | \r | |
6133 | Writes and returns a new value to DR6. This function is only available on\r | |
030cd1a2 | 6134 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6135 | \r |
6136 | @param Dr6 The value to write to Dr6.\r | |
6137 | \r | |
6138 | @return The value written to Debug Register 6 (DR6).\r | |
6139 | \r | |
6140 | **/\r | |
6141 | UINTN\r | |
6142 | EFIAPI\r | |
6143 | AsmWriteDr6 (\r | |
6144 | UINTN Dr6\r | |
6145 | );\r | |
6146 | \r | |
6147 | \r | |
6148 | /**\r | |
6149 | Writes a value to Debug Register 7 (DR7).\r | |
6150 | \r | |
6151 | Writes and returns a new value to DR7. This function is only available on\r | |
030cd1a2 | 6152 | IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64.\r |
ac644614 | 6153 | \r |
6154 | @param Dr7 The value to write to Dr7.\r | |
6155 | \r | |
6156 | @return The value written to Debug Register 7 (DR7).\r | |
6157 | \r | |
6158 | **/\r | |
6159 | UINTN\r | |
6160 | EFIAPI\r | |
6161 | AsmWriteDr7 (\r | |
6162 | UINTN Dr7\r | |
6163 | );\r | |
6164 | \r | |
6165 | \r | |
6166 | /**\r | |
6167 | Reads the current value of Code Segment Register (CS).\r | |
6168 | \r | |
6169 | Reads and returns the current value of CS. This function is only available on\r | |
030cd1a2 | 6170 | IA-32 and x64.\r |
ac644614 | 6171 | \r |
6172 | @return The current value of CS.\r | |
6173 | \r | |
6174 | **/\r | |
6175 | UINT16\r | |
6176 | EFIAPI\r | |
6177 | AsmReadCs (\r | |
6178 | VOID\r | |
6179 | );\r | |
6180 | \r | |
6181 | \r | |
6182 | /**\r | |
6183 | Reads the current value of Data Segment Register (DS).\r | |
6184 | \r | |
6185 | Reads and returns the current value of DS. This function is only available on\r | |
030cd1a2 | 6186 | IA-32 and x64.\r |
ac644614 | 6187 | \r |
6188 | @return The current value of DS.\r | |
6189 | \r | |
6190 | **/\r | |
6191 | UINT16\r | |
6192 | EFIAPI\r | |
6193 | AsmReadDs (\r | |
6194 | VOID\r | |
6195 | );\r | |
6196 | \r | |
6197 | \r | |
6198 | /**\r | |
6199 | Reads the current value of Extra Segment Register (ES).\r | |
6200 | \r | |
6201 | Reads and returns the current value of ES. This function is only available on\r | |
030cd1a2 | 6202 | IA-32 and x64.\r |
ac644614 | 6203 | \r |
6204 | @return The current value of ES.\r | |
6205 | \r | |
6206 | **/\r | |
6207 | UINT16\r | |
6208 | EFIAPI\r | |
6209 | AsmReadEs (\r | |
6210 | VOID\r | |
6211 | );\r | |
6212 | \r | |
6213 | \r | |
6214 | /**\r | |
6215 | Reads the current value of FS Data Segment Register (FS).\r | |
6216 | \r | |
6217 | Reads and returns the current value of FS. This function is only available on\r | |
030cd1a2 | 6218 | IA-32 and x64.\r |
ac644614 | 6219 | \r |
6220 | @return The current value of FS.\r | |
6221 | \r | |
6222 | **/\r | |
6223 | UINT16\r | |
6224 | EFIAPI\r | |
6225 | AsmReadFs (\r | |
6226 | VOID\r | |
6227 | );\r | |
6228 | \r | |
6229 | \r | |
6230 | /**\r | |
6231 | Reads the current value of GS Data Segment Register (GS).\r | |
6232 | \r | |
6233 | Reads and returns the current value of GS. This function is only available on\r | |
030cd1a2 | 6234 | IA-32 and x64.\r |
ac644614 | 6235 | \r |
6236 | @return The current value of GS.\r | |
6237 | \r | |
6238 | **/\r | |
6239 | UINT16\r | |
6240 | EFIAPI\r | |
6241 | AsmReadGs (\r | |
6242 | VOID\r | |
6243 | );\r | |
6244 | \r | |
6245 | \r | |
6246 | /**\r | |
6247 | Reads the current value of Stack Segment Register (SS).\r | |
6248 | \r | |
6249 | Reads and returns the current value of SS. This function is only available on\r | |
030cd1a2 | 6250 | IA-32 and x64.\r |
ac644614 | 6251 | \r |
6252 | @return The current value of SS.\r | |
6253 | \r | |
6254 | **/\r | |
6255 | UINT16\r | |
6256 | EFIAPI\r | |
6257 | AsmReadSs (\r | |
6258 | VOID\r | |
6259 | );\r | |
6260 | \r | |
6261 | \r | |
6262 | /**\r | |
6263 | Reads the current value of Task Register (TR).\r | |
6264 | \r | |
6265 | Reads and returns the current value of TR. This function is only available on\r | |
030cd1a2 | 6266 | IA-32 and x64.\r |
ac644614 | 6267 | \r |
6268 | @return The current value of TR.\r | |
6269 | \r | |
6270 | **/\r | |
6271 | UINT16\r | |
6272 | EFIAPI\r | |
6273 | AsmReadTr (\r | |
6274 | VOID\r | |
6275 | );\r | |
6276 | \r | |
6277 | \r | |
6278 | /**\r | |
6279 | Reads the current Global Descriptor Table Register(GDTR) descriptor.\r | |
6280 | \r | |
6281 | Reads and returns the current GDTR descriptor and returns it in Gdtr. This\r | |
030cd1a2 | 6282 | function is only available on IA-32 and x64.\r |
ac644614 | 6283 | \r |
6284 | If Gdtr is NULL, then ASSERT().\r | |
6285 | \r | |
6286 | @param Gdtr Pointer to a GDTR descriptor.\r | |
6287 | \r | |
6288 | **/\r | |
6289 | VOID\r | |
6290 | EFIAPI\r | |
6291 | AsmReadGdtr (\r | |
6292 | OUT IA32_DESCRIPTOR *Gdtr\r | |
6293 | );\r | |
6294 | \r | |
6295 | \r | |
6296 | /**\r | |
6297 | Writes the current Global Descriptor Table Register (GDTR) descriptor.\r | |
6298 | \r | |
6299 | Writes and the current GDTR descriptor specified by Gdtr. This function is\r | |
030cd1a2 | 6300 | only available on IA-32 and x64.\r |
ac644614 | 6301 | \r |
6302 | If Gdtr is NULL, then ASSERT().\r | |
6303 | \r | |
6304 | @param Gdtr Pointer to a GDTR descriptor.\r | |
6305 | \r | |
6306 | **/\r | |
6307 | VOID\r | |
6308 | EFIAPI\r | |
6309 | AsmWriteGdtr (\r | |
6310 | IN CONST IA32_DESCRIPTOR *Gdtr\r | |
6311 | );\r | |
6312 | \r | |
6313 | \r | |
6314 | /**\r | |
17f695ed | 6315 | Reads the current Interrupt Descriptor Table Register(IDTR) descriptor.\r |
ac644614 | 6316 | \r |
6317 | Reads and returns the current IDTR descriptor and returns it in Idtr. This\r | |
030cd1a2 | 6318 | function is only available on IA-32 and x64.\r |
ac644614 | 6319 | \r |
6320 | If Idtr is NULL, then ASSERT().\r | |
6321 | \r | |
6322 | @param Idtr Pointer to a IDTR descriptor.\r | |
6323 | \r | |
6324 | **/\r | |
6325 | VOID\r | |
6326 | EFIAPI\r | |
6327 | AsmReadIdtr (\r | |
6328 | OUT IA32_DESCRIPTOR *Idtr\r | |
6329 | );\r | |
6330 | \r | |
6331 | \r | |
6332 | /**\r | |
17f695ed | 6333 | Writes the current Interrupt Descriptor Table Register(IDTR) descriptor.\r |
ac644614 | 6334 | \r |
6335 | Writes the current IDTR descriptor and returns it in Idtr. This function is\r | |
030cd1a2 | 6336 | only available on IA-32 and x64.\r |
ac644614 | 6337 | \r |
6338 | If Idtr is NULL, then ASSERT().\r | |
6339 | \r | |
6340 | @param Idtr Pointer to a IDTR descriptor.\r | |
6341 | \r | |
6342 | **/\r | |
6343 | VOID\r | |
6344 | EFIAPI\r | |
6345 | AsmWriteIdtr (\r | |
6346 | IN CONST IA32_DESCRIPTOR *Idtr\r | |
6347 | );\r | |
6348 | \r | |
6349 | \r | |
6350 | /**\r | |
6351 | Reads the current Local Descriptor Table Register(LDTR) selector.\r | |
6352 | \r | |
6353 | Reads and returns the current 16-bit LDTR descriptor value. This function is\r | |
030cd1a2 | 6354 | only available on IA-32 and x64.\r |
ac644614 | 6355 | \r |
6356 | @return The current selector of LDT.\r | |
6357 | \r | |
6358 | **/\r | |
6359 | UINT16\r | |
6360 | EFIAPI\r | |
6361 | AsmReadLdtr (\r | |
6362 | VOID\r | |
6363 | );\r | |
6364 | \r | |
6365 | \r | |
6366 | /**\r | |
17f695ed | 6367 | Writes the current Local Descriptor Table Register (LDTR) selector.\r |
ac644614 | 6368 | \r |
6369 | Writes and the current LDTR descriptor specified by Ldtr. This function is\r | |
030cd1a2 | 6370 | only available on IA-32 and x64.\r |
ac644614 | 6371 | \r |
6372 | @param Ldtr 16-bit LDTR selector value.\r | |
6373 | \r | |
6374 | **/\r | |
6375 | VOID\r | |
6376 | EFIAPI\r | |
6377 | AsmWriteLdtr (\r | |
6378 | IN UINT16 Ldtr\r | |
6379 | );\r | |
6380 | \r | |
6381 | \r | |
6382 | /**\r | |
6383 | Save the current floating point/SSE/SSE2 context to a buffer.\r | |
6384 | \r | |
6385 | Saves the current floating point/SSE/SSE2 state to the buffer specified by\r | |
6386 | Buffer. Buffer must be aligned on a 16-byte boundary. This function is only\r | |
030cd1a2 | 6387 | available on IA-32 and x64.\r |
ac644614 | 6388 | \r |
6389 | If Buffer is NULL, then ASSERT().\r | |
6390 | If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
6391 | \r | |
6392 | @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.\r | |
6393 | \r | |
6394 | **/\r | |
6395 | VOID\r | |
6396 | EFIAPI\r | |
6397 | AsmFxSave (\r | |
6398 | OUT IA32_FX_BUFFER *Buffer\r | |
6399 | );\r | |
6400 | \r | |
6401 | \r | |
6402 | /**\r | |
6403 | Restores the current floating point/SSE/SSE2 context from a buffer.\r | |
6404 | \r | |
6405 | Restores the current floating point/SSE/SSE2 state from the buffer specified\r | |
6406 | by Buffer. Buffer must be aligned on a 16-byte boundary. This function is\r | |
030cd1a2 | 6407 | only available on IA-32 and x64.\r |
ac644614 | 6408 | \r |
6409 | If Buffer is NULL, then ASSERT().\r | |
6410 | If Buffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
6411 | If Buffer was not saved with AsmFxSave(), then ASSERT().\r | |
6412 | \r | |
6413 | @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.\r | |
6414 | \r | |
6415 | **/\r | |
6416 | VOID\r | |
6417 | EFIAPI\r | |
6418 | AsmFxRestore (\r | |
6419 | IN CONST IA32_FX_BUFFER *Buffer\r | |
6420 | );\r | |
6421 | \r | |
6422 | \r | |
6423 | /**\r | |
6424 | Reads the current value of 64-bit MMX Register #0 (MM0).\r | |
6425 | \r | |
6426 | Reads and returns the current value of MM0. This function is only available\r | |
030cd1a2 | 6427 | on IA-32 and x64.\r |
ac644614 | 6428 | \r |
6429 | @return The current value of MM0.\r | |
6430 | \r | |
6431 | **/\r | |
6432 | UINT64\r | |
6433 | EFIAPI\r | |
6434 | AsmReadMm0 (\r | |
6435 | VOID\r | |
6436 | );\r | |
6437 | \r | |
6438 | \r | |
6439 | /**\r | |
6440 | Reads the current value of 64-bit MMX Register #1 (MM1).\r | |
6441 | \r | |
6442 | Reads and returns the current value of MM1. This function is only available\r | |
030cd1a2 | 6443 | on IA-32 and x64.\r |
ac644614 | 6444 | \r |
6445 | @return The current value of MM1.\r | |
6446 | \r | |
6447 | **/\r | |
6448 | UINT64\r | |
6449 | EFIAPI\r | |
6450 | AsmReadMm1 (\r | |
6451 | VOID\r | |
6452 | );\r | |
6453 | \r | |
6454 | \r | |
6455 | /**\r | |
6456 | Reads the current value of 64-bit MMX Register #2 (MM2).\r | |
6457 | \r | |
6458 | Reads and returns the current value of MM2. This function is only available\r | |
030cd1a2 | 6459 | on IA-32 and x64.\r |
ac644614 | 6460 | \r |
6461 | @return The current value of MM2.\r | |
6462 | \r | |
6463 | **/\r | |
6464 | UINT64\r | |
6465 | EFIAPI\r | |
6466 | AsmReadMm2 (\r | |
6467 | VOID\r | |
6468 | );\r | |
6469 | \r | |
6470 | \r | |
6471 | /**\r | |
6472 | Reads the current value of 64-bit MMX Register #3 (MM3).\r | |
6473 | \r | |
6474 | Reads and returns the current value of MM3. This function is only available\r | |
030cd1a2 | 6475 | on IA-32 and x64.\r |
ac644614 | 6476 | \r |
6477 | @return The current value of MM3.\r | |
6478 | \r | |
6479 | **/\r | |
6480 | UINT64\r | |
6481 | EFIAPI\r | |
6482 | AsmReadMm3 (\r | |
6483 | VOID\r | |
6484 | );\r | |
6485 | \r | |
6486 | \r | |
6487 | /**\r | |
6488 | Reads the current value of 64-bit MMX Register #4 (MM4).\r | |
6489 | \r | |
6490 | Reads and returns the current value of MM4. This function is only available\r | |
030cd1a2 | 6491 | on IA-32 and x64.\r |
ac644614 | 6492 | \r |
6493 | @return The current value of MM4.\r | |
6494 | \r | |
6495 | **/\r | |
6496 | UINT64\r | |
6497 | EFIAPI\r | |
6498 | AsmReadMm4 (\r | |
6499 | VOID\r | |
6500 | );\r | |
6501 | \r | |
6502 | \r | |
6503 | /**\r | |
6504 | Reads the current value of 64-bit MMX Register #5 (MM5).\r | |
6505 | \r | |
6506 | Reads and returns the current value of MM5. This function is only available\r | |
030cd1a2 | 6507 | on IA-32 and x64.\r |
ac644614 | 6508 | \r |
6509 | @return The current value of MM5.\r | |
6510 | \r | |
6511 | **/\r | |
6512 | UINT64\r | |
6513 | EFIAPI\r | |
6514 | AsmReadMm5 (\r | |
6515 | VOID\r | |
6516 | );\r | |
6517 | \r | |
6518 | \r | |
6519 | /**\r | |
6520 | Reads the current value of 64-bit MMX Register #6 (MM6).\r | |
6521 | \r | |
6522 | Reads and returns the current value of MM6. This function is only available\r | |
030cd1a2 | 6523 | on IA-32 and x64.\r |
ac644614 | 6524 | \r |
6525 | @return The current value of MM6.\r | |
6526 | \r | |
6527 | **/\r | |
6528 | UINT64\r | |
6529 | EFIAPI\r | |
6530 | AsmReadMm6 (\r | |
6531 | VOID\r | |
6532 | );\r | |
6533 | \r | |
6534 | \r | |
6535 | /**\r | |
6536 | Reads the current value of 64-bit MMX Register #7 (MM7).\r | |
6537 | \r | |
6538 | Reads and returns the current value of MM7. This function is only available\r | |
030cd1a2 | 6539 | on IA-32 and x64.\r |
ac644614 | 6540 | \r |
6541 | @return The current value of MM7.\r | |
6542 | \r | |
6543 | **/\r | |
6544 | UINT64\r | |
6545 | EFIAPI\r | |
6546 | AsmReadMm7 (\r | |
6547 | VOID\r | |
6548 | );\r | |
6549 | \r | |
6550 | \r | |
6551 | /**\r | |
6552 | Writes the current value of 64-bit MMX Register #0 (MM0).\r | |
6553 | \r | |
6554 | Writes the current value of MM0. This function is only available on IA32 and\r | |
030cd1a2 | 6555 | x64.\r |
ac644614 | 6556 | \r |
6557 | @param Value The 64-bit value to write to MM0.\r | |
6558 | \r | |
6559 | **/\r | |
6560 | VOID\r | |
6561 | EFIAPI\r | |
6562 | AsmWriteMm0 (\r | |
6563 | IN UINT64 Value\r | |
6564 | );\r | |
6565 | \r | |
6566 | \r | |
6567 | /**\r | |
6568 | Writes the current value of 64-bit MMX Register #1 (MM1).\r | |
6569 | \r | |
6570 | Writes the current value of MM1. This function is only available on IA32 and\r | |
030cd1a2 | 6571 | x64.\r |
ac644614 | 6572 | \r |
6573 | @param Value The 64-bit value to write to MM1.\r | |
6574 | \r | |
6575 | **/\r | |
6576 | VOID\r | |
6577 | EFIAPI\r | |
6578 | AsmWriteMm1 (\r | |
6579 | IN UINT64 Value\r | |
6580 | );\r | |
6581 | \r | |
6582 | \r | |
6583 | /**\r | |
6584 | Writes the current value of 64-bit MMX Register #2 (MM2).\r | |
6585 | \r | |
6586 | Writes the current value of MM2. This function is only available on IA32 and\r | |
030cd1a2 | 6587 | x64.\r |
ac644614 | 6588 | \r |
6589 | @param Value The 64-bit value to write to MM2.\r | |
6590 | \r | |
6591 | **/\r | |
6592 | VOID\r | |
6593 | EFIAPI\r | |
6594 | AsmWriteMm2 (\r | |
6595 | IN UINT64 Value\r | |
6596 | );\r | |
6597 | \r | |
6598 | \r | |
6599 | /**\r | |
6600 | Writes the current value of 64-bit MMX Register #3 (MM3).\r | |
6601 | \r | |
6602 | Writes the current value of MM3. This function is only available on IA32 and\r | |
030cd1a2 | 6603 | x64.\r |
ac644614 | 6604 | \r |
6605 | @param Value The 64-bit value to write to MM3.\r | |
6606 | \r | |
6607 | **/\r | |
6608 | VOID\r | |
6609 | EFIAPI\r | |
6610 | AsmWriteMm3 (\r | |
6611 | IN UINT64 Value\r | |
6612 | );\r | |
6613 | \r | |
6614 | \r | |
6615 | /**\r | |
6616 | Writes the current value of 64-bit MMX Register #4 (MM4).\r | |
6617 | \r | |
6618 | Writes the current value of MM4. This function is only available on IA32 and\r | |
030cd1a2 | 6619 | x64.\r |
ac644614 | 6620 | \r |
6621 | @param Value The 64-bit value to write to MM4.\r | |
6622 | \r | |
6623 | **/\r | |
6624 | VOID\r | |
6625 | EFIAPI\r | |
6626 | AsmWriteMm4 (\r | |
6627 | IN UINT64 Value\r | |
6628 | );\r | |
6629 | \r | |
6630 | \r | |
6631 | /**\r | |
6632 | Writes the current value of 64-bit MMX Register #5 (MM5).\r | |
6633 | \r | |
6634 | Writes the current value of MM5. This function is only available on IA32 and\r | |
030cd1a2 | 6635 | x64.\r |
ac644614 | 6636 | \r |
6637 | @param Value The 64-bit value to write to MM5.\r | |
6638 | \r | |
6639 | **/\r | |
6640 | VOID\r | |
6641 | EFIAPI\r | |
6642 | AsmWriteMm5 (\r | |
6643 | IN UINT64 Value\r | |
6644 | );\r | |
6645 | \r | |
6646 | \r | |
6647 | /**\r | |
6648 | Writes the current value of 64-bit MMX Register #6 (MM6).\r | |
6649 | \r | |
6650 | Writes the current value of MM6. This function is only available on IA32 and\r | |
030cd1a2 | 6651 | x64.\r |
ac644614 | 6652 | \r |
6653 | @param Value The 64-bit value to write to MM6.\r | |
6654 | \r | |
6655 | **/\r | |
6656 | VOID\r | |
6657 | EFIAPI\r | |
6658 | AsmWriteMm6 (\r | |
6659 | IN UINT64 Value\r | |
6660 | );\r | |
6661 | \r | |
6662 | \r | |
6663 | /**\r | |
6664 | Writes the current value of 64-bit MMX Register #7 (MM7).\r | |
6665 | \r | |
6666 | Writes the current value of MM7. This function is only available on IA32 and\r | |
030cd1a2 | 6667 | x64.\r |
ac644614 | 6668 | \r |
6669 | @param Value The 64-bit value to write to MM7.\r | |
6670 | \r | |
6671 | **/\r | |
6672 | VOID\r | |
6673 | EFIAPI\r | |
6674 | AsmWriteMm7 (\r | |
6675 | IN UINT64 Value\r | |
6676 | );\r | |
6677 | \r | |
6678 | \r | |
6679 | /**\r | |
6680 | Reads the current value of Time Stamp Counter (TSC).\r | |
6681 | \r | |
6682 | Reads and returns the current value of TSC. This function is only available\r | |
030cd1a2 | 6683 | on IA-32 and x64.\r |
ac644614 | 6684 | \r |
6685 | @return The current value of TSC\r | |
6686 | \r | |
6687 | **/\r | |
6688 | UINT64\r | |
6689 | EFIAPI\r | |
6690 | AsmReadTsc (\r | |
6691 | VOID\r | |
6692 | );\r | |
6693 | \r | |
6694 | \r | |
6695 | /**\r | |
6696 | Reads the current value of a Performance Counter (PMC).\r | |
6697 | \r | |
6698 | Reads and returns the current value of performance counter specified by\r | |
030cd1a2 | 6699 | Index. This function is only available on IA-32 and x64.\r |
ac644614 | 6700 | \r |
6701 | @param Index The 32-bit Performance Counter index to read.\r | |
6702 | \r | |
6703 | @return The value of the PMC specified by Index.\r | |
6704 | \r | |
6705 | **/\r | |
6706 | UINT64\r | |
6707 | EFIAPI\r | |
6708 | AsmReadPmc (\r | |
6709 | IN UINT32 Index\r | |
6710 | );\r | |
6711 | \r | |
6712 | \r | |
6713 | /**\r | |
6714 | Sets up a monitor buffer that is used by AsmMwait().\r | |
6715 | \r | |
6716 | Executes a MONITOR instruction with the register state specified by Eax, Ecx\r | |
030cd1a2 | 6717 | and Edx. Returns Eax. This function is only available on IA-32 and x64.\r |
ac644614 | 6718 | \r |
6719 | @param Eax The value to load into EAX or RAX before executing the MONITOR\r | |
6720 | instruction.\r | |
6721 | @param Ecx The value to load into ECX or RCX before executing the MONITOR\r | |
6722 | instruction.\r | |
6723 | @param Edx The value to load into EDX or RDX before executing the MONITOR\r | |
6724 | instruction.\r | |
6725 | \r | |
6726 | @return Eax\r | |
6727 | \r | |
6728 | **/\r | |
6729 | UINTN\r | |
6730 | EFIAPI\r | |
6731 | AsmMonitor (\r | |
6732 | IN UINTN Eax,\r | |
6733 | IN UINTN Ecx,\r | |
6734 | IN UINTN Edx\r | |
6735 | );\r | |
6736 | \r | |
6737 | \r | |
6738 | /**\r | |
6739 | Executes an MWAIT instruction.\r | |
6740 | \r | |
6741 | Executes an MWAIT instruction with the register state specified by Eax and\r | |
030cd1a2 | 6742 | Ecx. Returns Eax. This function is only available on IA-32 and x64.\r |
ac644614 | 6743 | \r |
6744 | @param Eax The value to load into EAX or RAX before executing the MONITOR\r | |
6745 | instruction.\r | |
6746 | @param Ecx The value to load into ECX or RCX before executing the MONITOR\r | |
6747 | instruction.\r | |
6748 | \r | |
6749 | @return Eax\r | |
6750 | \r | |
6751 | **/\r | |
6752 | UINTN\r | |
6753 | EFIAPI\r | |
6754 | AsmMwait (\r | |
6755 | IN UINTN Eax,\r | |
6756 | IN UINTN Ecx\r | |
6757 | );\r | |
6758 | \r | |
6759 | \r | |
6760 | /**\r | |
6761 | Executes a WBINVD instruction.\r | |
6762 | \r | |
6763 | Executes a WBINVD instruction. This function is only available on IA-32 and\r | |
030cd1a2 | 6764 | x64.\r |
ac644614 | 6765 | \r |
6766 | **/\r | |
6767 | VOID\r | |
6768 | EFIAPI\r | |
6769 | AsmWbinvd (\r | |
6770 | VOID\r | |
6771 | );\r | |
6772 | \r | |
6773 | \r | |
6774 | /**\r | |
6775 | Executes a INVD instruction.\r | |
6776 | \r | |
6777 | Executes a INVD instruction. This function is only available on IA-32 and\r | |
030cd1a2 | 6778 | x64.\r |
ac644614 | 6779 | \r |
6780 | **/\r | |
6781 | VOID\r | |
6782 | EFIAPI\r | |
6783 | AsmInvd (\r | |
6784 | VOID\r | |
6785 | );\r | |
6786 | \r | |
6787 | \r | |
6788 | /**\r | |
6789 | Flushes a cache line from all the instruction and data caches within the\r | |
6790 | coherency domain of the CPU.\r | |
6791 | \r | |
6792 | Flushed the cache line specified by LinearAddress, and returns LinearAddress.\r | |
030cd1a2 | 6793 | This function is only available on IA-32 and x64.\r |
ac644614 | 6794 | \r |
6795 | @param LinearAddress The address of the cache line to flush. If the CPU is\r | |
6796 | in a physical addressing mode, then LinearAddress is a\r | |
6797 | physical address. If the CPU is in a virtual\r | |
6798 | addressing mode, then LinearAddress is a virtual\r | |
6799 | address.\r | |
6800 | \r | |
6801 | @return LinearAddress\r | |
6802 | **/\r | |
6803 | VOID *\r | |
6804 | EFIAPI\r | |
6805 | AsmFlushCacheLine (\r | |
6806 | IN VOID *LinearAddress\r | |
6807 | );\r | |
6808 | \r | |
6809 | \r | |
6810 | /**\r | |
6811 | Enables the 32-bit paging mode on the CPU.\r | |
6812 | \r | |
6813 | Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
6814 | must be properly initialized prior to calling this service. This function\r | |
6815 | assumes the current execution mode is 32-bit protected mode. This function is\r | |
6816 | only available on IA-32. After the 32-bit paging mode is enabled, control is\r | |
6817 | transferred to the function specified by EntryPoint using the new stack\r | |
6818 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
6819 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
6820 | EntryPoint must never return.\r | |
6821 | \r | |
6822 | If the current execution mode is not 32-bit protected mode, then ASSERT().\r | |
6823 | If EntryPoint is NULL, then ASSERT().\r | |
6824 | If NewStack is NULL, then ASSERT().\r | |
6825 | \r | |
6826 | There are a number of constraints that must be followed before calling this\r | |
6827 | function:\r | |
6828 | 1) Interrupts must be disabled.\r | |
6829 | 2) The caller must be in 32-bit protected mode with flat descriptors. This\r | |
6830 | means all descriptors must have a base of 0 and a limit of 4GB.\r | |
6831 | 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat\r | |
6832 | descriptors.\r | |
6833 | 4) CR3 must point to valid page tables that will be used once the transition\r | |
6834 | is complete, and those page tables must guarantee that the pages for this\r | |
6835 | function and the stack are identity mapped.\r | |
6836 | \r | |
6837 | @param EntryPoint A pointer to function to call with the new stack after\r | |
6838 | paging is enabled.\r | |
6839 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
6840 | function as the first parameter after paging is enabled.\r | |
6841 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
6842 | function as the second parameter after paging is enabled.\r | |
6843 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
6844 | function after paging is enabled.\r | |
6845 | \r | |
6846 | **/\r | |
6847 | VOID\r | |
6848 | EFIAPI\r | |
6849 | AsmEnablePaging32 (\r | |
6850 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
6851 | IN VOID *Context1, OPTIONAL\r | |
6852 | IN VOID *Context2, OPTIONAL\r | |
6853 | IN VOID *NewStack\r | |
6854 | );\r | |
6855 | \r | |
6856 | \r | |
6857 | /**\r | |
6858 | Disables the 32-bit paging mode on the CPU.\r | |
6859 | \r | |
6860 | Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r | |
6861 | mode. This function assumes the current execution mode is 32-paged protected\r | |
6862 | mode. This function is only available on IA-32. After the 32-bit paging mode\r | |
6863 | is disabled, control is transferred to the function specified by EntryPoint\r | |
6864 | using the new stack specified by NewStack and passing in the parameters\r | |
6865 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
6866 | may be NULL. The function EntryPoint must never return.\r | |
6867 | \r | |
6868 | If the current execution mode is not 32-bit paged mode, then ASSERT().\r | |
6869 | If EntryPoint is NULL, then ASSERT().\r | |
6870 | If NewStack is NULL, then ASSERT().\r | |
6871 | \r | |
6872 | There are a number of constraints that must be followed before calling this\r | |
6873 | function:\r | |
6874 | 1) Interrupts must be disabled.\r | |
6875 | 2) The caller must be in 32-bit paged mode.\r | |
6876 | 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r | |
6877 | 4) CR3 must point to valid page tables that guarantee that the pages for\r | |
6878 | this function and the stack are identity mapped.\r | |
6879 | \r | |
6880 | @param EntryPoint A pointer to function to call with the new stack after\r | |
6881 | paging is disabled.\r | |
6882 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
6883 | function as the first parameter after paging is disabled.\r | |
6884 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
6885 | function as the second parameter after paging is\r | |
6886 | disabled.\r | |
6887 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
6888 | function after paging is disabled.\r | |
6889 | \r | |
6890 | **/\r | |
6891 | VOID\r | |
6892 | EFIAPI\r | |
6893 | AsmDisablePaging32 (\r | |
6894 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
6895 | IN VOID *Context1, OPTIONAL\r | |
6896 | IN VOID *Context2, OPTIONAL\r | |
6897 | IN VOID *NewStack\r | |
6898 | );\r | |
6899 | \r | |
6900 | \r | |
6901 | /**\r | |
6902 | Enables the 64-bit paging mode on the CPU.\r | |
6903 | \r | |
6904 | Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
6905 | must be properly initialized prior to calling this service. This function\r | |
6906 | assumes the current execution mode is 32-bit protected mode with flat\r | |
6907 | descriptors. This function is only available on IA-32. After the 64-bit\r | |
6908 | paging mode is enabled, control is transferred to the function specified by\r | |
6909 | EntryPoint using the new stack specified by NewStack and passing in the\r | |
6910 | parameters specified by Context1 and Context2. Context1 and Context2 are\r | |
6911 | optional and may be 0. The function EntryPoint must never return.\r | |
6912 | \r | |
6913 | If the current execution mode is not 32-bit protected mode with flat\r | |
6914 | descriptors, then ASSERT().\r | |
6915 | If EntryPoint is 0, then ASSERT().\r | |
6916 | If NewStack is 0, then ASSERT().\r | |
6917 | \r | |
17f695ed | 6918 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r |
ac644614 | 6919 | is called. The descriptor in the GDT that this selector\r |
6920 | references must be setup for long mode.\r | |
6921 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
6922 | the new stack after paging is enabled.\r | |
6923 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
6924 | the EntryPoint function as the first parameter after\r | |
6925 | paging is enabled.\r | |
6926 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
6927 | the EntryPoint function as the second parameter after\r | |
6928 | paging is enabled.\r | |
6929 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
6930 | the EntryPoint function after paging is enabled.\r | |
6931 | \r | |
6932 | **/\r | |
6933 | VOID\r | |
6934 | EFIAPI\r | |
6935 | AsmEnablePaging64 (\r | |
17f695ed | 6936 | IN UINT16 Cs,\r |
ac644614 | 6937 | IN UINT64 EntryPoint,\r |
6938 | IN UINT64 Context1, OPTIONAL\r | |
6939 | IN UINT64 Context2, OPTIONAL\r | |
6940 | IN UINT64 NewStack\r | |
6941 | );\r | |
6942 | \r | |
6943 | \r | |
6944 | /**\r | |
6945 | Disables the 64-bit paging mode on the CPU.\r | |
6946 | \r | |
6947 | Disables the 64-bit paging mode on the CPU and returns to 32-bit protected\r | |
6948 | mode. This function assumes the current execution mode is 64-paging mode.\r | |
030cd1a2 | 6949 | This function is only available on x64. After the 64-bit paging mode is\r |
ac644614 | 6950 | disabled, control is transferred to the function specified by EntryPoint\r |
6951 | using the new stack specified by NewStack and passing in the parameters\r | |
6952 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
6953 | may be 0. The function EntryPoint must never return.\r | |
6954 | \r | |
6955 | If the current execution mode is not 64-bit paged mode, then ASSERT().\r | |
6956 | If EntryPoint is 0, then ASSERT().\r | |
6957 | If NewStack is 0, then ASSERT().\r | |
6958 | \r | |
17f695ed | 6959 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r |
ac644614 | 6960 | is called. The descriptor in the GDT that this selector\r |
6961 | references must be setup for 32-bit protected mode.\r | |
6962 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
6963 | the new stack after paging is disabled.\r | |
6964 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
6965 | the EntryPoint function as the first parameter after\r | |
6966 | paging is disabled.\r | |
6967 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
6968 | the EntryPoint function as the second parameter after\r | |
6969 | paging is disabled.\r | |
6970 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
6971 | the EntryPoint function after paging is disabled.\r | |
6972 | \r | |
6973 | **/\r | |
6974 | VOID\r | |
6975 | EFIAPI\r | |
6976 | AsmDisablePaging64 (\r | |
17f695ed | 6977 | IN UINT16 Cs,\r |
ac644614 | 6978 | IN UINT32 EntryPoint,\r |
6979 | IN UINT32 Context1, OPTIONAL\r | |
6980 | IN UINT32 Context2, OPTIONAL\r | |
6981 | IN UINT32 NewStack\r | |
6982 | );\r | |
6983 | \r | |
6984 | \r | |
6985 | //\r | |
6986 | // 16-bit thunking services\r | |
6987 | //\r | |
6988 | \r | |
6989 | /**\r | |
6990 | Retrieves the properties for 16-bit thunk functions.\r | |
6991 | \r | |
6992 | Computes the size of the buffer and stack below 1MB required to use the\r | |
6993 | AsmPrepareThunk16(), AsmThunk16() and AsmPrepareAndThunk16() functions. This\r | |
6994 | buffer size is returned in RealModeBufferSize, and the stack size is returned\r | |
6995 | in ExtraStackSize. If parameters are passed to the 16-bit real mode code,\r | |
6996 | then the actual minimum stack size is ExtraStackSize plus the maximum number\r | |
6997 | of bytes that need to be passed to the 16-bit real mode code.\r | |
6998 | \r | |
6999 | If RealModeBufferSize is NULL, then ASSERT().\r | |
7000 | If ExtraStackSize is NULL, then ASSERT().\r | |
7001 | \r | |
7002 | @param RealModeBufferSize A pointer to the size of the buffer below 1MB\r | |
7003 | required to use the 16-bit thunk functions.\r | |
7004 | @param ExtraStackSize A pointer to the extra size of stack below 1MB\r | |
7005 | that the 16-bit thunk functions require for\r | |
7006 | temporary storage in the transition to and from\r | |
7007 | 16-bit real mode.\r | |
7008 | \r | |
7009 | **/\r | |
7010 | VOID\r | |
7011 | EFIAPI\r | |
7012 | AsmGetThunk16Properties (\r | |
7013 | OUT UINT32 *RealModeBufferSize,\r | |
7014 | OUT UINT32 *ExtraStackSize\r | |
7015 | );\r | |
7016 | \r | |
7017 | \r | |
7018 | /**\r | |
7019 | Prepares all structures a code required to use AsmThunk16().\r | |
7020 | \r | |
7021 | Prepares all structures and code required to use AsmThunk16().\r | |
7022 | \r | |
7023 | If ThunkContext is NULL, then ASSERT().\r | |
7024 | \r | |
7025 | @param ThunkContext A pointer to the context structure that describes the\r | |
7026 | 16-bit real mode code to call.\r | |
7027 | \r | |
7028 | **/\r | |
7029 | VOID\r | |
7030 | EFIAPI\r | |
7031 | AsmPrepareThunk16 (\r | |
7032 | OUT THUNK_CONTEXT *ThunkContext\r | |
7033 | );\r | |
7034 | \r | |
7035 | \r | |
7036 | /**\r | |
7037 | Transfers control to a 16-bit real mode entry point and returns the results.\r | |
7038 | \r | |
7039 | Transfers control to a 16-bit real mode entry point and returns the results.\r | |
17f695ed | 7040 | AsmPrepareThunk16() must be called with ThunkContext before this function is used.\r |
7041 | This function must be called with interrupts disabled.\r | |
7042 | \r | |
7043 | The register state from the RealModeState field of ThunkContext is restored just prior \r | |
7044 | to calling the 16-bit real mode entry point. This includes the EFLAGS field of RealModeState, \r | |
7045 | which is used to set the interrupt state when a 16-bit real mode entry point is called.\r | |
7046 | Control is transferred to the 16-bit real mode entry point specified by the CS and Eip fields of RealModeState.\r | |
7047 | The stack is initialized to the SS and ESP fields of RealModeState. Any parameters passed to \r | |
7048 | the 16-bit real mode code must be populated by the caller at SS:ESP prior to calling this function. \r | |
7049 | The 16-bit real mode entry point is invoked with a 16-bit CALL FAR instruction,\r | |
7050 | so when accessing stack contents, the 16-bit real mode code must account for the 16-bit segment \r | |
7051 | and 16-bit offset of the return address that were pushed onto the stack. The 16-bit real mode entry \r | |
7052 | point must exit with a RETF instruction. The register state is captured into RealModeState immediately \r | |
7053 | after the RETF instruction is executed.\r | |
7054 | \r | |
7055 | If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts, \r | |
7056 | or any of the 16-bit real mode code makes a SW interrupt, then the caller is responsible for making sure \r | |
7057 | the IDT at address 0 is initialized to handle any HW or SW interrupts that may occur while in 16-bit real mode. \r | |
7058 | \r | |
7059 | If EFLAGS specifies interrupts enabled, or any of the 16-bit real mode code enables interrupts, \r | |
7060 | then the caller is responsible for making sure the 8259 PIC is in a state compatible with 16-bit real mode. \r | |
7061 | This includes the base vectors, the interrupt masks, and the edge/level trigger mode.\r | |
7062 | \r | |
7063 | If THUNK_ATTRIBUTE_BIG_REAL_MODE is set in the ThunkAttributes field of ThunkContext, then the user code \r | |
7064 | is invoked in big real mode. Otherwise, the user code is invoked in 16-bit real mode with 64KB segment limits.\r | |
7065 | \r | |
7066 | If neither THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 nor THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in \r | |
7067 | ThunkAttributes, then it is assumed that the user code did not enable the A20 mask, and no attempt is made to \r | |
7068 | disable the A20 mask.\r | |
7069 | \r | |
7070 | If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is set and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is clear in \r | |
7071 | ThunkAttributes, then attempt to use the INT 15 service to disable the A20 mask. If this INT 15 call fails, \r | |
7072 | then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.\r | |
7073 | \r | |
7074 | If THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 is clear and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL is set in \r | |
7075 | ThunkAttributes, then attempt to disable the A20 mask by directly accessing the 8042 keyboard controller I/O ports.\r | |
7076 | \r | |
ac644614 | 7077 | If ThunkContext is NULL, then ASSERT().\r |
7078 | If AsmPrepareThunk16() was not previously called with ThunkContext, then ASSERT().\r | |
17f695ed | 7079 | If both THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 and THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL are set in \r |
7080 | ThunkAttributes, then ASSERT().\r | |
ac644614 | 7081 | \r |
7082 | @param ThunkContext A pointer to the context structure that describes the\r | |
7083 | 16-bit real mode code to call.\r | |
7084 | \r | |
7085 | **/\r | |
7086 | VOID\r | |
7087 | EFIAPI\r | |
7088 | AsmThunk16 (\r | |
7089 | IN OUT THUNK_CONTEXT *ThunkContext\r | |
7090 | );\r | |
7091 | \r | |
7092 | \r | |
7093 | /**\r | |
7094 | Prepares all structures and code for a 16-bit real mode thunk, transfers\r | |
7095 | control to a 16-bit real mode entry point, and returns the results.\r | |
7096 | \r | |
7097 | Prepares all structures and code for a 16-bit real mode thunk, transfers\r | |
7098 | control to a 16-bit real mode entry point, and returns the results. If the\r | |
7099 | caller only need to perform a single 16-bit real mode thunk, then this\r | |
7100 | service should be used. If the caller intends to make more than one 16-bit\r | |
7101 | real mode thunk, then it is more efficient if AsmPrepareThunk16() is called\r | |
7102 | once and AsmThunk16() can be called for each 16-bit real mode thunk.\r | |
7103 | \r | |
17f695ed | 7104 | See AsmPrepareThunk16() and AsmThunk16() for the detailed description and ASSERT() conditions.\r |
ac644614 | 7105 | \r |
7106 | @param ThunkContext A pointer to the context structure that describes the\r | |
7107 | 16-bit real mode code to call.\r | |
7108 | \r | |
7109 | **/\r | |
7110 | VOID\r | |
7111 | EFIAPI\r | |
7112 | AsmPrepareAndThunk16 (\r | |
7113 | IN OUT THUNK_CONTEXT *ThunkContext\r | |
7114 | );\r | |
7115 | \r | |
ac644614 | 7116 | #endif\r |
e3a7917f | 7117 | #endif\r |
ac644614 | 7118 | \r |
7119 | \r |