]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Declaration of internal functions in BaseLib.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation<BR>\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef __BASE_LIB_INTERNALS__\r | |
16 | #define __BASE_LIB_INTERNALS__\r | |
17 | \r | |
18 | #include <Base.h>\r | |
19 | #include <Library/BaseLib.h>\r | |
20 | #include <Library/BaseMemoryLib.h>\r | |
21 | #include <Library/DebugLib.h>\r | |
22 | #include <Library/TimerLib.h>\r | |
23 | #include <Library/PcdLib.h>\r | |
24 | \r | |
25 | //\r | |
26 | // Math functions\r | |
27 | //\r | |
28 | \r | |
29 | /**\r | |
30 | Shifts a 64-bit integer left between 0 and 63 bits. The low bits\r | |
31 | are filled with zeros. The shifted value is returned.\r | |
32 | \r | |
33 | This function shifts the 64-bit value Operand to the left by Count bits. The\r | |
34 | low Count bits are set to zero. The shifted value is returned.\r | |
35 | \r | |
36 | @param Operand The 64-bit operand to shift left.\r | |
37 | @param Count The number of bits to shift left.\r | |
38 | \r | |
39 | @return Operand << Count\r | |
40 | \r | |
41 | **/\r | |
42 | UINT64\r | |
43 | EFIAPI\r | |
44 | InternalMathLShiftU64 (\r | |
45 | IN UINT64 Operand,\r | |
46 | IN UINTN Count\r | |
47 | );\r | |
48 | \r | |
49 | /**\r | |
50 | Shifts a 64-bit integer right between 0 and 63 bits. This high bits\r | |
51 | are filled with zeros. The shifted value is returned.\r | |
52 | \r | |
53 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
54 | high Count bits are set to zero. The shifted value is returned.\r | |
55 | \r | |
56 | @param Operand The 64-bit operand to shift right.\r | |
57 | @param Count The number of bits to shift right.\r | |
58 | \r | |
59 | @return Operand >> Count\r | |
60 | \r | |
61 | **/\r | |
62 | UINT64\r | |
63 | EFIAPI\r | |
64 | InternalMathRShiftU64 (\r | |
65 | IN UINT64 Operand,\r | |
66 | IN UINTN Count\r | |
67 | );\r | |
68 | \r | |
69 | /**\r | |
70 | Shifts a 64-bit integer right between 0 and 63 bits. The high bits\r | |
71 | are filled with original integer's bit 63. The shifted value is returned.\r | |
72 | \r | |
73 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
74 | high Count bits are set to bit 63 of Operand. The shifted value is returned.\r | |
75 | \r | |
76 | @param Operand The 64-bit operand to shift right.\r | |
77 | @param Count The number of bits to shift right.\r | |
78 | \r | |
79 | @return Operand arithmetically shifted right by Count\r | |
80 | \r | |
81 | **/\r | |
82 | UINT64\r | |
83 | EFIAPI\r | |
84 | InternalMathARShiftU64 (\r | |
85 | IN UINT64 Operand,\r | |
86 | IN UINTN Count\r | |
87 | );\r | |
88 | \r | |
89 | /**\r | |
90 | Rotates a 64-bit integer left between 0 and 63 bits, filling\r | |
91 | the low bits with the high bits that were rotated.\r | |
92 | \r | |
93 | This function rotates the 64-bit value Operand to the left by Count bits. The\r | |
94 | low Count bits are fill with the high Count bits of Operand. The rotated\r | |
95 | value is returned.\r | |
96 | \r | |
97 | @param Operand The 64-bit operand to rotate left.\r | |
98 | @param Count The number of bits to rotate left.\r | |
99 | \r | |
100 | @return Operand <<< Count\r | |
101 | \r | |
102 | **/\r | |
103 | UINT64\r | |
104 | EFIAPI\r | |
105 | InternalMathLRotU64 (\r | |
106 | IN UINT64 Operand,\r | |
107 | IN UINTN Count\r | |
108 | );\r | |
109 | \r | |
110 | /**\r | |
111 | Rotates a 64-bit integer right between 0 and 63 bits, filling\r | |
112 | the high bits with the high low bits that were rotated.\r | |
113 | \r | |
114 | This function rotates the 64-bit value Operand to the right by Count bits.\r | |
115 | The high Count bits are fill with the low Count bits of Operand. The rotated\r | |
116 | value is returned.\r | |
117 | \r | |
118 | @param Operand The 64-bit operand to rotate right.\r | |
119 | @param Count The number of bits to rotate right.\r | |
120 | \r | |
121 | @return Operand >>> Count\r | |
122 | \r | |
123 | **/\r | |
124 | UINT64\r | |
125 | EFIAPI\r | |
126 | InternalMathRRotU64 (\r | |
127 | IN UINT64 Operand,\r | |
128 | IN UINTN Count\r | |
129 | );\r | |
130 | \r | |
131 | /**\r | |
132 | Switches the endianess of a 64-bit integer.\r | |
133 | \r | |
134 | This function swaps the bytes in a 64-bit unsigned value to switch the value\r | |
135 | from little endian to big endian or vice versa. The byte swapped value is\r | |
136 | returned.\r | |
137 | \r | |
138 | @param Operand A 64-bit unsigned value.\r | |
139 | \r | |
140 | @return The byte swapped Operand.\r | |
141 | \r | |
142 | **/\r | |
143 | UINT64\r | |
144 | EFIAPI\r | |
145 | InternalMathSwapBytes64 (\r | |
146 | IN UINT64 Operand\r | |
147 | );\r | |
148 | \r | |
149 | /**\r | |
150 | Multiples a 64-bit unsigned integer by a 32-bit unsigned integer\r | |
151 | and generates a 64-bit unsigned result.\r | |
152 | \r | |
153 | This function multiples the 64-bit unsigned value Multiplicand by the 32-bit\r | |
154 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
155 | bit unsigned result is returned.\r | |
156 | \r | |
157 | @param Multiplicand A 64-bit unsigned value.\r | |
158 | @param Multiplier A 32-bit unsigned value.\r | |
159 | \r | |
160 | @return Multiplicand * Multiplier\r | |
161 | \r | |
162 | **/\r | |
163 | UINT64\r | |
164 | EFIAPI\r | |
165 | InternalMathMultU64x32 (\r | |
166 | IN UINT64 Multiplicand,\r | |
167 | IN UINT32 Multiplier\r | |
168 | );\r | |
169 | \r | |
170 | /**\r | |
171 | Multiples a 64-bit unsigned integer by a 64-bit unsigned integer\r | |
172 | and generates a 64-bit unsigned result.\r | |
173 | \r | |
174 | This function multiples the 64-bit unsigned value Multiplicand by the 64-bit\r | |
175 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
176 | bit unsigned result is returned.\r | |
177 | \r | |
178 | @param Multiplicand A 64-bit unsigned value.\r | |
179 | @param Multiplier A 64-bit unsigned value.\r | |
180 | \r | |
181 | @return Multiplicand * Multiplier\r | |
182 | \r | |
183 | **/\r | |
184 | UINT64\r | |
185 | EFIAPI\r | |
186 | InternalMathMultU64x64 (\r | |
187 | IN UINT64 Multiplicand,\r | |
188 | IN UINT64 Multiplier\r | |
189 | );\r | |
190 | \r | |
191 | /**\r | |
192 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
193 | generates a 64-bit unsigned result.\r | |
194 | \r | |
195 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
196 | unsigned value Divisor and generates a 64-bit unsigned quotient. This\r | |
197 | function returns the 64-bit unsigned quotient.\r | |
198 | \r | |
199 | @param Dividend A 64-bit unsigned value.\r | |
200 | @param Divisor A 32-bit unsigned value.\r | |
201 | \r | |
202 | @return Dividend / Divisor\r | |
203 | \r | |
204 | **/\r | |
205 | UINT64\r | |
206 | EFIAPI\r | |
207 | InternalMathDivU64x32 (\r | |
208 | IN UINT64 Dividend,\r | |
209 | IN UINT32 Divisor\r | |
210 | );\r | |
211 | \r | |
212 | /**\r | |
213 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
214 | generates a 32-bit unsigned remainder.\r | |
215 | \r | |
216 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
217 | unsigned value Divisor and generates a 32-bit remainder. This function\r | |
218 | returns the 32-bit unsigned remainder.\r | |
219 | \r | |
220 | @param Dividend A 64-bit unsigned value.\r | |
221 | @param Divisor A 32-bit unsigned value.\r | |
222 | \r | |
223 | @return Dividend % Divisor\r | |
224 | \r | |
225 | **/\r | |
226 | UINT32\r | |
227 | EFIAPI\r | |
228 | InternalMathModU64x32 (\r | |
229 | IN UINT64 Dividend,\r | |
230 | IN UINT32 Divisor\r | |
231 | );\r | |
232 | \r | |
233 | /**\r | |
234 | Divides a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
235 | generates a 64-bit unsigned result and an optional 32-bit unsigned remainder.\r | |
236 | \r | |
237 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
238 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
239 | is not NULL, then the 32-bit unsigned remainder is returned in Remainder.\r | |
240 | This function returns the 64-bit unsigned quotient.\r | |
241 | \r | |
242 | @param Dividend A 64-bit unsigned value.\r | |
243 | @param Divisor A 32-bit unsigned value.\r | |
244 | @param Remainder A pointer to a 32-bit unsigned value. This parameter is\r | |
245 | optional and may be NULL.\r | |
246 | \r | |
247 | @return Dividend / Divisor\r | |
248 | \r | |
249 | **/\r | |
250 | UINT64\r | |
251 | EFIAPI\r | |
252 | InternalMathDivRemU64x32 (\r | |
253 | IN UINT64 Dividend,\r | |
254 | IN UINT32 Divisor,\r | |
255 | OUT UINT32 *Remainder OPTIONAL\r | |
256 | );\r | |
257 | \r | |
258 | /**\r | |
259 | Divides a 64-bit unsigned integer by a 64-bit unsigned integer and\r | |
260 | generates a 64-bit unsigned result and an optional 64-bit unsigned remainder.\r | |
261 | \r | |
262 | This function divides the 64-bit unsigned value Dividend by the 64-bit\r | |
263 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
264 | is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r | |
265 | This function returns the 64-bit unsigned quotient.\r | |
266 | \r | |
267 | @param Dividend A 64-bit unsigned value.\r | |
268 | @param Divisor A 64-bit unsigned value.\r | |
269 | @param Remainder A pointer to a 64-bit unsigned value. This parameter is\r | |
270 | optional and may be NULL.\r | |
271 | \r | |
272 | @return Dividend / Divisor\r | |
273 | \r | |
274 | **/\r | |
275 | UINT64\r | |
276 | EFIAPI\r | |
277 | InternalMathDivRemU64x64 (\r | |
278 | IN UINT64 Dividend,\r | |
279 | IN UINT64 Divisor,\r | |
280 | OUT UINT64 *Remainder OPTIONAL\r | |
281 | );\r | |
282 | \r | |
283 | /**\r | |
284 | Divides a 64-bit signed integer by a 64-bit signed integer and\r | |
285 | generates a 64-bit signed result and an optional 64-bit signed remainder.\r | |
286 | \r | |
287 | This function divides the 64-bit signed value Dividend by the 64-bit\r | |
288 | signed value Divisor and generates a 64-bit signed quotient. If Remainder\r | |
289 | is not NULL, then the 64-bit signed remainder is returned in Remainder.\r | |
290 | This function returns the 64-bit signed quotient.\r | |
291 | \r | |
292 | @param Dividend A 64-bit signed value.\r | |
293 | @param Divisor A 64-bit signed value.\r | |
294 | @param Remainder A pointer to a 64-bit signed value. This parameter is\r | |
295 | optional and may be NULL.\r | |
296 | \r | |
297 | @return Dividend / Divisor\r | |
298 | \r | |
299 | **/\r | |
300 | INT64\r | |
301 | EFIAPI\r | |
302 | InternalMathDivRemS64x64 (\r | |
303 | IN INT64 Dividend,\r | |
304 | IN INT64 Divisor,\r | |
305 | OUT INT64 *Remainder OPTIONAL\r | |
306 | );\r | |
307 | \r | |
308 | /**\r | |
309 | Transfers control to a function starting with a new stack.\r | |
310 | \r | |
311 | Transfers control to the function specified by EntryPoint using the\r | |
312 | new stack specified by NewStack and passing in the parameters specified\r | |
313 | by Context1 and Context2. Context1 and Context2 are optional and may\r | |
314 | be NULL. The function EntryPoint must never return.\r | |
315 | Marker will be ignored on IA-32, x64, and EBC.\r | |
316 | IPF CPUs expect one additional parameter of type VOID * that specifies\r | |
317 | the new backing store pointer.\r | |
318 | \r | |
319 | If EntryPoint is NULL, then ASSERT().\r | |
320 | If NewStack is NULL, then ASSERT().\r | |
321 | \r | |
322 | @param EntryPoint A pointer to function to call with the new stack.\r | |
323 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
324 | function.\r | |
325 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
326 | function.\r | |
327 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
328 | function.\r | |
329 | @param Marker VA_LIST marker for the variable argument list.\r | |
330 | \r | |
331 | **/\r | |
332 | VOID\r | |
333 | EFIAPI\r | |
334 | InternalSwitchStack (\r | |
335 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
336 | IN VOID *Context1, OPTIONAL\r | |
337 | IN VOID *Context2, OPTIONAL\r | |
338 | IN VOID *NewStack,\r | |
339 | IN VA_LIST Marker\r | |
340 | );\r | |
341 | \r | |
342 | \r | |
343 | /**\r | |
344 | Worker function that locates the Node in the List.\r | |
345 | \r | |
346 | By searching the List, finds the location of the Node in List. At the same time,\r | |
347 | verifies the validity of this list.\r | |
348 | \r | |
349 | If List is NULL, then ASSERT().\r | |
350 | If List->ForwardLink is NULL, then ASSERT().\r | |
351 | If List->backLink is NULL, then ASSERT().\r | |
352 | If Node is NULL, then ASSERT();\r | |
353 | If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number\r | |
354 | of nodes in ListHead, including the ListHead node, is greater than or\r | |
355 | equal to PcdMaximumLinkedListLength, then ASSERT().\r | |
356 | \r | |
357 | @param List A pointer to a node in a linked list.\r | |
358 | @param Node A pointer to one nod.\r | |
359 | \r | |
360 | @retval TRUE Node is in List\r | |
361 | @retval FALSE Node isn't in List, or List is invalid\r | |
362 | \r | |
363 | **/\r | |
364 | BOOLEAN\r | |
365 | EFIAPI\r | |
366 | IsNodeInList (\r | |
367 | IN CONST LIST_ENTRY *List,\r | |
368 | IN CONST LIST_ENTRY *Node\r | |
369 | );\r | |
370 | \r | |
371 | \r | |
372 | /**\r | |
373 | Performs an atomic increment of an 32-bit unsigned integer.\r | |
374 | \r | |
375 | Performs an atomic increment of the 32-bit unsigned integer specified by\r | |
376 | Value and returns the incremented value. The increment operation must be\r | |
377 | performed using MP safe mechanisms. The state of the return value is not\r | |
378 | guaranteed to be MP safe.\r | |
379 | \r | |
380 | @param Value A pointer to the 32-bit value to increment.\r | |
381 | \r | |
382 | @return The incremented value.\r | |
383 | \r | |
384 | **/\r | |
385 | UINT32\r | |
386 | EFIAPI\r | |
387 | InternalSyncIncrement (\r | |
388 | IN volatile UINT32 *Value\r | |
389 | );\r | |
390 | \r | |
391 | \r | |
392 | /**\r | |
393 | Performs an atomic decrement of an 32-bit unsigned integer.\r | |
394 | \r | |
395 | Performs an atomic decrement of the 32-bit unsigned integer specified by\r | |
396 | Value and returns the decrement value. The decrement operation must be\r | |
397 | performed using MP safe mechanisms. The state of the return value is not\r | |
398 | guaranteed to be MP safe.\r | |
399 | \r | |
400 | @param Value A pointer to the 32-bit value to decrement.\r | |
401 | \r | |
402 | @return The decrement value.\r | |
403 | \r | |
404 | **/\r | |
405 | UINT32\r | |
406 | EFIAPI\r | |
407 | InternalSyncDecrement (\r | |
408 | IN volatile UINT32 *Value\r | |
409 | );\r | |
410 | \r | |
411 | \r | |
412 | /**\r | |
413 | Performs an atomic compare exchange operation on a 32-bit unsigned integer.\r | |
414 | \r | |
415 | Performs an atomic compare exchange operation on the 32-bit unsigned integer\r | |
416 | specified by Value. If Value is equal to CompareValue, then Value is set to\r | |
417 | ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,\r | |
418 | then Value is returned. The compare exchange operation must be performed using\r | |
419 | MP safe mechanisms.\r | |
420 | \r | |
421 | @param Value A pointer to the 32-bit value for the compare exchange\r | |
422 | operation.\r | |
423 | @param CompareValue 32-bit value used in compare operation.\r | |
424 | @param ExchangeValue 32-bit value used in exchange operation.\r | |
425 | \r | |
426 | @return The original *Value before exchange.\r | |
427 | \r | |
428 | **/\r | |
429 | UINT32\r | |
430 | EFIAPI\r | |
431 | InternalSyncCompareExchange32 (\r | |
432 | IN volatile UINT32 *Value,\r | |
433 | IN UINT32 CompareValue,\r | |
434 | IN UINT32 ExchangeValue\r | |
435 | );\r | |
436 | \r | |
437 | \r | |
438 | /**\r | |
439 | Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r | |
440 | \r | |
441 | Performs an atomic compare exchange operation on the 64-bit unsigned integer specified\r | |
442 | by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and\r | |
443 | CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.\r | |
444 | The compare exchange operation must be performed using MP safe mechanisms.\r | |
445 | \r | |
446 | @param Value A pointer to the 64-bit value for the compare exchange\r | |
447 | operation.\r | |
448 | @param CompareValue 64-bit value used in compare operation.\r | |
449 | @param ExchangeValue 64-bit value used in exchange operation.\r | |
450 | \r | |
451 | @return The original *Value before exchange.\r | |
452 | \r | |
453 | **/\r | |
454 | UINT64\r | |
455 | EFIAPI\r | |
456 | InternalSyncCompareExchange64 (\r | |
457 | IN volatile UINT64 *Value,\r | |
458 | IN UINT64 CompareValue,\r | |
459 | IN UINT64 ExchangeValue\r | |
460 | );\r | |
461 | \r | |
462 | \r | |
463 | /**\r | |
464 | Worker function that returns a bit field from Operand.\r | |
465 | \r | |
466 | Returns the bitfield specified by the StartBit and the EndBit from Operand.\r | |
467 | \r | |
468 | @param Operand Operand on which to perform the bitfield operation.\r | |
469 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
470 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
471 | \r | |
472 | @return The bit field read.\r | |
473 | \r | |
474 | **/\r | |
475 | UINTN\r | |
476 | EFIAPI\r | |
477 | BitFieldReadUint (\r | |
478 | IN UINTN Operand,\r | |
479 | IN UINTN StartBit,\r | |
480 | IN UINTN EndBit\r | |
481 | );\r | |
482 | \r | |
483 | \r | |
484 | /**\r | |
485 | Worker function that reads a bit field from Operand, performs a bitwise OR,\r | |
486 | and returns the result.\r | |
487 | \r | |
488 | Performs a bitwise OR between the bit field specified by StartBit and EndBit\r | |
489 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
490 | preserved. The new value is returned.\r | |
491 | \r | |
492 | @param Operand Operand on which to perform the bitfield operation.\r | |
493 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
494 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
495 | @param OrData The value to OR with the read value from the value\r | |
496 | \r | |
497 | @return The new value.\r | |
498 | \r | |
499 | **/\r | |
500 | UINTN\r | |
501 | EFIAPI\r | |
502 | BitFieldOrUint (\r | |
503 | IN UINTN Operand,\r | |
504 | IN UINTN StartBit,\r | |
505 | IN UINTN EndBit,\r | |
506 | IN UINTN OrData\r | |
507 | );\r | |
508 | \r | |
509 | \r | |
510 | /**\r | |
511 | Worker function that reads a bit field from Operand, performs a bitwise AND,\r | |
512 | and returns the result.\r | |
513 | \r | |
514 | Performs a bitwise AND between the bit field specified by StartBit and EndBit\r | |
515 | in Operand and the value specified by AndData. All other bits in Operand are\r | |
516 | preserved. The new value is returned.\r | |
517 | \r | |
518 | @param Operand Operand on which to perform the bitfield operation.\r | |
519 | @param StartBit The ordinal of the least significant bit in the bit field.\r | |
520 | @param EndBit The ordinal of the most significant bit in the bit field.\r | |
521 | @param AndData The value to And with the read value from the value\r | |
522 | \r | |
523 | @return The new value.\r | |
524 | \r | |
525 | **/\r | |
526 | UINTN\r | |
527 | EFIAPI\r | |
528 | BitFieldAndUint (\r | |
529 | IN UINTN Operand,\r | |
530 | IN UINTN StartBit,\r | |
531 | IN UINTN EndBit,\r | |
532 | IN UINTN AndData\r | |
533 | );\r | |
534 | \r | |
535 | \r | |
536 | /**\r | |
537 | Worker function that checks ASSERT condition for JumpBuffer\r | |
538 | \r | |
539 | Checks ASSERT condition for JumpBuffer.\r | |
540 | \r | |
541 | If JumpBuffer is NULL, then ASSERT().\r | |
542 | For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().\r | |
543 | \r | |
544 | @param JumpBuffer A pointer to CPU context buffer.\r | |
545 | \r | |
546 | **/\r | |
547 | VOID\r | |
548 | EFIAPI\r | |
549 | InternalAssertJumpBuffer (\r | |
550 | IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer\r | |
551 | );\r | |
552 | \r | |
553 | \r | |
554 | /**\r | |
555 | Restores the CPU context that was saved with SetJump().\r | |
556 | \r | |
557 | Restores the CPU context from the buffer specified by JumpBuffer.\r | |
558 | This function never returns to the caller.\r | |
559 | Instead is resumes execution based on the state of JumpBuffer.\r | |
560 | \r | |
561 | @param JumpBuffer A pointer to CPU context buffer.\r | |
562 | @param Value The value to return when the SetJump() context is restored.\r | |
563 | \r | |
564 | **/\r | |
565 | VOID\r | |
566 | EFIAPI\r | |
567 | InternalLongJump (\r | |
568 | IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,\r | |
569 | IN UINTN Value\r | |
570 | );\r | |
571 | \r | |
572 | \r | |
573 | //\r | |
574 | // Ia32 and x64 specific functions\r | |
575 | //\r | |
576 | #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)\r | |
577 | \r | |
578 | /**\r | |
579 | Reads the current Global Descriptor Table Register(GDTR) descriptor.\r | |
580 | \r | |
581 | Reads and returns the current GDTR descriptor and returns it in Gdtr. This\r | |
582 | function is only available on IA-32 and X64.\r | |
583 | \r | |
584 | @param Gdtr Pointer to a GDTR descriptor.\r | |
585 | \r | |
586 | **/\r | |
587 | VOID\r | |
588 | EFIAPI\r | |
589 | InternalX86ReadGdtr (\r | |
590 | OUT IA32_DESCRIPTOR *Gdtr\r | |
591 | );\r | |
592 | \r | |
593 | /**\r | |
594 | Writes the current Global Descriptor Table Register (GDTR) descriptor.\r | |
595 | \r | |
596 | Writes and the current GDTR descriptor specified by Gdtr. This function is\r | |
597 | only available on IA-32 and X64.\r | |
598 | \r | |
599 | @param Gdtr Pointer to a GDTR descriptor.\r | |
600 | \r | |
601 | **/\r | |
602 | VOID\r | |
603 | EFIAPI\r | |
604 | InternalX86WriteGdtr (\r | |
605 | IN CONST IA32_DESCRIPTOR *Gdtr\r | |
606 | );\r | |
607 | \r | |
608 | /**\r | |
609 | Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.\r | |
610 | \r | |
611 | Reads and returns the current IDTR descriptor and returns it in Idtr. This\r | |
612 | function is only available on IA-32 and X64.\r | |
613 | \r | |
614 | @param Idtr Pointer to a IDTR descriptor.\r | |
615 | \r | |
616 | **/\r | |
617 | VOID\r | |
618 | EFIAPI\r | |
619 | InternalX86ReadIdtr (\r | |
620 | OUT IA32_DESCRIPTOR *Idtr\r | |
621 | );\r | |
622 | \r | |
623 | /**\r | |
624 | Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.\r | |
625 | \r | |
626 | Writes the current IDTR descriptor and returns it in Idtr. This function is\r | |
627 | only available on IA-32 and X64.\r | |
628 | \r | |
629 | @param Idtr Pointer to a IDTR descriptor.\r | |
630 | \r | |
631 | **/\r | |
632 | VOID\r | |
633 | EFIAPI\r | |
634 | InternalX86WriteIdtr (\r | |
635 | IN CONST IA32_DESCRIPTOR *Idtr\r | |
636 | );\r | |
637 | \r | |
638 | /**\r | |
639 | Save the current floating point/SSE/SSE2 context to a buffer.\r | |
640 | \r | |
641 | Saves the current floating point/SSE/SSE2 state to the buffer specified by\r | |
642 | Buffer. Buffer must be aligned on a 16-byte boundary. This function is only\r | |
643 | available on IA-32 and X64.\r | |
644 | \r | |
645 | @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.\r | |
646 | \r | |
647 | **/\r | |
648 | VOID\r | |
649 | EFIAPI\r | |
650 | InternalX86FxSave (\r | |
651 | OUT IA32_FX_BUFFER *Buffer\r | |
652 | );\r | |
653 | \r | |
654 | /**\r | |
655 | Restores the current floating point/SSE/SSE2 context from a buffer.\r | |
656 | \r | |
657 | Restores the current floating point/SSE/SSE2 state from the buffer specified\r | |
658 | by Buffer. Buffer must be aligned on a 16-byte boundary. This function is\r | |
659 | only available on IA-32 and X64.\r | |
660 | \r | |
661 | @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.\r | |
662 | \r | |
663 | **/\r | |
664 | VOID\r | |
665 | EFIAPI\r | |
666 | InternalX86FxRestore (\r | |
667 | IN CONST IA32_FX_BUFFER *Buffer\r | |
668 | );\r | |
669 | \r | |
670 | /**\r | |
671 | Enables the 32-bit paging mode on the CPU.\r | |
672 | \r | |
673 | Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
674 | must be properly initialized prior to calling this service. This function\r | |
675 | assumes the current execution mode is 32-bit protected mode. This function is\r | |
676 | only available on IA-32. After the 32-bit paging mode is enabled, control is\r | |
677 | transferred to the function specified by EntryPoint using the new stack\r | |
678 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
679 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
680 | EntryPoint must never return.\r | |
681 | \r | |
682 | There are a number of constraints that must be followed before calling this\r | |
683 | function:\r | |
684 | 1) Interrupts must be disabled.\r | |
685 | 2) The caller must be in 32-bit protected mode with flat descriptors. This\r | |
686 | means all descriptors must have a base of 0 and a limit of 4GB.\r | |
687 | 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat\r | |
688 | descriptors.\r | |
689 | 4) CR3 must point to valid page tables that will be used once the transition\r | |
690 | is complete, and those page tables must guarantee that the pages for this\r | |
691 | function and the stack are identity mapped.\r | |
692 | \r | |
693 | @param EntryPoint A pointer to function to call with the new stack after\r | |
694 | paging is enabled.\r | |
695 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
696 | function as the first parameter after paging is enabled.\r | |
697 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
698 | function as the second parameter after paging is enabled.\r | |
699 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
700 | function after paging is enabled.\r | |
701 | \r | |
702 | **/\r | |
703 | VOID\r | |
704 | EFIAPI\r | |
705 | InternalX86EnablePaging32 (\r | |
706 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
707 | IN VOID *Context1, OPTIONAL\r | |
708 | IN VOID *Context2, OPTIONAL\r | |
709 | IN VOID *NewStack\r | |
710 | );\r | |
711 | \r | |
712 | /**\r | |
713 | Disables the 32-bit paging mode on the CPU.\r | |
714 | \r | |
715 | Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r | |
716 | mode. This function assumes the current execution mode is 32-paged protected\r | |
717 | mode. This function is only available on IA-32. After the 32-bit paging mode\r | |
718 | is disabled, control is transferred to the function specified by EntryPoint\r | |
719 | using the new stack specified by NewStack and passing in the parameters\r | |
720 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
721 | may be NULL. The function EntryPoint must never return.\r | |
722 | \r | |
723 | There are a number of constraints that must be followed before calling this\r | |
724 | function:\r | |
725 | 1) Interrupts must be disabled.\r | |
726 | 2) The caller must be in 32-bit paged mode.\r | |
727 | 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r | |
728 | 4) CR3 must point to valid page tables that guarantee that the pages for\r | |
729 | this function and the stack are identity mapped.\r | |
730 | \r | |
731 | @param EntryPoint A pointer to function to call with the new stack after\r | |
732 | paging is disabled.\r | |
733 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
734 | function as the first parameter after paging is disabled.\r | |
735 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
736 | function as the second parameter after paging is\r | |
737 | disabled.\r | |
738 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
739 | function after paging is disabled.\r | |
740 | \r | |
741 | **/\r | |
742 | VOID\r | |
743 | EFIAPI\r | |
744 | InternalX86DisablePaging32 (\r | |
745 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
746 | IN VOID *Context1, OPTIONAL\r | |
747 | IN VOID *Context2, OPTIONAL\r | |
748 | IN VOID *NewStack\r | |
749 | );\r | |
750 | \r | |
751 | /**\r | |
752 | Enables the 64-bit paging mode on the CPU.\r | |
753 | \r | |
754 | Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
755 | must be properly initialized prior to calling this service. This function\r | |
756 | assumes the current execution mode is 32-bit protected mode with flat\r | |
757 | descriptors. This function is only available on IA-32. After the 64-bit\r | |
758 | paging mode is enabled, control is transferred to the function specified by\r | |
759 | EntryPoint using the new stack specified by NewStack and passing in the\r | |
760 | parameters specified by Context1 and Context2. Context1 and Context2 are\r | |
761 | optional and may be 0. The function EntryPoint must never return.\r | |
762 | \r | |
763 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r | |
764 | is called. The descriptor in the GDT that this selector\r | |
765 | references must be setup for long mode.\r | |
766 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
767 | the new stack after paging is enabled.\r | |
768 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
769 | the EntryPoint function as the first parameter after\r | |
770 | paging is enabled.\r | |
771 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
772 | the EntryPoint function as the second parameter after\r | |
773 | paging is enabled.\r | |
774 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
775 | the EntryPoint function after paging is enabled.\r | |
776 | \r | |
777 | **/\r | |
778 | VOID\r | |
779 | EFIAPI\r | |
780 | InternalX86EnablePaging64 (\r | |
781 | IN UINT16 Cs,\r | |
782 | IN UINT64 EntryPoint,\r | |
783 | IN UINT64 Context1, OPTIONAL\r | |
784 | IN UINT64 Context2, OPTIONAL\r | |
785 | IN UINT64 NewStack\r | |
786 | );\r | |
787 | \r | |
788 | /**\r | |
789 | Disables the 64-bit paging mode on the CPU.\r | |
790 | \r | |
791 | Disables the 64-bit paging mode on the CPU and returns to 32-bit protected\r | |
792 | mode. This function assumes the current execution mode is 64-paging mode.\r | |
793 | This function is only available on X64. After the 64-bit paging mode is\r | |
794 | disabled, control is transferred to the function specified by EntryPoint\r | |
795 | using the new stack specified by NewStack and passing in the parameters\r | |
796 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
797 | may be 0. The function EntryPoint must never return.\r | |
798 | \r | |
799 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r | |
800 | is called. The descriptor in the GDT that this selector\r | |
801 | references must be setup for 32-bit protected mode.\r | |
802 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
803 | the new stack after paging is disabled.\r | |
804 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
805 | the EntryPoint function as the first parameter after\r | |
806 | paging is disabled.\r | |
807 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
808 | the EntryPoint function as the second parameter after\r | |
809 | paging is disabled.\r | |
810 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
811 | the EntryPoint function after paging is disabled.\r | |
812 | \r | |
813 | **/\r | |
814 | VOID\r | |
815 | EFIAPI\r | |
816 | InternalX86DisablePaging64 (\r | |
817 | IN UINT16 Cs,\r | |
818 | IN UINT32 EntryPoint,\r | |
819 | IN UINT32 Context1, OPTIONAL\r | |
820 | IN UINT32 Context2, OPTIONAL\r | |
821 | IN UINT32 NewStack\r | |
822 | );\r | |
823 | \r | |
824 | \r | |
825 | #elif defined (MDE_CPU_IPF)\r | |
826 | //\r | |
827 | //\r | |
828 | // IPF specific functions\r | |
829 | //\r | |
830 | \r | |
831 | //\r | |
832 | // Structure definition for look up table.\r | |
833 | //\r | |
834 | typedef struct {\r | |
835 | UINT64 Index;\r | |
836 | UINT64 (*Function) (VOID);\r | |
837 | } REGISTER_ENTRY;\r | |
838 | \r | |
839 | \r | |
840 | /**\r | |
841 | Reads control register DCR.\r | |
842 | \r | |
843 | This is a worker function for AsmReadControlRegister()\r | |
844 | when its parameter Index is IPF_CONTROL_REGISTER_DCR\r | |
845 | \r | |
846 | @return The 64-bit control register DCR.\r | |
847 | \r | |
848 | **/\r | |
849 | UINT64\r | |
850 | EFIAPI\r | |
851 | AsmReadControlRegisterDcr (\r | |
852 | VOID\r | |
853 | );\r | |
854 | \r | |
855 | \r | |
856 | /**\r | |
857 | Reads control register ITM.\r | |
858 | \r | |
859 | This is a worker function for AsmReadControlRegister()\r | |
860 | when its parameter Index is IPF_CONTROL_REGISTER_ITM\r | |
861 | \r | |
862 | @return The 64-bit control register ITM.\r | |
863 | \r | |
864 | **/\r | |
865 | UINT64\r | |
866 | EFIAPI\r | |
867 | AsmReadControlRegisterItm (\r | |
868 | VOID\r | |
869 | );\r | |
870 | \r | |
871 | \r | |
872 | /**\r | |
873 | Reads control register IVA.\r | |
874 | \r | |
875 | This is a worker function for AsmReadControlRegister()\r | |
876 | when its parameter Index is IPF_CONTROL_REGISTER_IVA\r | |
877 | \r | |
878 | @return The 64-bit control register IVA.\r | |
879 | \r | |
880 | **/\r | |
881 | UINT64\r | |
882 | EFIAPI\r | |
883 | AsmReadControlRegisterIva (\r | |
884 | VOID\r | |
885 | );\r | |
886 | \r | |
887 | \r | |
888 | /**\r | |
889 | Reads control register PTA.\r | |
890 | \r | |
891 | This is a worker function for AsmReadControlRegister()\r | |
892 | when its parameter Index is IPF_CONTROL_REGISTER_PTA\r | |
893 | \r | |
894 | @return The 64-bit control register PTA.\r | |
895 | \r | |
896 | **/\r | |
897 | UINT64\r | |
898 | EFIAPI\r | |
899 | AsmReadControlRegisterPta (\r | |
900 | VOID\r | |
901 | );\r | |
902 | \r | |
903 | \r | |
904 | /**\r | |
905 | Reads control register IPSR.\r | |
906 | \r | |
907 | This is a worker function for AsmReadControlRegister()\r | |
908 | when its parameter Index is IPF_CONTROL_REGISTER_IPSR\r | |
909 | \r | |
910 | @return The 64-bit control register IPSR.\r | |
911 | \r | |
912 | **/\r | |
913 | UINT64\r | |
914 | EFIAPI\r | |
915 | AsmReadControlRegisterIpsr (\r | |
916 | VOID\r | |
917 | );\r | |
918 | \r | |
919 | \r | |
920 | /**\r | |
921 | Reads control register ISR.\r | |
922 | \r | |
923 | This is a worker function for AsmReadControlRegister()\r | |
924 | when its parameter Index is IPF_CONTROL_REGISTER_ISR\r | |
925 | \r | |
926 | @return The 64-bit control register ISR.\r | |
927 | \r | |
928 | **/\r | |
929 | UINT64\r | |
930 | EFIAPI\r | |
931 | AsmReadControlRegisterIsr (\r | |
932 | VOID\r | |
933 | );\r | |
934 | \r | |
935 | \r | |
936 | /**\r | |
937 | Reads control register IIP.\r | |
938 | \r | |
939 | This is a worker function for AsmReadControlRegister()\r | |
940 | when its parameter Index is IPF_CONTROL_REGISTER_IIP\r | |
941 | \r | |
942 | @return The 64-bit control register IIP.\r | |
943 | \r | |
944 | **/\r | |
945 | UINT64\r | |
946 | EFIAPI\r | |
947 | AsmReadControlRegisterIip (\r | |
948 | VOID\r | |
949 | );\r | |
950 | \r | |
951 | \r | |
952 | /**\r | |
953 | Reads control register IFA.\r | |
954 | \r | |
955 | This is a worker function for AsmReadControlRegister()\r | |
956 | when its parameter Index is IPF_CONTROL_REGISTER_IFA\r | |
957 | \r | |
958 | @return The 64-bit control register IFA.\r | |
959 | \r | |
960 | **/\r | |
961 | UINT64\r | |
962 | EFIAPI\r | |
963 | AsmReadControlRegisterIfa (\r | |
964 | VOID\r | |
965 | );\r | |
966 | \r | |
967 | \r | |
968 | /**\r | |
969 | Reads control register ITIR.\r | |
970 | \r | |
971 | This is a worker function for AsmReadControlRegister()\r | |
972 | when its parameter Index is IPF_CONTROL_REGISTER_ITIR\r | |
973 | \r | |
974 | @return The 64-bit control register ITIR.\r | |
975 | \r | |
976 | **/\r | |
977 | UINT64\r | |
978 | EFIAPI\r | |
979 | AsmReadControlRegisterItir (\r | |
980 | VOID\r | |
981 | );\r | |
982 | \r | |
983 | \r | |
984 | /**\r | |
985 | Reads control register IIPA.\r | |
986 | \r | |
987 | This is a worker function for AsmReadControlRegister()\r | |
988 | when its parameter Index is IPF_CONTROL_REGISTER_IIPA\r | |
989 | \r | |
990 | @return The 64-bit control register IIPA.\r | |
991 | \r | |
992 | **/\r | |
993 | UINT64\r | |
994 | EFIAPI\r | |
995 | AsmReadControlRegisterIipa (\r | |
996 | VOID\r | |
997 | );\r | |
998 | \r | |
999 | \r | |
1000 | /**\r | |
1001 | Reads control register IFS.\r | |
1002 | \r | |
1003 | This is a worker function for AsmReadControlRegister()\r | |
1004 | when its parameter Index is IPF_CONTROL_REGISTER_IFS\r | |
1005 | \r | |
1006 | @return The 64-bit control register IFS.\r | |
1007 | \r | |
1008 | **/\r | |
1009 | UINT64\r | |
1010 | EFIAPI\r | |
1011 | AsmReadControlRegisterIfs (\r | |
1012 | VOID\r | |
1013 | );\r | |
1014 | \r | |
1015 | \r | |
1016 | /**\r | |
1017 | Reads control register IIM.\r | |
1018 | \r | |
1019 | This is a worker function for AsmReadControlRegister()\r | |
1020 | when its parameter Index is IPF_CONTROL_REGISTER_IIM\r | |
1021 | \r | |
1022 | @return The 64-bit control register IIM.\r | |
1023 | \r | |
1024 | **/\r | |
1025 | UINT64\r | |
1026 | EFIAPI\r | |
1027 | AsmReadControlRegisterIim (\r | |
1028 | VOID\r | |
1029 | );\r | |
1030 | \r | |
1031 | \r | |
1032 | /**\r | |
1033 | Reads control register IHA.\r | |
1034 | \r | |
1035 | This is a worker function for AsmReadControlRegister()\r | |
1036 | when its parameter Index is IPF_CONTROL_REGISTER_IHA\r | |
1037 | \r | |
1038 | @return The 64-bit control register IHA.\r | |
1039 | \r | |
1040 | **/\r | |
1041 | UINT64\r | |
1042 | EFIAPI\r | |
1043 | AsmReadControlRegisterIha (\r | |
1044 | VOID\r | |
1045 | );\r | |
1046 | \r | |
1047 | \r | |
1048 | /**\r | |
1049 | Reads control register LID.\r | |
1050 | \r | |
1051 | This is a worker function for AsmReadControlRegister()\r | |
1052 | when its parameter Index is IPF_CONTROL_REGISTER_LID\r | |
1053 | \r | |
1054 | @return The 64-bit control register LID.\r | |
1055 | \r | |
1056 | **/\r | |
1057 | UINT64\r | |
1058 | EFIAPI\r | |
1059 | AsmReadControlRegisterLid (\r | |
1060 | VOID\r | |
1061 | );\r | |
1062 | \r | |
1063 | \r | |
1064 | /**\r | |
1065 | Reads control register IVR.\r | |
1066 | \r | |
1067 | This is a worker function for AsmReadControlRegister()\r | |
1068 | when its parameter Index is IPF_CONTROL_REGISTER_IVR\r | |
1069 | \r | |
1070 | @return The 64-bit control register IVR.\r | |
1071 | \r | |
1072 | **/\r | |
1073 | UINT64\r | |
1074 | EFIAPI\r | |
1075 | AsmReadControlRegisterIvr (\r | |
1076 | VOID\r | |
1077 | );\r | |
1078 | \r | |
1079 | \r | |
1080 | /**\r | |
1081 | Reads control register TPR.\r | |
1082 | \r | |
1083 | This is a worker function for AsmReadControlRegister()\r | |
1084 | when its parameter Index is IPF_CONTROL_REGISTER_TPR\r | |
1085 | \r | |
1086 | @return The 64-bit control register TPR.\r | |
1087 | \r | |
1088 | **/\r | |
1089 | UINT64\r | |
1090 | EFIAPI\r | |
1091 | AsmReadControlRegisterTpr (\r | |
1092 | VOID\r | |
1093 | );\r | |
1094 | \r | |
1095 | \r | |
1096 | /**\r | |
1097 | Reads control register EOI.\r | |
1098 | \r | |
1099 | This is a worker function for AsmReadControlRegister()\r | |
1100 | when its parameter Index is IPF_CONTROL_REGISTER_EOI\r | |
1101 | \r | |
1102 | @return The 64-bit control register EOI.\r | |
1103 | \r | |
1104 | **/\r | |
1105 | UINT64\r | |
1106 | EFIAPI\r | |
1107 | AsmReadControlRegisterEoi (\r | |
1108 | VOID\r | |
1109 | );\r | |
1110 | \r | |
1111 | \r | |
1112 | /**\r | |
1113 | Reads control register IRR0.\r | |
1114 | \r | |
1115 | This is a worker function for AsmReadControlRegister()\r | |
1116 | when its parameter Index is IPF_CONTROL_REGISTER_IRR0\r | |
1117 | \r | |
1118 | @return The 64-bit control register IRR0.\r | |
1119 | \r | |
1120 | **/\r | |
1121 | UINT64\r | |
1122 | EFIAPI\r | |
1123 | AsmReadControlRegisterIrr0 (\r | |
1124 | VOID\r | |
1125 | );\r | |
1126 | \r | |
1127 | \r | |
1128 | /**\r | |
1129 | Reads control register IRR1.\r | |
1130 | \r | |
1131 | This is a worker function for AsmReadControlRegister()\r | |
1132 | when its parameter Index is IPF_CONTROL_REGISTER_IRR1\r | |
1133 | \r | |
1134 | @return The 64-bit control register IRR1.\r | |
1135 | \r | |
1136 | **/\r | |
1137 | UINT64\r | |
1138 | EFIAPI\r | |
1139 | AsmReadControlRegisterIrr1 (\r | |
1140 | VOID\r | |
1141 | );\r | |
1142 | \r | |
1143 | \r | |
1144 | /**\r | |
1145 | Reads control register IRR2.\r | |
1146 | \r | |
1147 | This is a worker function for AsmReadControlRegister()\r | |
1148 | when its parameter Index is IPF_CONTROL_REGISTER_IRR2\r | |
1149 | \r | |
1150 | @return The 64-bit control register IRR2.\r | |
1151 | \r | |
1152 | **/\r | |
1153 | UINT64\r | |
1154 | EFIAPI\r | |
1155 | AsmReadControlRegisterIrr2 (\r | |
1156 | VOID\r | |
1157 | );\r | |
1158 | \r | |
1159 | \r | |
1160 | /**\r | |
1161 | Reads control register IRR3.\r | |
1162 | \r | |
1163 | This is a worker function for AsmReadControlRegister()\r | |
1164 | when its parameter Index is IPF_CONTROL_REGISTER_IRR3\r | |
1165 | \r | |
1166 | @return The 64-bit control register IRR3.\r | |
1167 | \r | |
1168 | **/\r | |
1169 | UINT64\r | |
1170 | EFIAPI\r | |
1171 | AsmReadControlRegisterIrr3 (\r | |
1172 | VOID\r | |
1173 | );\r | |
1174 | \r | |
1175 | \r | |
1176 | /**\r | |
1177 | Reads control register ITV.\r | |
1178 | \r | |
1179 | This is a worker function for AsmReadControlRegister()\r | |
1180 | when its parameter Index is IPF_CONTROL_REGISTER_ITV\r | |
1181 | \r | |
1182 | @return The 64-bit control register ITV.\r | |
1183 | \r | |
1184 | **/\r | |
1185 | UINT64\r | |
1186 | EFIAPI\r | |
1187 | AsmReadControlRegisterItv (\r | |
1188 | VOID\r | |
1189 | );\r | |
1190 | \r | |
1191 | \r | |
1192 | /**\r | |
1193 | Reads control register PMV.\r | |
1194 | \r | |
1195 | This is a worker function for AsmReadControlRegister()\r | |
1196 | when its parameter Index is IPF_CONTROL_REGISTER_PMV\r | |
1197 | \r | |
1198 | @return The 64-bit control register PMV.\r | |
1199 | \r | |
1200 | **/\r | |
1201 | UINT64\r | |
1202 | EFIAPI\r | |
1203 | AsmReadControlRegisterPmv (\r | |
1204 | VOID\r | |
1205 | );\r | |
1206 | \r | |
1207 | \r | |
1208 | /**\r | |
1209 | Reads control register CMCV.\r | |
1210 | \r | |
1211 | This is a worker function for AsmReadControlRegister()\r | |
1212 | when its parameter Index is IPF_CONTROL_REGISTER_CMCV\r | |
1213 | \r | |
1214 | @return The 64-bit control register CMCV.\r | |
1215 | \r | |
1216 | **/\r | |
1217 | UINT64\r | |
1218 | EFIAPI\r | |
1219 | AsmReadControlRegisterCmcv (\r | |
1220 | VOID\r | |
1221 | );\r | |
1222 | \r | |
1223 | \r | |
1224 | /**\r | |
1225 | Reads control register LRR0.\r | |
1226 | \r | |
1227 | This is a worker function for AsmReadControlRegister()\r | |
1228 | when its parameter Index is IPF_CONTROL_REGISTER_LRR0\r | |
1229 | \r | |
1230 | @return The 64-bit control register LRR0.\r | |
1231 | \r | |
1232 | **/\r | |
1233 | UINT64\r | |
1234 | EFIAPI\r | |
1235 | AsmReadControlRegisterLrr0 (\r | |
1236 | VOID\r | |
1237 | );\r | |
1238 | \r | |
1239 | \r | |
1240 | /**\r | |
1241 | Reads control register LRR1.\r | |
1242 | \r | |
1243 | This is a worker function for AsmReadControlRegister()\r | |
1244 | when its parameter Index is IPF_CONTROL_REGISTER_LRR1\r | |
1245 | \r | |
1246 | @return The 64-bit control register LRR1.\r | |
1247 | \r | |
1248 | **/\r | |
1249 | UINT64\r | |
1250 | EFIAPI\r | |
1251 | AsmReadControlRegisterLrr1 (\r | |
1252 | VOID\r | |
1253 | );\r | |
1254 | \r | |
1255 | \r | |
1256 | /**\r | |
1257 | Reads application register K0.\r | |
1258 | \r | |
1259 | This is a worker function for AsmReadApplicationRegister()\r | |
1260 | when its parameter Index is IPF_APPLICATION_REGISTER_K0\r | |
1261 | \r | |
1262 | @return The 64-bit application register K0.\r | |
1263 | \r | |
1264 | **/\r | |
1265 | UINT64\r | |
1266 | EFIAPI\r | |
1267 | AsmReadApplicationRegisterK0 (\r | |
1268 | VOID\r | |
1269 | );\r | |
1270 | \r | |
1271 | \r | |
1272 | \r | |
1273 | /**\r | |
1274 | Reads application register K1.\r | |
1275 | \r | |
1276 | This is a worker function for AsmReadApplicationRegister()\r | |
1277 | when its parameter Index is IPF_APPLICATION_REGISTER_K1\r | |
1278 | \r | |
1279 | @return The 64-bit application register K1.\r | |
1280 | \r | |
1281 | **/\r | |
1282 | UINT64\r | |
1283 | EFIAPI\r | |
1284 | AsmReadApplicationRegisterK1 (\r | |
1285 | VOID\r | |
1286 | );\r | |
1287 | \r | |
1288 | \r | |
1289 | /**\r | |
1290 | Reads application register K2.\r | |
1291 | \r | |
1292 | This is a worker function for AsmReadApplicationRegister()\r | |
1293 | when its parameter Index is IPF_APPLICATION_REGISTER_K2\r | |
1294 | \r | |
1295 | @return The 64-bit application register K2.\r | |
1296 | \r | |
1297 | **/\r | |
1298 | UINT64\r | |
1299 | EFIAPI\r | |
1300 | AsmReadApplicationRegisterK2 (\r | |
1301 | VOID\r | |
1302 | );\r | |
1303 | \r | |
1304 | \r | |
1305 | /**\r | |
1306 | Reads application register K3.\r | |
1307 | \r | |
1308 | This is a worker function for AsmReadApplicationRegister()\r | |
1309 | when its parameter Index is IPF_APPLICATION_REGISTER_K3\r | |
1310 | \r | |
1311 | @return The 64-bit application register K3.\r | |
1312 | \r | |
1313 | **/\r | |
1314 | UINT64\r | |
1315 | EFIAPI\r | |
1316 | AsmReadApplicationRegisterK3 (\r | |
1317 | VOID\r | |
1318 | );\r | |
1319 | \r | |
1320 | \r | |
1321 | /**\r | |
1322 | Reads application register K4.\r | |
1323 | \r | |
1324 | This is a worker function for AsmReadApplicationRegister()\r | |
1325 | when its parameter Index is IPF_APPLICATION_REGISTER_K4\r | |
1326 | \r | |
1327 | @return The 64-bit application register K4.\r | |
1328 | \r | |
1329 | **/\r | |
1330 | UINT64\r | |
1331 | EFIAPI\r | |
1332 | AsmReadApplicationRegisterK4 (\r | |
1333 | VOID\r | |
1334 | );\r | |
1335 | \r | |
1336 | \r | |
1337 | /**\r | |
1338 | Reads application register K5.\r | |
1339 | \r | |
1340 | This is a worker function for AsmReadApplicationRegister()\r | |
1341 | when its parameter Index is IPF_APPLICATION_REGISTER_K5\r | |
1342 | \r | |
1343 | @return The 64-bit application register K5.\r | |
1344 | \r | |
1345 | **/\r | |
1346 | UINT64\r | |
1347 | EFIAPI\r | |
1348 | AsmReadApplicationRegisterK5 (\r | |
1349 | VOID\r | |
1350 | );\r | |
1351 | \r | |
1352 | \r | |
1353 | /**\r | |
1354 | Reads application register K6.\r | |
1355 | \r | |
1356 | This is a worker function for AsmReadApplicationRegister()\r | |
1357 | when its parameter Index is IPF_APPLICATION_REGISTER_K6\r | |
1358 | \r | |
1359 | @return The 64-bit application register K6.\r | |
1360 | \r | |
1361 | **/\r | |
1362 | UINT64\r | |
1363 | EFIAPI\r | |
1364 | AsmReadApplicationRegisterK6 (\r | |
1365 | VOID\r | |
1366 | );\r | |
1367 | \r | |
1368 | \r | |
1369 | /**\r | |
1370 | Reads application register K7.\r | |
1371 | \r | |
1372 | This is a worker function for AsmReadApplicationRegister()\r | |
1373 | when its parameter Index is IPF_APPLICATION_REGISTER_K7\r | |
1374 | \r | |
1375 | @return The 64-bit application register K7.\r | |
1376 | \r | |
1377 | **/\r | |
1378 | UINT64\r | |
1379 | EFIAPI\r | |
1380 | AsmReadApplicationRegisterK7 (\r | |
1381 | VOID\r | |
1382 | );\r | |
1383 | \r | |
1384 | \r | |
1385 | /**\r | |
1386 | Reads application register RSC.\r | |
1387 | \r | |
1388 | This is a worker function for AsmReadApplicationRegister()\r | |
1389 | when its parameter Index is IPF_APPLICATION_REGISTER_RSC\r | |
1390 | \r | |
1391 | @return The 64-bit application register RSC.\r | |
1392 | \r | |
1393 | **/\r | |
1394 | UINT64\r | |
1395 | EFIAPI\r | |
1396 | AsmReadApplicationRegisterRsc (\r | |
1397 | VOID\r | |
1398 | );\r | |
1399 | \r | |
1400 | \r | |
1401 | /**\r | |
1402 | Reads application register BSP.\r | |
1403 | \r | |
1404 | This is a worker function for AsmReadApplicationRegister()\r | |
1405 | when its parameter Index is IPF_APPLICATION_REGISTER_BSP\r | |
1406 | \r | |
1407 | @return The 64-bit application register BSP.\r | |
1408 | \r | |
1409 | **/\r | |
1410 | UINT64\r | |
1411 | EFIAPI\r | |
1412 | AsmReadApplicationRegisterBsp (\r | |
1413 | VOID\r | |
1414 | );\r | |
1415 | \r | |
1416 | \r | |
1417 | /**\r | |
1418 | Reads application register BSPSTORE.\r | |
1419 | \r | |
1420 | This is a worker function for AsmReadApplicationRegister()\r | |
1421 | when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE\r | |
1422 | \r | |
1423 | @return The 64-bit application register BSPSTORE.\r | |
1424 | \r | |
1425 | **/\r | |
1426 | UINT64\r | |
1427 | EFIAPI\r | |
1428 | AsmReadApplicationRegisterBspstore (\r | |
1429 | VOID\r | |
1430 | );\r | |
1431 | \r | |
1432 | \r | |
1433 | /**\r | |
1434 | Reads application register RNAT.\r | |
1435 | \r | |
1436 | This is a worker function for AsmReadApplicationRegister()\r | |
1437 | when its parameter Index is IPF_APPLICATION_REGISTER_RNAT\r | |
1438 | \r | |
1439 | @return The 64-bit application register RNAT.\r | |
1440 | \r | |
1441 | **/\r | |
1442 | UINT64\r | |
1443 | EFIAPI\r | |
1444 | AsmReadApplicationRegisterRnat (\r | |
1445 | VOID\r | |
1446 | );\r | |
1447 | \r | |
1448 | \r | |
1449 | /**\r | |
1450 | Reads application register FCR.\r | |
1451 | \r | |
1452 | This is a worker function for AsmReadApplicationRegister()\r | |
1453 | when its parameter Index is IPF_APPLICATION_REGISTER_FCR\r | |
1454 | \r | |
1455 | @return The 64-bit application register FCR.\r | |
1456 | \r | |
1457 | **/\r | |
1458 | UINT64\r | |
1459 | EFIAPI\r | |
1460 | AsmReadApplicationRegisterFcr (\r | |
1461 | VOID\r | |
1462 | );\r | |
1463 | \r | |
1464 | \r | |
1465 | /**\r | |
1466 | Reads application register EFLAG.\r | |
1467 | \r | |
1468 | This is a worker function for AsmReadApplicationRegister()\r | |
1469 | when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG\r | |
1470 | \r | |
1471 | @return The 64-bit application register EFLAG.\r | |
1472 | \r | |
1473 | **/\r | |
1474 | UINT64\r | |
1475 | EFIAPI\r | |
1476 | AsmReadApplicationRegisterEflag (\r | |
1477 | VOID\r | |
1478 | );\r | |
1479 | \r | |
1480 | \r | |
1481 | /**\r | |
1482 | Reads application register CSD.\r | |
1483 | \r | |
1484 | This is a worker function for AsmReadApplicationRegister()\r | |
1485 | when its parameter Index is IPF_APPLICATION_REGISTER_CSD\r | |
1486 | \r | |
1487 | @return The 64-bit application register CSD.\r | |
1488 | \r | |
1489 | **/\r | |
1490 | UINT64\r | |
1491 | EFIAPI\r | |
1492 | AsmReadApplicationRegisterCsd (\r | |
1493 | VOID\r | |
1494 | );\r | |
1495 | \r | |
1496 | \r | |
1497 | /**\r | |
1498 | Reads application register SSD.\r | |
1499 | \r | |
1500 | This is a worker function for AsmReadApplicationRegister()\r | |
1501 | when its parameter Index is IPF_APPLICATION_REGISTER_SSD\r | |
1502 | \r | |
1503 | @return The 64-bit application register SSD.\r | |
1504 | \r | |
1505 | **/\r | |
1506 | UINT64\r | |
1507 | EFIAPI\r | |
1508 | AsmReadApplicationRegisterSsd (\r | |
1509 | VOID\r | |
1510 | );\r | |
1511 | \r | |
1512 | \r | |
1513 | /**\r | |
1514 | Reads application register CFLG.\r | |
1515 | \r | |
1516 | This is a worker function for AsmReadApplicationRegister()\r | |
1517 | when its parameter Index is IPF_APPLICATION_REGISTER_CFLG\r | |
1518 | \r | |
1519 | @return The 64-bit application register CFLG.\r | |
1520 | \r | |
1521 | **/\r | |
1522 | UINT64\r | |
1523 | EFIAPI\r | |
1524 | AsmReadApplicationRegisterCflg (\r | |
1525 | VOID\r | |
1526 | );\r | |
1527 | \r | |
1528 | \r | |
1529 | /**\r | |
1530 | Reads application register FSR.\r | |
1531 | \r | |
1532 | This is a worker function for AsmReadApplicationRegister()\r | |
1533 | when its parameter Index is IPF_APPLICATION_REGISTER_FSR\r | |
1534 | \r | |
1535 | @return The 64-bit application register FSR.\r | |
1536 | \r | |
1537 | **/\r | |
1538 | UINT64\r | |
1539 | EFIAPI\r | |
1540 | AsmReadApplicationRegisterFsr (\r | |
1541 | VOID\r | |
1542 | );\r | |
1543 | \r | |
1544 | \r | |
1545 | /**\r | |
1546 | Reads application register FIR.\r | |
1547 | \r | |
1548 | This is a worker function for AsmReadApplicationRegister()\r | |
1549 | when its parameter Index is IPF_APPLICATION_REGISTER_FIR\r | |
1550 | \r | |
1551 | @return The 64-bit application register FIR.\r | |
1552 | \r | |
1553 | **/\r | |
1554 | UINT64\r | |
1555 | EFIAPI\r | |
1556 | AsmReadApplicationRegisterFir (\r | |
1557 | VOID\r | |
1558 | );\r | |
1559 | \r | |
1560 | \r | |
1561 | /**\r | |
1562 | Reads application register FDR.\r | |
1563 | \r | |
1564 | This is a worker function for AsmReadApplicationRegister()\r | |
1565 | when its parameter Index is IPF_APPLICATION_REGISTER_FDR\r | |
1566 | \r | |
1567 | @return The 64-bit application register FDR.\r | |
1568 | \r | |
1569 | **/\r | |
1570 | UINT64\r | |
1571 | EFIAPI\r | |
1572 | AsmReadApplicationRegisterFdr (\r | |
1573 | VOID\r | |
1574 | );\r | |
1575 | \r | |
1576 | \r | |
1577 | /**\r | |
1578 | Reads application register CCV.\r | |
1579 | \r | |
1580 | This is a worker function for AsmReadApplicationRegister()\r | |
1581 | when its parameter Index is IPF_APPLICATION_REGISTER_CCV\r | |
1582 | \r | |
1583 | @return The 64-bit application register CCV.\r | |
1584 | \r | |
1585 | **/\r | |
1586 | UINT64\r | |
1587 | EFIAPI\r | |
1588 | AsmReadApplicationRegisterCcv (\r | |
1589 | VOID\r | |
1590 | );\r | |
1591 | \r | |
1592 | \r | |
1593 | /**\r | |
1594 | Reads application register UNAT.\r | |
1595 | \r | |
1596 | This is a worker function for AsmReadApplicationRegister()\r | |
1597 | when its parameter Index is IPF_APPLICATION_REGISTER_UNAT\r | |
1598 | \r | |
1599 | @return The 64-bit application register UNAT.\r | |
1600 | \r | |
1601 | **/\r | |
1602 | UINT64\r | |
1603 | EFIAPI\r | |
1604 | AsmReadApplicationRegisterUnat (\r | |
1605 | VOID\r | |
1606 | );\r | |
1607 | \r | |
1608 | \r | |
1609 | /**\r | |
1610 | Reads application register FPSR.\r | |
1611 | \r | |
1612 | This is a worker function for AsmReadApplicationRegister()\r | |
1613 | when its parameter Index is IPF_APPLICATION_REGISTER_FPSR\r | |
1614 | \r | |
1615 | @return The 64-bit application register FPSR.\r | |
1616 | \r | |
1617 | **/\r | |
1618 | UINT64\r | |
1619 | EFIAPI\r | |
1620 | AsmReadApplicationRegisterFpsr (\r | |
1621 | VOID\r | |
1622 | );\r | |
1623 | \r | |
1624 | \r | |
1625 | /**\r | |
1626 | Reads application register ITC.\r | |
1627 | \r | |
1628 | This is a worker function for AsmReadApplicationRegister()\r | |
1629 | when its parameter Index is IPF_APPLICATION_REGISTER_ITC\r | |
1630 | \r | |
1631 | @return The 64-bit application register ITC.\r | |
1632 | \r | |
1633 | **/\r | |
1634 | UINT64\r | |
1635 | EFIAPI\r | |
1636 | AsmReadApplicationRegisterItc (\r | |
1637 | VOID\r | |
1638 | );\r | |
1639 | \r | |
1640 | \r | |
1641 | /**\r | |
1642 | Reads application register PFS.\r | |
1643 | \r | |
1644 | This is a worker function for AsmReadApplicationRegister()\r | |
1645 | when its parameter Index is IPF_APPLICATION_REGISTER_PFS\r | |
1646 | \r | |
1647 | @return The 64-bit application register PFS.\r | |
1648 | \r | |
1649 | **/\r | |
1650 | UINT64\r | |
1651 | EFIAPI\r | |
1652 | AsmReadApplicationRegisterPfs (\r | |
1653 | VOID\r | |
1654 | );\r | |
1655 | \r | |
1656 | \r | |
1657 | /**\r | |
1658 | Reads application register LC.\r | |
1659 | \r | |
1660 | This is a worker function for AsmReadApplicationRegister()\r | |
1661 | when its parameter Index is IPF_APPLICATION_REGISTER_LC\r | |
1662 | \r | |
1663 | @return The 64-bit application register LC.\r | |
1664 | \r | |
1665 | **/\r | |
1666 | UINT64\r | |
1667 | EFIAPI\r | |
1668 | AsmReadApplicationRegisterLc (\r | |
1669 | VOID\r | |
1670 | );\r | |
1671 | \r | |
1672 | \r | |
1673 | /**\r | |
1674 | Reads application register EC.\r | |
1675 | \r | |
1676 | This is a worker function for AsmReadApplicationRegister()\r | |
1677 | when its parameter Index is IPF_APPLICATION_REGISTER_EC\r | |
1678 | \r | |
1679 | @return The 64-bit application register EC.\r | |
1680 | \r | |
1681 | **/\r | |
1682 | UINT64\r | |
1683 | EFIAPI\r | |
1684 | AsmReadApplicationRegisterEc (\r | |
1685 | VOID\r | |
1686 | );\r | |
1687 | \r | |
1688 | \r | |
1689 | \r | |
1690 | /**\r | |
1691 | Transfers control to a function starting with a new stack.\r | |
1692 | \r | |
1693 | Transfers control to the function specified by EntryPoint using the new stack\r | |
1694 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
1695 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
1696 | EntryPoint must never return.\r | |
1697 | \r | |
1698 | If EntryPoint is NULL, then ASSERT().\r | |
1699 | If NewStack is NULL, then ASSERT().\r | |
1700 | \r | |
1701 | @param EntryPoint A pointer to function to call with the new stack.\r | |
1702 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
1703 | function.\r | |
1704 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
1705 | function.\r | |
1706 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
1707 | function.\r | |
1708 | @param NewBsp A pointer to the new memory location for RSE backing\r | |
1709 | store.\r | |
1710 | \r | |
1711 | **/\r | |
1712 | VOID\r | |
1713 | EFIAPI\r | |
1714 | AsmSwitchStackAndBackingStore (\r | |
1715 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
1716 | IN VOID *Context1, OPTIONAL\r | |
1717 | IN VOID *Context2, OPTIONAL\r | |
1718 | IN VOID *NewStack,\r | |
1719 | IN VOID *NewBsp\r | |
1720 | );\r | |
1721 | #else\r | |
1722 | \r | |
1723 | #endif\r | |
1724 | \r | |
1725 | #endif\r |