]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X64/Non-existing.c
MdePkg: Apply uncrustify changes
[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 Enables the 64-bit paging mode on the CPU.
107
108 Enables the 64-bit paging mode on the CPU. CR0, CR3, CR4, and the page tables
109 must be properly initialized prior to calling this service. This function
110 assumes the current execution mode is 32-bit protected mode with flat
111 descriptors. This function is only available on IA-32. After the 64-bit
112 paging mode is enabled, control is transferred to the function specified by
113 EntryPoint using the new stack specified by NewStack and passing in the
114 parameters specified by Context1 and Context2. Context1 and Context2 are
115 optional and may be 0. The function EntryPoint must never return.
116
117 @param Cs The 16-bit selector to load in the CS before EntryPoint
118 is called. The descriptor in the GDT that this selector
119 references must be setup for long mode.
120 @param EntryPoint The 64-bit virtual address of the function to call with
121 the new stack after paging is enabled.
122 @param Context1 The 64-bit virtual address of the context to pass into
123 the EntryPoint function as the first parameter after
124 paging is enabled.
125 @param Context2 The 64-bit virtual address of the context to pass into
126 the EntryPoint function as the second parameter after
127 paging is enabled.
128 @param NewStack The 64-bit virtual address of the new stack to use for
129 the EntryPoint function after paging is enabled.
130
131 **/
132 VOID
133 EFIAPI
134 InternalX86EnablePaging64 (
135 IN UINT16 Cs,
136 IN UINT64 EntryPoint,
137 IN UINT64 Context1 OPTIONAL,
138 IN UINT64 Context2 OPTIONAL,
139 IN UINT64 NewStack
140 )
141 {
142 //
143 // This function cannot work on x64 platform.
144 //
145 ASSERT (FALSE);
146 }