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