* [U-Boot] [PATCH] x86: use EFI calling convention for efi_main on x86_64
@ 2018-05-25 21:28 Ivan Gorinov
2018-05-26 4:31 ` Heinrich Schuchardt
0 siblings, 1 reply; 2+ messages in thread
From: Ivan Gorinov @ 2018-05-25 21:28 UTC (permalink / raw)
To: u-boot
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 <ivan.gorinov@intel.com>
---
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(-)
diff --git a/arch/x86/lib/crt0_x86_64_efi.S b/arch/x86/lib/crt0_x86_64_efi.S
index 989799f..2d53d1b 100644
--- a/arch/x86/lib/crt0_x86_64_efi.S
+++ b/arch/x86/lib/crt0_x86_64_efi.S
@@ -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
diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c
index c828093..3eb8eeb 100644
--- a/lib/efi/efi_app.c
+++ b/lib/efi/efi_app.c
@@ -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;
diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c
index 3138739..399d16b 100644
--- a/lib/efi/efi_stub.c
+++ b/lib/efi/efi_stub.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] x86: use EFI calling convention for efi_main on x86_64
2018-05-25 21:28 [U-Boot] [PATCH] x86: use EFI calling convention for efi_main on x86_64 Ivan Gorinov
@ 2018-05-26 4:31 ` Heinrich Schuchardt
0 siblings, 0 replies; 2+ messages in thread
From: Heinrich Schuchardt @ 2018-05-26 4:31 UTC (permalink / raw)
To: u-boot
On 05/25/2018 11:28 PM, Ivan Gorinov wrote:
> 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 <ivan.gorinov@intel.com>
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
> ---
> 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(-)
>
> diff --git a/arch/x86/lib/crt0_x86_64_efi.S b/arch/x86/lib/crt0_x86_64_efi.S
> index 989799f..2d53d1b 100644
> --- a/arch/x86/lib/crt0_x86_64_efi.S
> +++ b/arch/x86/lib/crt0_x86_64_efi.S
> @@ -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
> diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c
> index c828093..3eb8eeb 100644
> --- a/lib/efi/efi_app.c
> +++ b/lib/efi/efi_app.c
> @@ -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;
> diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c
> index 3138739..399d16b 100644
> --- a/lib/efi/efi_stub.c
> +++ b/lib/efi/efi_stub.c
> @@ -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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-26 4:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-25 21:28 [U-Boot] [PATCH] x86: use EFI calling convention for efi_main on x86_64 Ivan Gorinov
2018-05-26 4:31 ` Heinrich Schuchardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox