x86: use EFI calling convention for efi_main on x86_64
PATCH v2 1/1 x86: use EFI calling convention for efi_main on x86_64
Save efi_main() arguments in the startup code on x86_64; use EFI calling convention for _relocate() on x86_64; remove unused _relocate() arguments;
consistently use EFI calling convention for efi_main() everywhere.
--- arch/x86/lib/crt0_x86_64_efi.S | 21 ++++++++++----------- arch/x86/lib/reloc_x86_64_efi.c | 3 +-- lib/efi/efi_app.c | 3 ++- lib/efi/efi_stub.c | 3 ++- 4 files changed, 15 insertions(+), 15 deletions(-)
arch/x86/lib/crt0_x86_64_efi.S +10 -11
@@ -3,7 +3,7 @@ * crt0-efi-x86_64.S - x86_64 EFI startup code. * Copyright (C) 1999 Hewlett-Packard Co. * Contributed by David Mosberger <[email protected]>. - * Copyright (C) 2005 Intel Co. + * Copyright (C) 2005 Intel Corporation * Contributed by Fenghua Yu <[email protected]>. * * All rights reserved.
@@ -14,26 +14,25 @@ .globl _start _start: subq $8, %rsp + pushq %rcx pushq %rdx -0: - lea image_base(%rip), %rdi - lea _DYNAMIC(%rip), %rsi + lea image_base(%rip), %rcx + lea _DYNAMIC(%rip), %rdx - popq %rcx - popq %rdx - pushq %rcx - pushq %rdx call _relocate - popq %rdi - popq %rsi + popq %rdx + popq %rcx + + testq %rax, %rax + jnz _exit call efi_main +_exit: addq $8, %rsp -.exit: ret /*
arch/x86/lib/reloc_x86_64_efi.c +1 -2
@@ -14,8 +14,7 @@#include <elf.h> #include <asm/elf.h> -efi_status_t _relocate (long ldbase,Elf64_Dyn *dyn,efi_handle_t image, -struct efi_system_table *systab) +efi_status_t EFIAPI _relocate(long ldbase, Elf64_Dyn *dyn) {long relsz =0 , relent =0 ;Elf64_Rel *rel =0 ;
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 v2 1/1 x86: use EFI calling convention for efi_main on x86_64
Quoted 4 lines · Ivan Gorinov
Save
efi_main()arguments in the startup code onx86_64; use EFI calling convention for_relocate()onx86_64; remove unused_relocate()arguments;
consistently use EFI calling convention forefi_main()everywhere.
I think it rather requires more explanation here what EFI calling convetion is and how it differs in _relloc() with changes you did. (Btw, the mail has no changelog provided)
Quoted 1 line
One nit below, in any case FWIW,
Quoted 76 lines
Signed-off-by Ivan Gorinov <[email protected]>--- arch/x86/lib/crt0_x86_64_efi.S | 21 ++++++++++----------- arch/x86/lib/reloc_x86_64_efi.c | 3 +-- lib/efi/efi_app.c | 3 ++- lib/efi/efi_stub.c | 3 ++- 4 files changed, 15 insertions(+), 15 deletions(-)arch/x86/lib/crt0_x86_64_efi.S +10
-11@@ -3,7 +3,7 @@ * crt0-efi-x86_64.S - x86_64 EFI startup code. * Copyright (C) 1999 Hewlett-Packard Co. * Contributed by David Mosberger <[email protected]>. - * Copyright (C) 2005 Intel Co. + * Copyright (C) 2005 Intel Corporation * Contributed by Fenghua Yu <[email protected]>. * * All rights reserved.@@ -14,26 +14,25 @@ .globl _start _start: subq $8, %rsp + pushq %rcx pushq %rdx -0: - lea image_base(%rip), %rdi - lea _DYNAMIC(%rip), %rsi + lea image_base(%rip), %rcx + lea _DYNAMIC(%rip), %rdx - popq %rcx - popq %rdx - pushq %rcx - pushq %rdx call _relocate - popq %rdi - popq %rsi + popq %rdx + popq %rcx + + testq %rax, %rax + jnz _exit call efi_main +_exit: addq $8, %rsp -.exit: ret /*arch/x86/lib/reloc_x86_64_efi.c +1
-2@@ -14,8 +14,7 @@#include <elf.h> #include <asm/elf.h> -efi_status_t _relocate (long ldbase,Elf64_Dyn *dyn,efi_handle_t image, -struct efi_system_table *systab) +efi_status_t EFIAPI _relocate(long ldbase, Elf64_Dyn *dyn) {long relsz =0 , relent =0 ;Elf64_Rel *rel =0 ;lib/efi/efi_app.c +0
-0
lib/efi/efi_app.c static void free_memory(struct efi_priv *priv) · line 100
Quoted 6 lines
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)
Perhaps still leave at one line?
Quoted 8 lines
lib/efi/efi_app.c +0
-0{struct efi_priv local_priv, *priv = &local_priv;efi_status_t ret;lib/efi/efi_stub.c +0
-0
lib/efi/efi_stub.c static void add_entry_addr(struct efi_priv *priv, enum efi_entry_t type, · line 272
Quoted 6 lines
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)
Ditto.
Quoted 10 lines
lib/efi/efi_stub.c +0
-1{struct efi_priv local_priv, *priv = &local_priv;struct efi_boot_services *boot = sys_table->boottime; --2.7.4
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 1/1 x86: use EFI calling convention for efi_main on x86_64
Quoted 8 lines · Andy Shevchenko
Quoted 4 lines
Save
efi_main()arguments in the startup code onx86_64; use EFI calling convention for_relocate()onx86_64; remove unused_relocate()arguments;
consistently use EFI calling convention forefi_main()everywhere.I think it rather requires more explanation here what EFI calling convetion is and how it differs in
_relloc()with changes you did. (Btw, the mail has no changelog provided)
Added in v3.
Quoted 5 lines
Quoted 5 lines
lib/efi/efi_app.c +0
-0@@ -96,7 +96,8 @@ static void free_memory(struct efi_priv *priv)
Quoted 8 lines
lib/efi/efi_app.c static void free_memory(struct efi_priv *priv) · line 100
Quoted 6 lines
lib/efi/efi_app.c +2
-1* 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)Perhaps still leave at one line?
That one line would exceed the limit of 80 columns on a punch card.
Quoted 17 lines
Quoted 9 lines
lib/efi/efi_app.c +0
-0{struct efi_priv local_priv, *priv = &local_priv;efi_status_t ret;lib/efi/efi_stub.c +0
-0lib/efi/efi_stub.c static void add_entry_addr(struct efi_priv *priv, enum efi_entry_t type, · line 272
Quoted 6 lines
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)Ditto.