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