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