]> git.sur5r.net Git - u-boot/blob - arch/x86/lib/crt0_x86_64_efi.S
x86: use EFI calling convention for efi_main on x86_64
[u-boot] / arch / x86 / lib / crt0_x86_64_efi.S
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * crt0-efi-x86_64.S - x86_64 EFI startup code.
4  * Copyright (C) 1999 Hewlett-Packard Co.
5  * Contributed by David Mosberger <davidm@hpl.hp.com>.
6  * Copyright (C) 2005 Intel Corporation
7  * Contributed by Fenghua Yu <fenghua.yu@intel.com>.
8  *
9  * All rights reserved.
10  */
11         .text
12         .align 4
13
14         .globl _start
15 _start:
16         subq $8, %rsp
17
18         pushq %rcx
19         pushq %rdx
20
21         mov %rcx, %r8
22         mov %rdx, %r9
23
24         lea image_base(%rip), %rcx
25         lea _DYNAMIC(%rip), %rdx
26
27         call _relocate
28
29         popq %rdx
30         popq %rcx
31
32         testq %rax, %rax
33         jnz .exit
34
35         call efi_main
36 .exit:
37         addq $8, %rsp
38
39         ret
40
41         /*
42          * hand-craft a dummy .reloc section so EFI knows it's a relocatable
43          * executable:
44          */
45         .data
46 dummy:  .long   0
47
48 #define IMAGE_REL_ABSOLUTE      0
49         .section .reloc, "a"
50 label1:
51         .long   dummy-label1                            /* Page RVA */
52         .long   10                                      /* Block Size (2*4+2) */
53         .word   (IMAGE_REL_ABSOLUTE << 12) +  0         /* reloc for dummy */