source: bootcd/isolinux/syslinux-6.03/gnu-efi/gnu-efi-3.0/gnuefi/crt0-efi-x86_64.S

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 2.3 KB
Line 
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
460:
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
62.exit: 
63        ret
64
65        // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
66 
67        .data
68dummy:  .long   0
69
70#define IMAGE_REL_ABSOLUTE      0
71        .section .reloc, "a"
72label1:
73        .long   dummy-label1                            // Page RVA
74        .long   10                                      // Block Size (2*4+2)
75        .word   (IMAGE_REL_ABSOLUTE<<12) +  0           // reloc for dummy
76
Note: See TracBrowser for help on using the repository browser.