]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X86DisablePaging64.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BaseLib / X86DisablePaging64.c
1 /** @file
2 IA-32/x64 AsmDisablePaging64()
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9
10
11
12 #include "BaseLibInternals.h"
13
14 /**
15 Disables the 64-bit paging mode on the CPU.
16
17 Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
18 mode. This function assumes the current execution mode is 64-paging mode.
19 This function is only available on x64. After the 64-bit paging mode is
20 disabled, control is transferred to the function specified by EntryPoint
21 using the new stack specified by NewStack and passing in the parameters
22 specified by Context1 and Context2. Context1 and Context2 are optional and
23 may be 0. The function EntryPoint must never return.
24
25 If the current execution mode is not 64-bit paged mode, then ASSERT().
26 If EntryPoint is 0, then ASSERT().
27 If NewStack is 0, then ASSERT().
28
29 @param Cs The 16-bit selector to load in the CS before EntryPoint
30 is called. The descriptor in the GDT that this selector
31 references must be setup for 32-bit protected mode.
32 @param EntryPoint The 64-bit virtual address of the function to call with
33 the new stack after paging is disabled.
34 @param Context1 The 64-bit virtual address of the context to pass into
35 the EntryPoint function as the first parameter after
36 paging is disabled.
37 @param Context2 The 64-bit virtual address of the context to pass into
38 the EntryPoint function as the second parameter after
39 paging is disabled.
40 @param NewStack The 64-bit virtual address of the new stack to use for
41 the EntryPoint function after paging is disabled.
42
43 **/
44 VOID
45 EFIAPI
46 AsmDisablePaging64 (
47 IN UINT16 Cs,
48 IN UINT32 EntryPoint,
49 IN UINT32 Context1, OPTIONAL
50 IN UINT32 Context2, OPTIONAL
51 IN UINT32 NewStack
52 )
53 {
54 ASSERT (EntryPoint != 0);
55 ASSERT (NewStack != 0);
56 InternalX86DisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
57 }