]>
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 | x86EnablePaging32.c\r | |
16 | \r | |
17 | Abstract: \r | |
18 | \r | |
19 | IA-32/x64 specific functions.\r | |
20 | \r | |
21 | --*/\r | |
22 | \r | |
23 | #include "BaseLibInternal.h"\r | |
24 | \r | |
25 | /**\r | |
26 | Enables the 32-bit paging mode on the CPU.\r | |
27 | \r | |
28 | Enables the 32-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. This function is\r | |
31 | only available on IA-32. After the 32-bit paging mode is enabled, control is\r | |
32 | transferred to the function specified by EntryPoint using the new stack\r | |
33 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
34 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
35 | EntryPoint must never return.\r | |
36 | \r | |
37 | If the current execution mode is not 32-bit protected mode, then ASSERT().\r | |
38 | If EntryPoint is NULL, then ASSERT().\r | |
39 | If NewStack is NULL, then ASSERT().\r | |
40 | \r | |
41 | There are a number of constraints that must be followed before calling this\r | |
42 | function:\r | |
43 | 1) Interrupts must be disabled.\r | |
44 | 2) The caller must be in 32-bit protected mode with flat descriptors. This\r | |
45 | means all descriptors must have a base of 0 and a limit of 4GB.\r | |
46 | 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat\r | |
47 | descriptors.\r | |
48 | 4) CR3 must point to valid page tables that will be used once the transition\r | |
49 | is complete, and those page tables must guarantee that the pages for this\r | |
50 | function and the stack are identity mapped.\r | |
51 | \r | |
52 | @param EntryPoint A pointer to function to call with the new stack after\r | |
53 | paging is enabled.\r | |
54 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
55 | function as the first parameter after paging is enabled.\r | |
56 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
57 | function as the second parameter after paging is enabled.\r | |
58 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
59 | function after paging is enabled.\r | |
60 | \r | |
61 | **/\r | |
62 | VOID\r | |
63 | EFIAPI\r | |
64 | AsmEnablePaging32 (\r | |
65 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
66 | IN VOID *Context1, OPTIONAL\r | |
67 | IN VOID *Context2, OPTIONAL\r | |
68 | IN VOID *NewStack\r | |
69 | )\r | |
70 | {\r | |
71 | ASSERT (EntryPoint != NULL);\r | |
72 | ASSERT (NewStack != NULL);\r | |
73 | InternalX86EnablePaging32 (EntryPoint, Context1, Context2, NewStack);\r | |
74 | }\r |