]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/x86DisablePaging64.c
527950e03860a5c7610356a454f22f31b13f6762
[mirror_edk2.git] / MdePkg / Library / BaseLib / x86DisablePaging64.c
1 /** @file
2 IA-32/x64 AsmDisablePaging64()
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: x86DisablePaging64.c
14
15 **/
16
17 //
18 // Include common header file for this module.
19 //
20 #include "CommonHeader.h"
21
22 #include "BaseLibInternals.h"
23
24 /**
25 Disables the 64-bit paging mode on the CPU.
26
27 Disables the 64-bit paging mode on the CPU and returns to 32-bit protected
28 mode. This function assumes the current execution mode is 64-paging mode.
29 This function is only available on X64. After the 64-bit paging mode is
30 disabled, control is transferred to the function specified by EntryPoint
31 using the new stack specified by NewStack and passing in the parameters
32 specified by Context1 and Context2. Context1 and Context2 are optional and
33 may be 0. The function EntryPoint must never return.
34
35 If the current execution mode is not 64-bit paged mode, then ASSERT().
36 If EntryPoint is 0, then ASSERT().
37 If NewStack is 0, then ASSERT().
38
39 @param Cs The 16-bit selector to load in the CS before EntryPoint
40 is called. The descriptor in the GDT that this selector
41 references must be setup for 32-bit protected mode.
42 @param EntryPoint The 64-bit virtual address of the function to call with
43 the new stack after paging is disabled.
44 @param Context1 The 64-bit virtual address of the context to pass into
45 the EntryPoint function as the first parameter after
46 paging is disabled.
47 @param Context2 The 64-bit virtual address of the context to pass into
48 the EntryPoint function as the second parameter after
49 paging is disabled.
50 @param NewStack The 64-bit virtual address of the new stack to use for
51 the EntryPoint function after paging is disabled.
52
53 **/
54 VOID
55 EFIAPI
56 AsmDisablePaging64 (
57 IN UINT16 Cs,
58 IN UINT32 EntryPoint,
59 IN UINT32 Context1, OPTIONAL
60 IN UINT32 Context2, OPTIONAL
61 IN UINT32 NewStack
62 )
63 {
64 ASSERT (EntryPoint != 0);
65 ASSERT (NewStack != 0);
66 InternalX86DisablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
67 }