x86: use EFI calling convention for efi_main on x86_64
PATCH 1/1 x86: use EFI calling convention for efi_main on x86_64
Save the arguments passed in %rcx and %rdx for efi_main() on x86_64; consistently use EFI calling convention for efi_main().
Signed-off-by Ivan Gorinov <[email protected]>
--- arch/x86/lib/crt0_x86_64_efi.S | 8 ++++---- lib/efi/efi_app.c | 3 ++- lib/efi/efi_stub.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-)
arch/x86/lib/crt0_x86_64_efi.S +4 -4
@@ -16,19 +16,19 @@ _start: subq $8, %rsp pushq %rcx pushq %rdx + pushq %rsi + pushq %rdi 0: lea image_base(%rip), %rdi lea _DYNAMIC(%rip), %rsi - popq %rcx - popq %rdx - pushq %rcx - pushq %rdx call _relocate popq %rdi popq %rsi + popq %rdx + popq %rcx call efi_main addq $8, %rsp
lib/efi/efi_app.c +2 -1
@@ -96,7 +96,8 @@ static void free_memory(struct efi_priv *priv)* U-Boot. If it returns, EFI will continue. Another way to get back to EFI * is via reset_cpu(). */ -efi_status_t efi_main (efi_handle_t image,struct efi_system_table *sys_table) +efi_status_t EFIAPI efi_main(efi_handle_t image, +struct efi_system_table *sys_table) {struct efi_priv local_priv, *priv = &local_priv;efi_status_t ret;
lib/efi/efi_stub.c +2 -1
@@ -268,7 +268,8 @@ static void add_entry_addr(struct efi_priv *priv, enum efi_entry_t type,* This function is called by our EFI start-up code. It handles running * U-Boot. If it returns, EFI will continue. */ -efi_status_t efi_main (efi_handle_t image,struct efi_system_table *sys_table) +efi_status_t EFIAPI efi_main(efi_handle_t image, +struct efi_system_table *sys_table) {struct efi_priv local_priv, *priv = &local_priv;struct efi_boot_services *boot = sys_table->boottime;
Signature · 1 line
2.7.4
PATCH 1/1 x86: use EFI calling convention for efi_main on x86_64
Quoted 4 lines · Ivan Gorinov
Save the arguments passed in %rcx and %rdx for
efi_main()onx86_64; consistently use EFI calling convention forefi_main().Signed-off-by Ivan Gorinov <[email protected]>
One big difference between the ms_abi and the sysv_abi calling convention is the set of volatile registers. So shouldn't _relocate() also be declared as EFIAPI to ensure that we do not mess up the callers registers?
Best regards
Heinrich
Quoted 63 lines
--- arch/x86/lib/crt0_x86_64_efi.S | 8 ++++---- lib/efi/efi_app.c | 3 ++- lib/efi/efi_stub.c | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-)arch/x86/lib/crt0_x86_64_efi.S +4
-4@@ -16,19 +16,19 @@ _start: subq $8, %rsp pushq %rcx pushq %rdx + pushq %rsi + pushq %rdi 0: lea image_base(%rip), %rdi lea _DYNAMIC(%rip), %rsi - popq %rcx - popq %rdx - pushq %rcx - pushq %rdx call _relocate popq %rdi popq %rsi + popq %rdx + popq %rcx call efi_main addq $8, %rsplib/efi/efi_app.c +2
-1@@ -96,7 +96,8 @@ static void free_memory(struct efi_priv *priv)* U-Boot. If it returns, EFI will continue. Another way to get back to EFI * is via reset_cpu(). */ -efi_status_t efi_main (efi_handle_t image,struct efi_system_table *sys_table) +efi_status_t EFIAPI efi_main(efi_handle_t image, +struct efi_system_table *sys_table) {struct efi_priv local_priv, *priv = &local_priv;efi_status_t ret;lib/efi/efi_stub.c +2
-1@@ -268,7 +268,8 @@ static void add_entry_addr(struct efi_priv *priv, enum efi_entry_t type,* This function is called by our EFI start-up code. It handles running * U-Boot. If it returns, EFI will continue. */ -efi_status_t efi_main (efi_handle_t image,struct efi_system_table *sys_table) +efi_status_t EFIAPI efi_main(efi_handle_t image, +struct efi_system_table *sys_table) {struct efi_priv local_priv, *priv = &local_priv;struct efi_boot_services *boot = sys_table->boottime;