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