]>
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 | x86DisablePaging32.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 | Disables the 32-bit paging mode on the CPU.\r | |
27 | \r | |
28 | Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r | |
29 | mode. This function assumes the current execution mode is 32-paged protected\r | |
30 | mode. This function is only available on IA-32. After the 32-bit paging mode\r | |
31 | is disabled, control is transferred to the function specified by EntryPoint\r | |
32 | using the new stack specified by NewStack and passing in the parameters\r | |
33 | specified by Context1 and Context2. Context1 and Context2 are optional and\r | |
34 | may be NULL. The function EntryPoint must never return.\r | |
35 | \r | |
36 | If the current execution mode is not 32-bit paged mode, then ASSERT().\r | |
37 | If EntryPoint is NULL, then ASSERT().\r | |
38 | If NewStack is NULL, then ASSERT().\r | |
39 | \r | |
40 | There are a number of constraints that must be followed before calling this\r | |
41 | function:\r | |
42 | 1) Interrupts must be disabled.\r | |
43 | 2) The caller must be in 32-bit paged mode.\r | |
44 | 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r | |
45 | 4) CR3 must point to valid page tables that guarantee that the pages for\r | |
46 | this function and the stack are identity mapped.\r | |
47 | \r | |
48 | @param EntryPoint A pointer to function to call with the new stack after\r | |
49 | paging is disabled.\r | |
50 | @param Context1 A pointer to the context to pass into the EntryPoint\r | |
51 | function as the first parameter after paging is disabled.\r | |
52 | @param Context2 A pointer to the context to pass into the EntryPoint\r | |
53 | function as the second parameter after paging is\r | |
54 | disabled.\r | |
55 | @param NewStack A pointer to the new stack to use for the EntryPoint\r | |
56 | function after paging is disabled.\r | |
57 | \r | |
58 | **/\r | |
59 | VOID\r | |
60 | EFIAPI\r | |
61 | AsmDisablePaging32 (\r | |
62 | IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r | |
63 | IN VOID *Context1, OPTIONAL\r | |
64 | IN VOID *Context2, OPTIONAL\r | |
65 | IN VOID *NewStack\r | |
66 | )\r | |
67 | {\r | |
68 | ASSERT (EntryPoint != NULL);\r | |
69 | ASSERT (NewStack != NULL);\r | |
70 | InternalX86DisablePaging32 (EntryPoint, Context1, Context2, NewStack);\r | |
71 | }\r |