]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/X86DisablePaging32.c
MdePkg/BaseLib: Add bit field population calculating methods
[mirror_edk2.git] / MdePkg / Library / BaseLib / X86DisablePaging32.c
CommitLineData
e1f414b6 1/** @file\r
2 IA-32/x64 AsmDisablePaging32()\r
3\r
bb817c56
HT
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
e1f414b6 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
127010dd 8 http://opensource.org/licenses/bsd-license.php.\r
e1f414b6 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
e1f414b6 13**/\r
14\r
1efcc4ae 15\r
f734a10a 16\r
e1f414b6 17\r
18#include "BaseLibInternals.h"\r
19\r
20/**\r
21 Disables the 32-bit paging mode on the CPU.\r
22\r
23 Disables the 32-bit paging mode on the CPU and returns to 32-bit protected\r
24 mode. This function assumes the current execution mode is 32-paged protected\r
25 mode. This function is only available on IA-32. After the 32-bit paging mode\r
26 is disabled, control is transferred to the function specified by EntryPoint\r
27 using the new stack specified by NewStack and passing in the parameters\r
28 specified by Context1 and Context2. Context1 and Context2 are optional and\r
29 may be NULL. The function EntryPoint must never return.\r
30\r
31 If the current execution mode is not 32-bit paged mode, then ASSERT().\r
32 If EntryPoint is NULL, then ASSERT().\r
33 If NewStack is NULL, then ASSERT().\r
34\r
35 There are a number of constraints that must be followed before calling this\r
36 function:\r
37 1) Interrupts must be disabled.\r
38 2) The caller must be in 32-bit paged mode.\r
39 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.\r
40 4) CR3 must point to valid page tables that guarantee that the pages for\r
41 this function and the stack are identity mapped.\r
42\r
43 @param EntryPoint A pointer to function to call with the new stack after\r
44 paging is disabled.\r
45 @param Context1 A pointer to the context to pass into the EntryPoint\r
46 function as the first parameter after paging is disabled.\r
47 @param Context2 A pointer to the context to pass into the EntryPoint\r
48 function as the second parameter after paging is\r
49 disabled.\r
50 @param NewStack A pointer to the new stack to use for the EntryPoint\r
51 function after paging is disabled.\r
52\r
53**/\r
54VOID\r
55EFIAPI\r
56AsmDisablePaging32 (\r
57 IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
58 IN VOID *Context1, OPTIONAL\r
59 IN VOID *Context2, OPTIONAL\r
60 IN VOID *NewStack\r
61 )\r
62{\r
63 ASSERT (EntryPoint != NULL);\r
64 ASSERT (NewStack != NULL);\r
65 InternalX86DisablePaging32 (EntryPoint, Context1, Context2, NewStack);\r
66}\r