]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | Declaration of internal functions in BaseLib.\r | |
3 | \r | |
4 | Copyright (c) 2006, 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 | Module Name: BaseLibInternals.h\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #ifndef __BASE_LIB_INTERNALS__\r | |
18 | #define __BASE_LIB_INTERNALS__\r | |
19 | \r | |
20 | //\r | |
21 | // Math functions\r | |
22 | //\r | |
23 | \r | |
1ea5ca46 | 24 | /**\r |
25 | Worker functons that shifts a 64-bit integer left between 0 and 63 bits. The low bits\r | |
26 | are filled with zeros. The shifted value is returned.\r | |
27 | \r | |
28 | This function shifts the 64-bit value Operand to the left by Count bits. The\r | |
29 | low Count bits are set to zero. The shifted value is returned.\r | |
30 | \r | |
31 | @param Operand The 64-bit operand to shift left.\r | |
32 | @param Count The number of bits to shift left.\r | |
33 | \r | |
34 | @return Operand << Count\r | |
35 | \r | |
36 | **/\r | |
878ddf1f | 37 | UINT64\r |
38 | EFIAPI\r | |
39 | InternalMathLShiftU64 (\r | |
40 | IN UINT64 Operand,\r | |
41 | IN UINTN Count\r | |
42 | );\r | |
43 | \r | |
1ea5ca46 | 44 | /**\r |
45 | Worker functon that shifts a 64-bit integer right between 0 and 63 bits. This high bits \r | |
46 | are filled with zeros. The shifted value is returned.\r | |
47 | \r | |
48 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
49 | high Count bits are set to zero. The shifted value is returned.\r | |
50 | \r | |
51 | @param Operand The 64-bit operand to shift right.\r | |
52 | @param Count The number of bits to shift right.\r | |
53 | \r | |
54 | @return Operand >> Count\r | |
55 | \r | |
56 | **/\r | |
878ddf1f | 57 | UINT64\r |
58 | EFIAPI\r | |
59 | InternalMathRShiftU64 (\r | |
60 | IN UINT64 Operand,\r | |
61 | IN UINTN Count\r | |
62 | );\r | |
63 | \r | |
1ea5ca46 | 64 | /**\r |
65 | Worker function that shifts a 64-bit integer right between 0 and 63 bits. The high bits\r | |
66 | are filled with original integer's bit 63. The shifted value is returned.\r | |
67 | \r | |
68 | This function shifts the 64-bit value Operand to the right by Count bits. The\r | |
69 | high Count bits are set to bit 63 of Operand. The shifted value is returned.\r | |
70 | \r | |
71 | @param Operand The 64-bit operand to shift right.\r | |
72 | @param Count The number of bits to shift right.\r | |
73 | \r | |
74 | @return Operand arithmetically shifted right by Count\r | |
75 | \r | |
76 | **/\r | |
878ddf1f | 77 | UINT64\r |
78 | EFIAPI\r | |
79 | InternalMathARShiftU64 (\r | |
80 | IN UINT64 Operand,\r | |
81 | IN UINTN Count\r | |
82 | );\r | |
83 | \r | |
1ea5ca46 | 84 | /**\r |
85 | Worker function that rotates a 64-bit integer left between 0 and 63 bits, filling \r | |
86 | the low bits with the high bits that were rotated.\r | |
87 | \r | |
88 | This function rotates the 64-bit value Operand to the left by Count bits. The\r | |
89 | low Count bits are fill with the high Count bits of Operand. The rotated\r | |
90 | value is returned.\r | |
91 | \r | |
92 | @param Operand The 64-bit operand to rotate left.\r | |
93 | @param Count The number of bits to rotate left.\r | |
94 | \r | |
95 | @return Operand <<< Count\r | |
96 | \r | |
97 | **/\r | |
878ddf1f | 98 | UINT64\r |
99 | EFIAPI\r | |
100 | InternalMathLRotU64 (\r | |
101 | IN UINT64 Operand,\r | |
102 | IN UINTN Count\r | |
103 | );\r | |
104 | \r | |
1ea5ca46 | 105 | /**\r |
106 | Worker function that rotates a 64-bit integer right between 0 and 63 bits, filling\r | |
107 | the high bits with the high low bits that were rotated.\r | |
108 | \r | |
109 | This function rotates the 64-bit value Operand to the right by Count bits.\r | |
110 | The high Count bits are fill with the low Count bits of Operand. The rotated\r | |
111 | value is returned.\r | |
112 | \r | |
113 | @param Operand The 64-bit operand to rotate right.\r | |
114 | @param Count The number of bits to rotate right.\r | |
115 | \r | |
116 | @return Operand >>> Count\r | |
117 | \r | |
118 | **/\r | |
878ddf1f | 119 | UINT64\r |
120 | EFIAPI\r | |
121 | InternalMathRRotU64 (\r | |
122 | IN UINT64 Operand,\r | |
123 | IN UINTN Count\r | |
124 | );\r | |
125 | \r | |
1ea5ca46 | 126 | /**\r |
127 | Worker function that switches the endianess of a 64-bit integer.\r | |
128 | \r | |
129 | This function swaps the bytes in a 64-bit unsigned value to switch the value\r | |
130 | from little endian to big endian or vice versa. The byte swapped value is\r | |
131 | returned.\r | |
132 | \r | |
133 | @param Operand A 64-bit unsigned value.\r | |
134 | \r | |
135 | @return The byte swaped Operand.\r | |
136 | \r | |
137 | **/\r | |
878ddf1f | 138 | UINT64\r |
139 | EFIAPI\r | |
140 | InternalMathSwapBytes64 (\r | |
141 | IN UINT64 Operand\r | |
142 | );\r | |
143 | \r | |
1ea5ca46 | 144 | /**\r |
145 | Worker function that multiples a 64-bit unsigned integer by a 32-bit unsigned integer\r | |
146 | and generates a 64-bit unsigned result.\r | |
147 | \r | |
148 | This function multiples the 64-bit unsigned value Multiplicand by the 32-bit\r | |
149 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
150 | bit unsigned result is returned.\r | |
151 | \r | |
152 | @param Multiplicand A 64-bit unsigned value.\r | |
153 | @param Multiplier A 32-bit unsigned value.\r | |
154 | \r | |
155 | @return Multiplicand * Multiplier\r | |
156 | \r | |
157 | **/\r | |
878ddf1f | 158 | UINT64\r |
159 | EFIAPI\r | |
160 | InternalMathMultU64x32 (\r | |
161 | IN UINT64 Multiplicand,\r | |
162 | IN UINT32 Multiplier\r | |
163 | );\r | |
164 | \r | |
1ea5ca46 | 165 | /**\r |
166 | Worker function that multiples a 64-bit unsigned integer by a 64-bit unsigned integer\r | |
167 | and generates a 64-bit unsigned result.\r | |
168 | \r | |
169 | This function multiples the 64-bit unsigned value Multiplicand by the 64-bit\r | |
170 | unsigned value Multiplier and generates a 64-bit unsigned result. This 64-\r | |
171 | bit unsigned result is returned.\r | |
172 | \r | |
173 | @param Multiplicand A 64-bit unsigned value.\r | |
174 | @param Multiplier A 64-bit unsigned value.\r | |
175 | \r | |
176 | @return Multiplicand * Multiplier\r | |
177 | \r | |
178 | **/\r | |
878ddf1f | 179 | UINT64\r |
180 | EFIAPI\r | |
181 | InternalMathMultU64x64 (\r | |
182 | IN UINT64 Multiplicand,\r | |
183 | IN UINT64 Multiplier\r | |
184 | );\r | |
185 | \r | |
1ea5ca46 | 186 | /**\r |
187 | Worker function that divides a 64-bit unsigned integer by a 32-bit unsigned integer and \r | |
188 | generates a 64-bit unsigned result.\r | |
189 | \r | |
190 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
191 | unsigned value Divisor and generates a 64-bit unsigned quotient. This\r | |
192 | function returns the 64-bit unsigned quotient.\r | |
193 | \r | |
194 | @param Dividend A 64-bit unsigned value.\r | |
195 | @param Divisor A 32-bit unsigned value.\r | |
196 | \r | |
197 | @return Dividend / Divisor\r | |
198 | \r | |
199 | **/\r | |
878ddf1f | 200 | UINT64\r |
201 | EFIAPI\r | |
202 | InternalMathDivU64x32 (\r | |
203 | IN UINT64 Dividend,\r | |
204 | IN UINT32 Divisor\r | |
205 | );\r | |
206 | \r | |
1ea5ca46 | 207 | /**\r |
208 | Worker function that divides a 64-bit unsigned integer by a 32-bit unsigned integer and \r | |
209 | generates a 32-bit unsigned remainder.\r | |
210 | \r | |
211 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
212 | unsigned value Divisor and generates a 32-bit remainder. This function\r | |
213 | returns the 32-bit unsigned remainder.\r | |
214 | \r | |
215 | @param Dividend A 64-bit unsigned value.\r | |
216 | @param Divisor A 32-bit unsigned value.\r | |
217 | \r | |
218 | @return Dividend % Divisor\r | |
219 | \r | |
220 | **/\r | |
878ddf1f | 221 | UINT32\r |
222 | EFIAPI\r | |
223 | InternalMathModU64x32 (\r | |
224 | IN UINT64 Dividend,\r | |
225 | IN UINT32 Divisor\r | |
226 | );\r | |
227 | \r | |
1ea5ca46 | 228 | /**\r |
229 | Worker function that divides a 64-bit unsigned integer by a 32-bit unsigned integer and\r | |
230 | generates a 64-bit unsigned result and an optional 32-bit unsigned remainder.\r | |
231 | \r | |
232 | This function divides the 64-bit unsigned value Dividend by the 32-bit\r | |
233 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
234 | is not NULL, then the 32-bit unsigned remainder is returned in Remainder.\r | |
235 | This function returns the 64-bit unsigned quotient.\r | |
236 | \r | |
237 | @param Dividend A 64-bit unsigned value.\r | |
238 | @param Divisor A 32-bit unsigned value.\r | |
239 | @param Remainder A pointer to a 32-bit unsigned value. This parameter is\r | |
240 | optional and may be NULL.\r | |
241 | \r | |
242 | @return Dividend / Divisor\r | |
243 | \r | |
244 | **/\r | |
878ddf1f | 245 | UINT64\r |
246 | EFIAPI\r | |
247 | InternalMathDivRemU64x32 (\r | |
248 | IN UINT64 Dividend,\r | |
249 | IN UINT32 Divisor,\r | |
250 | OUT UINT32 *Remainder\r | |
251 | );\r | |
252 | \r | |
1ea5ca46 | 253 | /**\r |
254 | Worker function that divides a 64-bit unsigned integer by a 64-bit unsigned integer and \r | |
255 | generates a 64-bit unsigned result and an optional 64-bit unsigned remainder.\r | |
256 | \r | |
257 | This function divides the 64-bit unsigned value Dividend by the 64-bit\r | |
258 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
259 | is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r | |
260 | This function returns the 64-bit unsigned quotient.\r | |
261 | \r | |
262 | @param Dividend A 64-bit unsigned value.\r | |
263 | @param Divisor A 64-bit unsigned value.\r | |
264 | @param Remainder A pointer to a 64-bit unsigned value. This parameter is\r | |
265 | optional and may be NULL.\r | |
266 | \r | |
267 | @return Dividend / Divisor\r | |
268 | \r | |
269 | **/\r | |
878ddf1f | 270 | UINT64\r |
271 | EFIAPI\r | |
272 | InternalMathDivRemU64x64 (\r | |
273 | IN UINT64 Dividend,\r | |
274 | IN UINT64 Divisor,\r | |
275 | OUT UINT64 *Remainder\r | |
276 | );\r | |
277 | \r | |
1ea5ca46 | 278 | /**\r |
279 | Worker function that divides a 64-bit signed integer by a 64-bit signed integer and \r | |
280 | generates a 64-bit signed result and a optional 64-bit signed remainder.\r | |
281 | \r | |
282 | This function divides the 64-bit unsigned value Dividend by the 64-bit\r | |
283 | unsigned value Divisor and generates a 64-bit unsigned quotient. If Remainder\r | |
284 | is not NULL, then the 64-bit unsigned remainder is returned in Remainder.\r | |
285 | This function returns the 64-bit unsigned quotient.\r | |
286 | \r | |
287 | @param Dividend A 64-bit signed value.\r | |
288 | @param Divisor A 64-bit signed value.\r | |
289 | @param Remainder A pointer to a 64-bit signed value. This parameter is\r | |
290 | optional and may be NULL.\r | |
291 | \r | |
292 | @return Dividend / Divisor\r | |
293 | \r | |
294 | **/\r | |
878ddf1f | 295 | INT64\r |
878ddf1f | 296 | InternalMathDivRemS64x64 (\r |
297 | IN INT64 Dividend,\r | |
298 | IN INT64 Divisor,\r | |
1ea5ca46 | 299 | OUT INT64 *Remainder OPTIONAL\r |
878ddf1f | 300 | );\r |
301 | \r | |
1ea5ca46 | 302 | /**\r |
303 | Transfers control to a function starting with a new stack.\r | |
304 | \r | |
305 | Transfers control to the function specified by EntryPoint using the new stack\r | |
306 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
307 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
308 | EntryPoint must never return.\r | |
309 | \r | |
310 | @param EntryPoint A pointer to function to call with the new stack.\r | |
311 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
312 | function.\r | |
313 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
314 | function.\r | |
315 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
316 | function.\r | |
317 | \r | |
318 | **/\r | |
7d7c2b46 | 319 | VOID\r |
7d7c2b46 | 320 | InternalSwitchStack (\r |
321 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
322 | IN VOID *Context1,\r | |
323 | IN VOID *Context2,\r | |
324 | IN VOID *NewStack\r | |
325 | );\r | |
326 | \r | |
878ddf1f | 327 | //\r |
328 | // Ia32 and x64 specific functions\r | |
329 | //\r | |
330 | \r | |
1ea5ca46 | 331 | /**\r |
332 | Reads the current Global Descriptor Table Register(GDTR) descriptor.\r | |
333 | \r | |
334 | Reads and returns the current GDTR descriptor and returns it in Gdtr. This\r | |
335 | function is only available on IA-32 and X64.\r | |
336 | \r | |
337 | @param Gdtr Pointer to a GDTR descriptor.\r | |
338 | \r | |
339 | **/\r | |
878ddf1f | 340 | VOID\r |
341 | EFIAPI\r | |
342 | InternalX86ReadGdtr (\r | |
343 | OUT IA32_DESCRIPTOR *Gdtr\r | |
344 | );\r | |
345 | \r | |
1ea5ca46 | 346 | /**\r |
347 | Writes the current Global Descriptor Table Register (GDTR) descriptor.\r | |
348 | \r | |
349 | Writes and the current GDTR descriptor specified by Gdtr. This function is\r | |
350 | only available on IA-32 and X64.\r | |
351 | \r | |
352 | @param Gdtr Pointer to a GDTR descriptor.\r | |
353 | \r | |
354 | **/\r | |
878ddf1f | 355 | VOID\r |
356 | EFIAPI\r | |
357 | InternalX86WriteGdtr (\r | |
358 | IN CONST IA32_DESCRIPTOR *Gdtr\r | |
359 | );\r | |
360 | \r | |
1ea5ca46 | 361 | /**\r |
362 | Reads the current Interrupt Descriptor Table Register(GDTR) descriptor.\r | |
363 | \r | |
364 | Reads and returns the current IDTR descriptor and returns it in Idtr. This\r | |
365 | function is only available on IA-32 and X64.\r | |
366 | \r | |
367 | @param Idtr Pointer to a IDTR descriptor.\r | |
368 | \r | |
369 | **/\r | |
878ddf1f | 370 | VOID\r |
371 | EFIAPI\r | |
372 | InternalX86ReadIdtr (\r | |
373 | OUT IA32_DESCRIPTOR *Idtr\r | |
374 | );\r | |
375 | \r | |
1ea5ca46 | 376 | /**\r |
377 | Writes the current Interrupt Descriptor Table Register(GDTR) descriptor.\r | |
378 | \r | |
379 | Writes the current IDTR descriptor and returns it in Idtr. This function is\r | |
380 | only available on IA-32 and X64.\r | |
381 | \r | |
382 | @param Idtr Pointer to a IDTR descriptor.\r | |
383 | \r | |
384 | **/\r | |
878ddf1f | 385 | VOID\r |
386 | EFIAPI\r | |
387 | InternalX86WriteIdtr (\r | |
388 | IN CONST IA32_DESCRIPTOR *Idtr\r | |
389 | );\r | |
390 | \r | |
1ea5ca46 | 391 | /**\r |
392 | Save the current floating point/SSE/SSE2 context to a buffer.\r | |
393 | \r | |
394 | Saves the current floating point/SSE/SSE2 state to the buffer specified by\r | |
395 | Buffer. Buffer must be aligned on a 16-byte boundary. This function is only\r | |
396 | available on IA-32 and X64.\r | |
397 | \r | |
398 | @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.\r | |
399 | \r | |
400 | **/\r | |
878ddf1f | 401 | VOID\r |
402 | EFIAPI\r | |
403 | InternalX86FxSave (\r | |
404 | OUT IA32_FX_BUFFER *Buffer\r | |
405 | );\r | |
406 | \r | |
1ea5ca46 | 407 | /**\r |
408 | Restores the current floating point/SSE/SSE2 context from a buffer.\r | |
409 | \r | |
410 | Restores the current floating point/SSE/SSE2 state from the buffer specified\r | |
411 | by Buffer. Buffer must be aligned on a 16-byte boundary. This function is\r | |
412 | only available on IA-32 and X64.\r | |
413 | \r | |
414 | @param Buffer Pointer to a buffer to save the floating point/SSE/SSE2 context.\r | |
415 | \r | |
416 | **/\r | |
878ddf1f | 417 | VOID\r |
418 | EFIAPI\r | |
419 | InternalX86FxRestore (\r | |
420 | IN CONST IA32_FX_BUFFER *Buffer\r | |
421 | );\r | |
422 | \r | |
1ea5ca46 | 423 | /**\r |
424 | Enables the 32-bit paging mode on the CPU.\r | |
425 | \r | |
426 | Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
427 | must be properly initialized prior to calling this service. This function\r | |
428 | assumes the current execution mode is 32-bit protected mode. This function is\r | |
429 | only available on IA-32. After the 32-bit paging mode is enabled, control is\r | |
430 | transferred to the function specified by EntryPoint using the new stack\r | |
431 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
432 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
433 | EntryPoint must never return.\r | |
434 | \r | |
435 | There are a number of constraints that must be followed before calling this\r | |
436 | function:\r | |
437 | 1) Interrupts must be disabled.\r | |
438 | 2) The caller must be in 32-bit protected mode with flat descriptors. This\r | |
439 | means all descriptors must have a base of 0 and a limit of 4GB.\r | |
440 | 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat\r | |
441 | descriptors.\r | |
442 | 4) CR3 must point to valid page tables that will be used once the transition\r | |
443 | is complete, and those page tables must guarantee that the pages for this\r | |
444 | function and the stack are identity mapped.\r | |
445 | \r | |
446 | @param EntryPoint A pointer to function to call with the new stack after\r | |
447 | paging is enabled.\r | |
448 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
449 | function as the first parameter after paging is enabled.\r | |
450 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
451 | function as the second parameter after paging is enabled.\r | |
452 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
453 | function after paging is enabled.\r | |
454 | \r | |
455 | **/\r | |
878ddf1f | 456 | VOID\r |
457 | EFIAPI\r | |
458 | InternalX86EnablePaging32 (\r | |
459 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
460 | IN VOID *Context1, OPTIONAL\r | |
461 | IN VOID *Context2, OPTIONAL\r | |
462 | IN VOID *NewStack\r | |
463 | );\r | |
464 | \r | |
1ea5ca46 | 465 | /**\r |
466 | Disables the 32-bit paging mode on the CPU.\r | |
467 | \r | |
468 | Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r | |
469 | mode. This function assumes the current execution mode is 32-paged protected\r | |
470 | mode. This function is only available on IA-32. After the 32-bit paging mode\r | |
471 | is disabled, control is transferred to the function specified by EntryPoint\r | |
472 | using the new stack specified by NewStack and passing in the parameters\r | |
473 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
474 | may be NULL. The function EntryPoint must never return.\r | |
475 | \r | |
476 | There are a number of constraints that must be followed before calling this\r | |
477 | function:\r | |
478 | 1) Interrupts must be disabled.\r | |
479 | 2) The caller must be in 32-bit paged mode.\r | |
480 | 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r | |
481 | 4) CR3 must point to valid page tables that guarantee that the pages for\r | |
482 | this function and the stack are identity mapped.\r | |
483 | \r | |
484 | @param EntryPoint A pointer to function to call with the new stack after\r | |
485 | paging is disabled.\r | |
486 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
487 | function as the first parameter after paging is disabled.\r | |
488 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
489 | function as the second parameter after paging is\r | |
490 | disabled.\r | |
491 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
492 | function after paging is disabled.\r | |
493 | \r | |
494 | **/\r | |
878ddf1f | 495 | VOID\r |
496 | EFIAPI\r | |
497 | InternalX86DisablePaging32 (\r | |
498 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
499 | IN VOID *Context1, OPTIONAL\r | |
500 | IN VOID *Context2, OPTIONAL\r | |
501 | IN VOID *NewStack\r | |
502 | );\r | |
503 | \r | |
1ea5ca46 | 504 | /**\r |
505 | Enables the 64-bit paging mode on the CPU.\r | |
506 | \r | |
507 | Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
508 | must be properly initialized prior to calling this service. This function\r | |
509 | assumes the current execution mode is 32-bit protected mode with flat\r | |
510 | descriptors. This function is only available on IA-32. After the 64-bit\r | |
511 | paging mode is enabled, control is transferred to the function specified by\r | |
512 | EntryPoint using the new stack specified by NewStack and passing in the\r | |
513 | parameters specified by Context1 and Context2. Context1 and Context2 are\r | |
514 | optional and may be 0. The function EntryPoint must never return.\r | |
515 | \r | |
516 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r | |
517 | is called. The descriptor in the GDT that this selector\r | |
518 | references must be setup for long mode.\r | |
519 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
520 | the new stack after paging is enabled.\r | |
521 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
522 | the EntryPoint function as the first parameter after\r | |
523 | paging is enabled.\r | |
524 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
525 | the EntryPoint function as the second parameter after\r | |
526 | paging is enabled.\r | |
527 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
528 | the EntryPoint function after paging is enabled.\r | |
529 | \r | |
530 | **/\r | |
878ddf1f | 531 | VOID\r |
532 | EFIAPI\r | |
533 | InternalX86EnablePaging64 (\r | |
534 | IN UINT16 Cs,\r | |
535 | IN UINT64 EntryPoint,\r | |
536 | IN UINT64 Context1, OPTIONAL\r | |
537 | IN UINT64 Context2, OPTIONAL\r | |
538 | IN UINT64 NewStack\r | |
539 | );\r | |
540 | \r | |
1ea5ca46 | 541 | /**\r |
542 | Disables the 64-bit paging mode on the CPU.\r | |
543 | \r | |
544 | Disables the 64-bit paging mode on the CPU and returns to 32-bit protected\r | |
545 | mode. This function assumes the current execution mode is 64-paging mode.\r | |
546 | This function is only available on X64. After the 64-bit paging mode is\r | |
547 | disabled, control is transferred to the function specified by EntryPoint\r | |
548 | using the new stack specified by NewStack and passing in the parameters\r | |
549 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
550 | may be 0. The function EntryPoint must never return.\r | |
551 | \r | |
552 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r | |
553 | is called. The descriptor in the GDT that this selector\r | |
554 | references must be setup for 32-bit protected mode.\r | |
555 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
556 | the new stack after paging is disabled.\r | |
557 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
558 | the EntryPoint function as the first parameter after\r | |
559 | paging is disabled.\r | |
560 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
561 | the EntryPoint function as the second parameter after\r | |
562 | paging is disabled.\r | |
563 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
564 | the EntryPoint function after paging is disabled.\r | |
565 | \r | |
566 | **/\r | |
878ddf1f | 567 | VOID\r |
568 | EFIAPI\r | |
569 | InternalX86DisablePaging64 (\r | |
570 | IN UINT16 Cs,\r | |
571 | IN UINT32 EntryPoint,\r | |
572 | IN UINT32 Context1, OPTIONAL\r | |
573 | IN UINT32 Context2, OPTIONAL\r | |
574 | IN UINT32 NewStack\r | |
575 | );\r | |
576 | \r | |
577 | #endif\r |