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