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