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