]>
Commit | Line | Data |
---|---|---|
031e5cce SM |
1 | /* crt0-efi-x86_64.S - x86_64 EFI startup code. |
2 | Copyright (C) 1999 Hewlett-Packard Co. | |
3 | Contributed by David Mosberger <davidm@hpl.hp.com>. | |
4 | Copyright (C) 2005 Intel Co. | |
5 | Contributed by Fenghua Yu <fenghua.yu@intel.com>. | |
6 | ||
7 | All rights reserved. | |
8 | ||
9 | Redistribution and use in source and binary forms, with or without | |
10 | modification, are permitted provided that the following conditions | |
11 | are met: | |
12 | ||
13 | * Redistributions of source code must retain the above copyright | |
14 | notice, this list of conditions and the following disclaimer. | |
15 | * Redistributions in binary form must reproduce the above | |
16 | copyright notice, this list of conditions and the following | |
17 | disclaimer in the documentation and/or other materials | |
18 | provided with the distribution. | |
19 | * Neither the name of Hewlett-Packard Co. nor the names of its | |
20 | contributors may be used to endorse or promote products derived | |
21 | from this software without specific prior written permission. | |
22 | ||
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | |
24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | |
25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS | |
28 | BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, | |
29 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
30 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
31 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
32 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | |
33 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF | |
34 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
35 | SUCH DAMAGE. | |
36 | */ | |
37 | .text | |
38 | .align 4 | |
39 | ||
40 | .globl _start | |
41 | _start: | |
42 | subq $8, %rsp | |
43 | pushq %rcx | |
44 | pushq %rdx | |
45 | ||
46 | 0: | |
47 | lea ImageBase(%rip), %rdi | |
48 | lea _DYNAMIC(%rip), %rsi | |
49 | ||
50 | popq %rcx | |
51 | popq %rdx | |
52 | pushq %rcx | |
53 | pushq %rdx | |
54 | call _relocate | |
55 | ||
56 | popq %rdi | |
57 | popq %rsi | |
58 | ||
59 | call efi_main | |
60 | addq $8, %rsp | |
61 | ||
031e5cce SM |
62 | ret |
63 | ||
64 | // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable: | |
65 | .data | |
66 | .dummy0: | |
67 | .dummy1: | |
e6ace38a | 68 | .4byte 0 |
031e5cce SM |
69 | |
70 | #define IMAGE_REL_ABSOLUTE 0 | |
71 | .section .reloc, "a" | |
e6ace38a SM |
72 | .4byte .dummy1-.dummy0 // Page RVA |
73 | .4byte 10 // Block Size (2*4+2) | |
74 | .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy | |
fd2d9f03 | 75 | .section .note.GNU-stack,"a" |