]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X86EnablePaging64.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / X86EnablePaging64.c
1 /** @file
2 IA-32/x64 AsmEnablePaging64()
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 Enables the 64-bit paging mode on the CPU.
16
17 Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
18 must be properly initialized prior to calling this service. This function
19 assumes the current execution mode is 32-bit protected mode with flat
20 descriptors. This function is only available on IA-32. After the 64-bit
21 paging mode is enabled, control is transferred to the function specified by
22 EntryPoint using the new stack specified by NewStack and passing in the
23 parameters specified by Context1 and Context2. Context1 and Context2 are
24 optional and may be 0. The function EntryPoint must never return.
25
26 If the current execution mode is not 32-bit protected mode with flat
27 descriptors, then ASSERT().
28 If EntryPoint is 0, then ASSERT().
29 If NewStack is 0, then ASSERT().
30
31 @param Cs The 16-bit selector to load in the CS before EntryPoint
32 is called. The descriptor in the GDT that this selector
33 references must be setup for long mode.
34 @param EntryPoint The 64-bit virtual address of the function to call with
35 the new stack after paging is enabled.
36 @param Context1 The 64-bit virtual address of the context to pass into
37 the EntryPoint function as the first parameter after
38 paging is enabled.
39 @param Context2 The 64-bit virtual address of the context to pass into
40 the EntryPoint function as the second parameter after
41 paging is enabled.
42 @param NewStack The 64-bit virtual address of the new stack to use for
43 the EntryPoint function after paging is enabled.
44
45 **/
46 VOID
47 EFIAPI
48 AsmEnablePaging64 (
49 IN UINT16 Cs,
50 IN UINT64 EntryPoint,
51 IN UINT64 Context1, OPTIONAL
52 IN UINT64 Context2, OPTIONAL
53 IN UINT64 NewStack
54 )
55 {
56 ASSERT (EntryPoint != 0);
57 ASSERT (NewStack != 0);
58 InternalX86EnablePaging64 (Cs, EntryPoint, Context1, Context2, NewStack);
59 }