]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X64/Non-existing.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / Non-existing.c
1 /** @file
2 Non-existing BaseLib functions on x64
3
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <Library/BaseLib.h>
10 #include <Library/DebugLib.h>
11
12 /**
13 Enables the 32-bit paging mode on the CPU.
14
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.
23
24 There are a number of constraints that must be followed before calling this
25 function:
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
30 descriptors.
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.
34
35 @param EntryPoint A pointer to function to call with the new stack after
36 paging is enabled.
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.
43
44 **/
45 VOID
46 EFIAPI
47 InternalX86EnablePaging32 (
48 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
49 IN VOID *Context1, OPTIONAL
50 IN VOID *Context2, OPTIONAL
51 IN VOID *NewStack
52 )
53 {
54 //
55 // This function cannot work on x64 platform
56 //
57 ASSERT (FALSE);
58 }
59
60 /**
61 Disables the 32-bit paging mode on the CPU.
62
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.
70
71 There are a number of constraints that must be followed before calling this
72 function:
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.
78
79 @param EntryPoint A pointer to function to call with the new stack after
80 paging is disabled.
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
85 disabled.
86 @param NewStack A pointer to the new stack to use for the EntryPoint
87 function after paging is disabled.
88
89 **/
90 VOID
91 EFIAPI
92 InternalX86DisablePaging32 (
93 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
94 IN VOID *Context1, OPTIONAL
95 IN VOID *Context2, OPTIONAL
96 IN VOID *NewStack
97 )
98 {
99 //
100 // This function cannot work on x64 platform
101 //
102 ASSERT (FALSE);
103 }
104
105
106 /**
107 Enables the 64-bit paging mode on the CPU.
108
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.
117
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
125 paging is enabled.
126 @param Context2 The 64-bit virtual address of the context to pass into
127 the EntryPoint function as the second parameter after
128 paging is enabled.
129 @param NewStack The 64-bit virtual address of the new stack to use for
130 the EntryPoint function after paging is enabled.
131
132 **/
133 VOID
134 EFIAPI
135 InternalX86EnablePaging64 (
136 IN UINT16 Cs,
137 IN UINT64 EntryPoint,
138 IN UINT64 Context1, OPTIONAL
139 IN UINT64 Context2, OPTIONAL
140 IN UINT64 NewStack
141 )
142 {
143 //
144 // This function cannot work on x64 platform.
145 //
146 ASSERT (FALSE);
147 }