diff options
Diffstat (limited to 'arch/x86/platform/efi/efi_stub_64.S')
-rw-r--r-- | arch/x86/platform/efi/efi_stub_64.S | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/arch/x86/platform/efi/efi_stub_64.S b/arch/x86/platform/efi/efi_stub_64.S index 5fcda7272550..86d0f9e08dd9 100644 --- a/arch/x86/platform/efi/efi_stub_64.S +++ b/arch/x86/platform/efi/efi_stub_64.S | |||
@@ -91,167 +91,6 @@ ENTRY(efi_call) | |||
91 | ret | 91 | ret |
92 | ENDPROC(efi_call) | 92 | ENDPROC(efi_call) |
93 | 93 | ||
94 | #ifdef CONFIG_EFI_MIXED | ||
95 | |||
96 | /* | ||
97 | * We run this function from the 1:1 mapping. | ||
98 | * | ||
99 | * This function must be invoked with a 1:1 mapped stack. | ||
100 | */ | ||
101 | ENTRY(__efi64_thunk) | ||
102 | movl %ds, %eax | ||
103 | push %rax | ||
104 | movl %es, %eax | ||
105 | push %rax | ||
106 | movl %ss, %eax | ||
107 | push %rax | ||
108 | |||
109 | subq $32, %rsp | ||
110 | movl %esi, 0x0(%rsp) | ||
111 | movl %edx, 0x4(%rsp) | ||
112 | movl %ecx, 0x8(%rsp) | ||
113 | movq %r8, %rsi | ||
114 | movl %esi, 0xc(%rsp) | ||
115 | movq %r9, %rsi | ||
116 | movl %esi, 0x10(%rsp) | ||
117 | |||
118 | sgdt save_gdt(%rip) | ||
119 | |||
120 | leaq 1f(%rip), %rbx | ||
121 | movq %rbx, func_rt_ptr(%rip) | ||
122 | |||
123 | /* Switch to gdt with 32-bit segments */ | ||
124 | movl 64(%rsp), %eax | ||
125 | lgdt (%rax) | ||
126 | |||
127 | leaq efi_enter32(%rip), %rax | ||
128 | pushq $__KERNEL_CS | ||
129 | pushq %rax | ||
130 | lretq | ||
131 | |||
132 | 1: addq $32, %rsp | ||
133 | |||
134 | lgdt save_gdt(%rip) | ||
135 | |||
136 | pop %rbx | ||
137 | movl %ebx, %ss | ||
138 | pop %rbx | ||
139 | movl %ebx, %es | ||
140 | pop %rbx | ||
141 | movl %ebx, %ds | ||
142 | |||
143 | /* | ||
144 | * Convert 32-bit status code into 64-bit. | ||
145 | */ | ||
146 | test %rax, %rax | ||
147 | jz 1f | ||
148 | movl %eax, %ecx | ||
149 | andl $0x0fffffff, %ecx | ||
150 | andl $0xf0000000, %eax | ||
151 | shl $32, %rax | ||
152 | or %rcx, %rax | ||
153 | 1: | ||
154 | ret | ||
155 | ENDPROC(__efi64_thunk) | ||
156 | |||
157 | ENTRY(efi_exit32) | ||
158 | movq func_rt_ptr(%rip), %rax | ||
159 | push %rax | ||
160 | mov %rdi, %rax | ||
161 | ret | ||
162 | ENDPROC(efi_exit32) | ||
163 | |||
164 | .code32 | ||
165 | /* | ||
166 | * EFI service pointer must be in %edi. | ||
167 | * | ||
168 | * The stack should represent the 32-bit calling convention. | ||
169 | */ | ||
170 | ENTRY(efi_enter32) | ||
171 | movl $__KERNEL_DS, %eax | ||
172 | movl %eax, %ds | ||
173 | movl %eax, %es | ||
174 | movl %eax, %ss | ||
175 | |||
176 | /* Reload pgtables */ | ||
177 | movl %cr3, %eax | ||
178 | movl %eax, %cr3 | ||
179 | |||
180 | /* Disable paging */ | ||
181 | movl %cr0, %eax | ||
182 | btrl $X86_CR0_PG_BIT, %eax | ||
183 | movl %eax, %cr0 | ||
184 | |||
185 | /* Disable long mode via EFER */ | ||
186 | movl $MSR_EFER, %ecx | ||
187 | rdmsr | ||
188 | btrl $_EFER_LME, %eax | ||
189 | wrmsr | ||
190 | |||
191 | call *%edi | ||
192 | |||
193 | /* We must preserve return value */ | ||
194 | movl %eax, %edi | ||
195 | |||
196 | /* | ||
197 | * Some firmware will return with interrupts enabled. Be sure to | ||
198 | * disable them before we switch GDTs. | ||
199 | */ | ||
200 | cli | ||
201 | |||
202 | movl 68(%esp), %eax | ||
203 | movl %eax, 2(%eax) | ||
204 | lgdtl (%eax) | ||
205 | |||
206 | movl %cr4, %eax | ||
207 | btsl $(X86_CR4_PAE_BIT), %eax | ||
208 | movl %eax, %cr4 | ||
209 | |||
210 | movl %cr3, %eax | ||
211 | movl %eax, %cr3 | ||
212 | |||
213 | movl $MSR_EFER, %ecx | ||
214 | rdmsr | ||
215 | btsl $_EFER_LME, %eax | ||
216 | wrmsr | ||
217 | |||
218 | xorl %eax, %eax | ||
219 | lldt %ax | ||
220 | |||
221 | movl 72(%esp), %eax | ||
222 | pushl $__KERNEL_CS | ||
223 | pushl %eax | ||
224 | |||
225 | /* Enable paging */ | ||
226 | movl %cr0, %eax | ||
227 | btsl $X86_CR0_PG_BIT, %eax | ||
228 | movl %eax, %cr0 | ||
229 | lret | ||
230 | ENDPROC(efi_enter32) | ||
231 | |||
232 | .data | ||
233 | .balign 8 | ||
234 | .global efi32_boot_gdt | ||
235 | efi32_boot_gdt: .word 0 | ||
236 | .quad 0 | ||
237 | |||
238 | save_gdt: .word 0 | ||
239 | .quad 0 | ||
240 | func_rt_ptr: .quad 0 | ||
241 | |||
242 | .global efi_gdt64 | ||
243 | efi_gdt64: | ||
244 | .word efi_gdt64_end - efi_gdt64 | ||
245 | .long 0 /* Filled out by user */ | ||
246 | .word 0 | ||
247 | .quad 0x0000000000000000 /* NULL descriptor */ | ||
248 | .quad 0x00af9a000000ffff /* __KERNEL_CS */ | ||
249 | .quad 0x00cf92000000ffff /* __KERNEL_DS */ | ||
250 | .quad 0x0080890000000000 /* TS descriptor */ | ||
251 | .quad 0x0000000000000000 /* TS continued */ | ||
252 | efi_gdt64_end: | ||
253 | #endif /* CONFIG_EFI_MIXED */ | ||
254 | |||
255 | .data | 94 | .data |
256 | ENTRY(efi_scratch) | 95 | ENTRY(efi_scratch) |
257 | .fill 3,8,0 | 96 | .fill 3,8,0 |