2 Non-existing BaseLib functions on x64
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include <Library/BaseLib.h>
10 #include <Library/DebugLib.h>
13 Enables the 32-bit paging mode on the CPU.
15 Enables the 32-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
16 must be properly initialized prior to calling this service. This function
17 assumes the current execution mode is 32-bit protected mode. This function is
18 only available on IA-32. After the 32-bit paging mode is enabled, control is
19 transferred to the function specified by EntryPoint using the new stack
20 specified by NewStack and passing in the parameters specified by Context1 and
21 Context2. Context1 and Context2 are optional and may be NULL. The function
22 EntryPoint must never return.
24 There are a number of constraints that must be followed before calling this
26 1) Interrupts must be disabled.
27 2) The caller must be in 32-bit protected mode with flat descriptors. This
28 means all descriptors must have a base of 0 and a limit of 4GB.
29 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
31 4) CR3 must point to valid page tables that will be used once the transition
32 is complete, and those page tables must guarantee that the pages for this
33 function and the stack are identity mapped.
35 @param EntryPoint A pointer to function to call with the new stack after
37 @param Context1 A pointer to the context to pass into the EntryPoint
38 function as the first parameter after paging is enabled.
39 @param Context2 A pointer to the context to pass into the EntryPoint
40 function as the second parameter after paging is enabled.
41 @param NewStack A pointer to the new stack to use for the EntryPoint
42 function after paging is enabled.
47 InternalX86EnablePaging32 (
48 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
49 IN VOID
*Context1
, OPTIONAL
50 IN VOID
*Context2
, OPTIONAL
55 // This function cannot work on x64 platform
61 Disables the 32-bit paging mode on the CPU.
63 Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
64 mode. This function assumes the current execution mode is 32-paged protected
65 mode. This function is only available on IA-32. After the 32-bit paging mode
66 is disabled, control is transferred to the function specified by EntryPoint
67 using the new stack specified by NewStack and passing in the parameters
68 specified by Context1 and Context2. Context1 and Context2 are optional and
69 may be NULL. The function EntryPoint must never return.
71 There are a number of constraints that must be followed before calling this
73 1) Interrupts must be disabled.
74 2) The caller must be in 32-bit paged mode.
75 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
76 4) CR3 must point to valid page tables that guarantee that the pages for
77 this function and the stack are identity mapped.
79 @param EntryPoint A pointer to function to call with the new stack after
81 @param Context1 A pointer to the context to pass into the EntryPoint
82 function as the first parameter after paging is disabled.
83 @param Context2 A pointer to the context to pass into the EntryPoint
84 function as the second parameter after paging is
86 @param NewStack A pointer to the new stack to use for the EntryPoint
87 function after paging is disabled.
92 InternalX86DisablePaging32 (
93 IN SWITCH_STACK_ENTRY_POINT EntryPoint
,
94 IN VOID
*Context1
, OPTIONAL
95 IN VOID
*Context2
, OPTIONAL
100 // This function cannot work on x64 platform
107 Enables the 64-bit paging mode on the CPU.
109 Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
110 must be properly initialized prior to calling this service. This function
111 assumes the current execution mode is 32-bit protected mode with flat
112 descriptors. This function is only available on IA-32. After the 64-bit
113 paging mode is enabled, control is transferred to the function specified by
114 EntryPoint using the new stack specified by NewStack and passing in the
115 parameters specified by Context1 and Context2. Context1 and Context2 are
116 optional and may be 0. The function EntryPoint must never return.
118 @param Cs The 16-bit selector to load in the CS before EntryPoint
119 is called. The descriptor in the GDT that this selector
120 references must be setup for long mode.
121 @param EntryPoint The 64-bit virtual address of the function to call with
122 the new stack after paging is enabled.
123 @param Context1 The 64-bit virtual address of the context to pass into
124 the EntryPoint function as the first parameter after
126 @param Context2 The 64-bit virtual address of the context to pass into
127 the EntryPoint function as the second parameter after
129 @param NewStack The 64-bit virtual address of the new stack to use for
130 the EntryPoint function after paging is enabled.
135 InternalX86EnablePaging64 (
137 IN UINT64 EntryPoint
,
138 IN UINT64 Context1
, OPTIONAL
139 IN UINT64 Context2
, OPTIONAL
144 // This function cannot work on x64 platform.