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