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