@@ -21,12 +21,32 @@
#include <asm/processor-flags.h>
#include <asm/segment.h>
- .code64
.text
.balign 8
SYM_DATA_LOCAL(gdt, .quad 0x0, 0x0, 0xaf9a000000ffff) /* __KERNEL_CS */
.set gdt_size, . - gdt
+#ifdef CONFIG_EFI_HANDOVER_PROTOCOL
+ .code32
+SYM_FUNC_START_NOALIGN(efi32_stub_entry)
+ call 1f
+1: popl %ecx
+
+ /* Clear BSS */
+ xorl %eax, %eax
+ leal (_bss - 1b)(%ecx), %edi
+ leal (_ebss - 1b)(%ecx), %ecx
+ subl %edi, %ecx
+ shrl $2, %ecx
+ cld
+ rep stosl
+
+ add $0x4, %esp /* Discard return address */
+ movl 8(%esp), %edi /* struct boot_params pointer */
+ jmp efi32_entry
+SYM_FUNC_END(efi32_stub_entry)
+#endif
+
/*
* When booting in 64-bit mode on 32-bit EFI firmware, startup_64_mixed_mode()
* is the first thing that runs after switching to long mode. Depending on
@@ -50,6 +70,7 @@ SYM_DATA_LOCAL(gdt, .quad 0x0, 0x0, 0xaf9a000000ffff) /* __KERNEL_CS */
* | vmlinux |<----| efi_stub_entry |<--------+
* +-------------+ +----------------+
*/
+ .code64
SYM_FUNC_START_LOCAL_NOALIGN(startup_64_mixed_mode)
xorl %eax, %eax
movl %eax, %ds
@@ -79,7 +100,7 @@ SYM_FUNC_START_LOCAL_NOALIGN(startup_64_mixed_mode)
jmp efi_pe_entry
SYM_FUNC_END(startup_64_mixed_mode)
-SYM_FUNC_START(__efi64_thunk)
+SYM_FUNC_START_NOALIGN(__efi64_thunk)
push %rbx
/* Store live GDT and IDT descriptors */
@@ -125,26 +146,6 @@ SYM_FUNC_START(__efi64_thunk)
SYM_FUNC_END(__efi64_thunk)
.code32
-#ifdef CONFIG_EFI_HANDOVER_PROTOCOL
-SYM_FUNC_START(efi32_stub_entry)
- call 1f
-1: popl %ecx
-
- /* Clear BSS */
- xorl %eax, %eax
- leal (_bss - 1b)(%ecx), %edi
- leal (_ebss - 1b)(%ecx), %ecx
- subl %edi, %ecx
- shrl $2, %ecx
- cld
- rep stosl
-
- add $0x4, %esp /* Discard return address */
- movl 8(%esp), %edi /* struct boot_params pointer */
- jmp efi32_entry
-SYM_FUNC_END(efi32_stub_entry)
-#endif
-
/*
* Called using a far call from 64-bit code, using the x86_64 SysV ABI (except
* for R8/R9 which are inaccessible to 32-bit code - EAX/EBX are used instead).
@@ -155,7 +156,7 @@ SYM_FUNC_END(efi32_stub_entry)
* Entered with ESP+40 pointing to the arguments passed via the stack, and with
* the 64-bit mode GDT and IDT descriptors at ESP+8 and ESP+14, respectively.
*/
-SYM_FUNC_START_LOCAL(efi_enter32)
+SYM_FUNC_START_LOCAL_NOALIGN(efi_enter32)
/*
* Convert x86-64 SysV ABI params to i386 ABI
*/
@@ -232,7 +233,7 @@ SYM_FUNC_END(efi_enter32)
* stub may still exit and return to the firmware using the Exit() EFI boot
* service.]
*/
-SYM_FUNC_START_LOCAL(efi32_entry)
+SYM_FUNC_START_LOCAL_NOALIGN(efi32_entry)
call 1f
1: pop %ebx
@@ -306,7 +307,7 @@ SYM_FUNC_END(efi32_entry)
* efi_status_t efi32_pe_entry(efi_handle_t image_handle,
* efi_system_table_32_t *sys_table)
*/
-SYM_FUNC_START(efi32_pe_entry)
+SYM_FUNC_START_NOALIGN(efi32_pe_entry)
pushl %ebx // save callee-save registers
/* Check whether the CPU supports long mode */