-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86/efi: Add early thunk code to go from 64-bit to 32-bit
Implement the transition code to go from IA32e mode to protected mode in the EFI boot stub. This is required to use 32-bit EFI services from a 64-bit kernel. Since EFI boot stub is executed in an identity-mapped region, there's not much we need to do before invoking the 32-bit EFI boot services. However, we do reload the firmware's global descriptor table (efi32_boot_gdt) in case things like timer events are still running in the firmware. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
- Loading branch information
Matt Fleming
committed
Mar 4, 2014
1 parent
54b52d8
commit 0154416
Showing
2 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,30 @@ | ||
#include <asm/segment.h> | ||
#include <asm/msr.h> | ||
#include <asm/processor-flags.h> | ||
|
||
#include "../../platform/efi/efi_stub_64.S" | ||
|
||
#ifdef CONFIG_EFI_MIXED | ||
.code64 | ||
.text | ||
ENTRY(efi64_thunk) | ||
push %rbp | ||
push %rbx | ||
|
||
subq $16, %rsp | ||
leaq efi_exit32(%rip), %rax | ||
movl %eax, 8(%rsp) | ||
leaq efi_gdt64(%rip), %rax | ||
movl %eax, 4(%rsp) | ||
movl %eax, 2(%rax) /* Fixup the gdt base address */ | ||
leaq efi32_boot_gdt(%rip), %rax | ||
movl %eax, (%rsp) | ||
|
||
call __efi64_thunk | ||
|
||
addq $16, %rsp | ||
pop %rbx | ||
pop %rbp | ||
ret | ||
ENDPROC(efi64_thunk) | ||
#endif /* CONFIG_EFI_MIXED */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters