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