]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Non-existing BaseLib functions on x64\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation\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 | #include <Library/BaseLib.h>\r | |
16 | #include <Library/DebugLib.h>\r | |
17 | \r | |
18 | /**\r | |
19 | Enables the 32-bit paging mode on the CPU.\r | |
20 | \r | |
21 | Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables\r | |
22 | must be properly initialized prior to calling this service. This function\r | |
23 | assumes the current execution mode is 32-bit protected mode. This function is\r | |
24 | only available on IA-32. After the 32-bit paging mode is enabled, control is\r | |
25 | transferred to the function specified by EntryPoint using the new stack\r | |
26 | specified by NewStack and passing in the parameters specified by Context1 and\r | |
27 | Context2. Context1 and Context2 are optional and may be NULL. The function\r | |
28 | EntryPoint must never return.\r | |
29 | \r | |
30 | There are a number of constraints that must be followed before calling this\r | |
31 | function:\r | |
32 | 1) Interrupts must be disabled.\r | |
33 | 2) The caller must be in 32-bit protected mode with flat descriptors. This\r | |
34 | means all descriptors must have a base of 0 and a limit of 4GB.\r | |
35 | 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat\r | |
36 | descriptors.\r | |
37 | 4) CR3 must point to valid page tables that will be used once the transition\r | |
38 | is complete, and those page tables must guarantee that the pages for this\r | |
39 | function and the stack are identity mapped.\r | |
40 | \r | |
41 | @param EntryPoint A pointer to function to call with the new stack after\r | |
42 | paging is enabled.\r | |
43 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
44 | function as the first parameter after paging is enabled.\r | |
45 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
46 | function as the second parameter after paging is enabled.\r | |
47 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
48 | function after paging is enabled.\r | |
49 | \r | |
50 | **/\r | |
51 | VOID\r | |
52 | EFIAPI\r | |
53 | InternalX86EnablePaging32 (\r | |
54 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
55 | IN VOID *Context1, OPTIONAL\r | |
56 | IN VOID *Context2, OPTIONAL\r | |
57 | IN VOID *NewStack\r | |
58 | )\r | |
59 | {\r | |
60 | //\r | |
61 | // This function cannot work on x64 platform\r | |
62 | //\r | |
63 | ASSERT (FALSE);\r | |
64 | }\r | |
65 | \r | |
66 | /**\r | |
67 | Disables the 32-bit paging mode on the CPU.\r | |
68 | \r | |
69 | Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r | |
70 | mode. This function assumes the current execution mode is 32-paged protected\r | |
71 | mode. This function is only available on IA-32. After the 32-bit paging mode\r | |
72 | is disabled, control is transferred to the function specified by EntryPoint\r | |
73 | using the new stack specified by NewStack and passing in the parameters\r | |
74 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
75 | may be NULL. The function EntryPoint must never return.\r | |
76 | \r | |
77 | There are a number of constraints that must be followed before calling this\r | |
78 | function:\r | |
79 | 1) Interrupts must be disabled.\r | |
80 | 2) The caller must be in 32-bit paged mode.\r | |
81 | 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r | |
82 | 4) CR3 must point to valid page tables that guarantee that the pages for\r | |
83 | this function and the stack are identity mapped.\r | |
84 | \r | |
85 | @param EntryPoint A pointer to function to call with the new stack after\r | |
86 | paging is disabled.\r | |
87 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
88 | function as the first parameter after paging is disabled.\r | |
89 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
90 | function as the second parameter after paging is\r | |
91 | disabled.\r | |
92 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
93 | function after paging is disabled.\r | |
94 | \r | |
95 | **/\r | |
96 | VOID\r | |
97 | EFIAPI\r | |
98 | InternalX86DisablePaging32 (\r | |
99 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
100 | IN VOID *Context1, OPTIONAL\r | |
101 | IN VOID *Context2, OPTIONAL\r | |
102 | IN VOID *NewStack\r | |
103 | )\r | |
104 | {\r | |
105 | //\r | |
106 | // This function cannot work on x64 platform\r | |
107 | //\r | |
108 | ASSERT (FALSE);\r | |
109 | }\r |