2
Non-existing BaseLib functions on x64
4
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5
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.
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.
15
#include <Library/BaseLib.h>
16
#include <Library/DebugLib.h>
19
Enables the 32-bit paging mode on the CPU.
21
Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
22
must be properly initialized prior to calling this service. This function
23
assumes the current execution mode is 32-bit protected mode. This function is
24
only available on IA-32. After the 32-bit paging mode is enabled, control is
25
transferred to the function specified by EntryPoint using the new stack
26
specified by NewStack and passing in the parameters specified by Context1 and
27
Context2. Context1 and Context2 are optional and may be NULL. The function
28
EntryPoint must never return.
30
There are a number of constraints that must be followed before calling this
32
1) Interrupts must be disabled.
33
2) The caller must be in 32-bit protected mode with flat descriptors. This
34
means all descriptors must have a base of 0 and a limit of 4GB.
35
3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
37
4) CR3 must point to valid page tables that will be used once the transition
38
is complete, and those page tables must guarantee that the pages for this
39
function and the stack are identity mapped.
41
@param EntryPoint A pointer to function to call with the new stack after
43
@param Context1 A pointer to the context to pass into the EntryPoint
44
function as the first parameter after paging is enabled.
45
@param Context2 A pointer to the context to pass into the EntryPoint
46
function as the second parameter after paging is enabled.
47
@param NewStack A pointer to the new stack to use for the EntryPoint
48
function after paging is enabled.
53
InternalX86EnablePaging32 (
54
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
55
IN VOID *Context1, OPTIONAL
56
IN VOID *Context2, OPTIONAL
61
// This function cannot work on x64 platform
67
Disables the 32-bit paging mode on the CPU.
69
Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
70
mode. This function assumes the current execution mode is 32-paged protected
71
mode. This function is only available on IA-32. After the 32-bit paging mode
72
is disabled, control is transferred to the function specified by EntryPoint
73
using the new stack specified by NewStack and passing in the parameters
74
specified by Context1 and Context2. Context1 and Context2 are optional and
75
may be NULL. The function EntryPoint must never return.
77
There are a number of constraints that must be followed before calling this
79
1) Interrupts must be disabled.
80
2) The caller must be in 32-bit paged mode.
81
3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
82
4) CR3 must point to valid page tables that guarantee that the pages for
83
this function and the stack are identity mapped.
85
@param EntryPoint A pointer to function to call with the new stack after
87
@param Context1 A pointer to the context to pass into the EntryPoint
88
function as the first parameter after paging is disabled.
89
@param Context2 A pointer to the context to pass into the EntryPoint
90
function as the second parameter after paging is
92
@param NewStack A pointer to the new stack to use for the EntryPoint
93
function after paging is disabled.
98
InternalX86DisablePaging32 (
99
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
100
IN VOID *Context1, OPTIONAL
101
IN VOID *Context2, OPTIONAL
106
// This function cannot work on x64 platform
113
Enables the 64-bit paging mode on the CPU.
115
Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
116
must be properly initialized prior to calling this service. This function
117
assumes the current execution mode is 32-bit protected mode with flat
118
descriptors. This function is only available on IA-32. After the 64-bit
119
paging mode is enabled, control is transferred to the function specified by
120
EntryPoint using the new stack specified by NewStack and passing in the
121
parameters specified by Context1 and Context2. Context1 and Context2 are
122
optional and may be 0. The function EntryPoint must never return.
124
@param Cs The 16-bit selector to load in the CS before EntryPoint
125
is called. The descriptor in the GDT that this selector
126
references must be setup for long mode.
127
@param EntryPoint The 64-bit virtual address of the function to call with
128
the new stack after paging is enabled.
129
@param Context1 The 64-bit virtual address of the context to pass into
130
the EntryPoint function as the first parameter after
132
@param Context2 The 64-bit virtual address of the context to pass into
133
the EntryPoint function as the second parameter after
135
@param NewStack The 64-bit virtual address of the new stack to use for
136
the EntryPoint function after paging is enabled.
141
InternalX86EnablePaging64 (
143
IN UINT64 EntryPoint,
144
IN UINT64 Context1, OPTIONAL
145
IN UINT64 Context2, OPTIONAL
150
// This function cannot work on x64 platform.