]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X64/Non-existing.c
a1c4677dad0d0977d9e97e90e75733e83bd8b1fe
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / Non-existing.c
1 /** @file
2 Non-existing BaseLib functions on x64
3
4 Copyright (c) 2006, Intel Corporation
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: Non-existing.c
14
15 **/
16
17 #include "../BaseLibInternals.h"
18
19 /**
20 Enables the 32-bit paging mode on the CPU.
21
22 Enables the 32-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. This function is
25 only available on IA-32. After the 32-bit paging mode is enabled, control is
26 transferred to the function specified by EntryPoint using the new stack
27 specified by NewStack and passing in the parameters specified by Context1 and
28 Context2. Context1 and Context2 are optional and may be NULL. The function
29 EntryPoint must never return.
30
31 There are a number of constraints that must be followed before calling this
32 function:
33 1) Interrupts must be disabled.
34 2) The caller must be in 32-bit protected mode with flat descriptors. This
35 means all descriptors must have a base of 0 and a limit of 4GB.
36 3) CR0 and CR4 must be compatible with 32-bit protected mode with flat
37 descriptors.
38 4) CR3 must point to valid page tables that will be used once the transition
39 is complete, and those page tables must guarantee that the pages for this
40 function and the stack are identity mapped.
41
42 @param EntryPoint A pointer to function to call with the new stack after
43 paging is enabled.
44 @param Context1 A pointer to the context to pass into the EntryPoint
45 function as the first parameter after paging is enabled.
46 @param Context2 A pointer to the context to pass into the EntryPoint
47 function as the second parameter after paging is enabled.
48 @param NewStack A pointer to the new stack to use for the EntryPoint
49 function after paging is enabled.
50
51 **/
52 VOID
53 EFIAPI
54 InternalX86EnablePaging32 (
55 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
56 IN VOID *Context1, OPTIONAL
57 IN VOID *Context2, OPTIONAL
58 IN VOID *NewStack
59 )
60 {
61 //
62 // This function cannot work on X64 platform
63 //
64 ASSERT (FALSE);
65 }
66
67 /**
68 Disables the 32-bit paging mode on the CPU.
69
70 Disables the 32-bit paging mode on the CPU and returns to 32-bit protected
71 mode. This function assumes the current execution mode is 32-paged protected
72 mode. This function is only available on IA-32. After the 32-bit paging mode
73 is disabled, control is transferred to the function specified by EntryPoint
74 using the new stack specified by NewStack and passing in the parameters
75 specified by Context1 and Context2. Context1 and Context2 are optional and
76 may be NULL. The function EntryPoint must never return.
77
78 There are a number of constraints that must be followed before calling this
79 function:
80 1) Interrupts must be disabled.
81 2) The caller must be in 32-bit paged mode.
82 3) CR0, CR3, and CR4 must be compatible with 32-bit paged mode.
83 4) CR3 must point to valid page tables that guarantee that the pages for
84 this function and the stack are identity mapped.
85
86 @param EntryPoint A pointer to function to call with the new stack after
87 paging is disabled.
88 @param Context1 A pointer to the context to pass into the EntryPoint
89 function as the first parameter after paging is disabled.
90 @param Context2 A pointer to the context to pass into the EntryPoint
91 function as the second parameter after paging is
92 disabled.
93 @param NewStack A pointer to the new stack to use for the EntryPoint
94 function after paging is disabled.
95
96 **/
97 VOID
98 EFIAPI
99 InternalX86DisablePaging32 (
100 IN SWITCH_STACK_ENTRY_POINT EntryPoint,
101 IN VOID *Context1, OPTIONAL
102 IN VOID *Context2, OPTIONAL
103 IN VOID *NewStack
104 )
105 {
106 //
107 // This function cannot work on X64 platform
108 //
109 ASSERT (FALSE);
110 }
111
112 /**
113 Enables the 64-bit paging mode on the CPU.
114
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.
123
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
131 paging is enabled.
132 @param Context2 The 64-bit virtual address of the context to pass into
133 the EntryPoint function as the second parameter after
134 paging is enabled.
135 @param NewStack The 64-bit virtual address of the new stack to use for
136 the EntryPoint function after paging is enabled.
137
138 **/
139 VOID
140 EFIAPI
141 InternalX86EnablePaging64 (
142 IN UINT16 Cs,
143 IN UINT64 EntryPoint,
144 IN UINT64 Context1, OPTIONAL
145 IN UINT64 Context2, OPTIONAL
146 IN UINT64 NewStack
147 )
148 {
149 //
150 // This function cannot work on X64 platform
151 //
152 ASSERT (FALSE);
153 }