]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 1 | /** @file\r |
2 | IA-32/x64 AsmEnablePaging64()\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: x86EnablePaging64.c\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | //\r | |
18 | // Include common header file for this module.\r | |
19 | //\r | |
f734a10a | 20 | \r |
e1f414b6 | 21 | \r |
22 | #include "BaseLibInternals.h"\r | |
23 | \r | |
24 | /**\r | |
25 | Enables the 64-bit paging mode on the CPU.\r | |
26 | \r | |
27 | Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
28 | must be properly initialized prior to calling this service. This function\r | |
29 | assumes the current execution mode is 32-bit protected mode with flat\r | |
30 | descriptors. This function is only available on IA-32. After the 64-bit\r | |
31 | paging mode is enabled, control is transferred to the function specified by\r | |
32 | EntryPoint using the new stack specified by NewStack and passing in the\r | |
33 | parameters specified by Context1 and Context2. Context1 and Context2 are\r | |
34 | optional and may be 0. The function EntryPoint must never return.\r | |
35 | \r | |
36 | If the current execution mode is not 32-bit protected mode with flat\r | |
37 | descriptors, then ASSERT().\r | |
38 | If EntryPoint is 0, then ASSERT().\r | |
39 | If NewStack is 0, then ASSERT().\r | |
40 | \r | |
41 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r | |
42 | is called. The descriptor in the GDT that this selector\r | |
43 | references must be setup for long mode.\r | |
44 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
45 | the new stack after paging is enabled.\r | |
46 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
47 | the EntryPoint function as the first parameter after\r | |
48 | paging is enabled.\r | |
49 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
50 | the EntryPoint function as the second parameter after\r | |
51 | paging is enabled.\r | |
52 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
53 | the EntryPoint function after paging is enabled.\r | |
54 | \r | |
55 | **/\r | |
56 | VOID\r | |
57 | EFIAPI\r | |
58 | AsmEnablePaging64 (\r | |
59 | IN UINT16 Cs,\r | |
60 | IN UINT64 EntryPoint,\r | |
61 | IN UINT64 Context1, OPTIONAL\r | |
62 | IN UINT64 Context2, OPTIONAL\r | |
63 | IN UINT64 NewStack\r | |
64 | )\r | |
65 | {\r | |
66 | ASSERT (EntryPoint != 0);\r | |
67 | ASSERT (NewStack != 0);\r | |
68 | InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);\r | |
69 | }\r |