]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004 - 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | \r | |
13 | Module Name:\r | |
14 | \r | |
15 | x86EnablePaging64.c\r | |
16 | \r | |
17 | Abstract: \r | |
18 | \r | |
19 | IA-32/x64 specific functions.\r | |
20 | \r | |
21 | --*/\r | |
22 | \r | |
c7f33ca4 | 23 | #include "BaseLibInternals.h"\r |
3eb9473e | 24 | \r |
25 | /**\r | |
26 | Enables the 64-bit paging mode on the CPU.\r | |
27 | \r | |
28 | Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
29 | must be properly initialized prior to calling this service. This function\r | |
30 | assumes the current execution mode is 32-bit protected mode with flat\r | |
31 | descriptors. This function is only available on IA-32. After the 64-bit\r | |
32 | paging mode is enabled, control is transferred to the function specified by\r | |
33 | EntryPoint using the new stack specified by NewStack and passing in the\r | |
34 | parameters specified by Context1 and Context2. Context1 and Context2 are\r | |
35 | optional and may be 0. The function EntryPoint must never return.\r | |
36 | \r | |
37 | If the current execution mode is not 32-bit protected mode with flat\r | |
38 | descriptors, then ASSERT().\r | |
39 | If EntryPoint is 0, then ASSERT().\r | |
40 | If NewStack is 0, then ASSERT().\r | |
41 | \r | |
42 | @param Cs The 16-bit selector to load in the CS before EntryPoint\r | |
43 | is called. The descriptor in the GDT that this selector\r | |
44 | references must be setup for long mode.\r | |
45 | @param EntryPoint The 64-bit virtual address of the function to call with\r | |
46 | the new stack after paging is enabled.\r | |
47 | @param Context1 The 64-bit virtual address of the context to pass into\r | |
48 | the EntryPoint function as the first parameter after\r | |
49 | paging is enabled.\r | |
50 | @param Context2 The 64-bit virtual address of the context to pass into\r | |
51 | the EntryPoint function as the second parameter after\r | |
52 | paging is enabled.\r | |
53 | @param NewStack The 64-bit virtual address of the new stack to use for\r | |
54 | the EntryPoint function after paging is enabled.\r | |
55 | \r | |
56 | **/\r | |
57 | VOID\r | |
58 | EFIAPI\r | |
59 | AsmEnablePaging64 (\r | |
60 | IN UINT16 Cs,\r | |
61 | IN UINT64 EntryPoint,\r | |
62 | IN UINT64 Context1, OPTIONAL\r | |
63 | IN UINT64 Context2, OPTIONAL\r | |
64 | IN UINT64 NewStack\r | |
65 | )\r | |
66 | {\r | |
67 | ASSERT (EntryPoint != 0);\r | |
68 | ASSERT (NewStack != 0);\r | |
69 | InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);\r | |
70 | }\r |