1264095Semaste/*-
2264095Semaste * Copyright (C) 1999 Hewlett-Packard Co.
3264095Semaste *     Contributed by David Mosberger <davidm@hpl.hp.com>.
4264095Semaste * Copyright (C) 2005 Intel Co.
5264095Semaste *     Contributed by Fenghua Yu <fenghua.yu@intel.com>.
6264095Semaste * All rights reserved.
7264095Semaste *
8264095Semaste * Redistribution and use in source and binary forms, with or without
9264095Semaste * modification, are permitted provided that the following conditions
10264095Semaste * are met:
11264095Semaste * 1. Redistributions of source code must retain the above copyright
12264095Semaste *    notice, this list of conditions and the following disclaimer.
13264095Semaste * 2. Redistributions in binary form must reproduce the above copyright
14264095Semaste *    notice, this list of conditions and the following disclaimer in the
15264095Semaste *    documentation and/or other materials provided with the distribution.
16264095Semaste * 3. Neither the name of Hewlett-Packard Co. nor the names of its
17264095Semaste *    contributors may be used to endorse or promote products derived
18264095Semaste *    from this software without specific prior written permission.
19264095Semaste *
20264095Semaste * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21264095Semaste * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22264095Semaste * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23264095Semaste * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
24264095Semaste * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25264095Semaste * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26264095Semaste * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27264095Semaste * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28264095Semaste * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
29264095Semaste * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30264095Semaste * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31264095Semaste * SUCH DAMAGE.
32264095Semaste */
33264095Semaste
34264095Semaste/*
35264095Semaste * crt0-efi-x86_64.S - x86_64 EFI startup code.
36264095Semaste * $FreeBSD$
37264095Semaste */
38264095Semaste
39264095Semaste	.text
40264095Semaste	.align 4
41264095Semaste
42264095Semaste	.globl _start
43264095Semaste_start:
44264095Semaste	subq $8, %rsp
45264095Semaste	pushq %rcx
46264095Semaste	pushq %rdx
47264095Semaste
48264095Semaste0:
49264095Semaste	lea ImageBase(%rip), %rdi
50264095Semaste	lea _DYNAMIC(%rip), %rsi
51264095Semaste
52264095Semaste	popq %rcx
53264095Semaste	popq %rdx
54264095Semaste	pushq %rcx
55264095Semaste	pushq %rdx
56264095Semaste	call _reloc
57264095Semaste
58264095Semaste	popq %rdi
59264095Semaste	popq %rsi
60264095Semaste
61264095Semaste	call efi_main
62264095Semaste	addq $8, %rsp
63264095Semaste
64264095Semaste.exit:
65264095Semaste	ret
66264095Semaste
67264095Semaste	/*
68264095Semaste	 * hand-craft a dummy .reloc section so EFI knows it's a relocatable
69264095Semaste	 * executable:
70264095Semaste	 */
71264095Semaste
72264095Semaste	.data
73264095Semaste	.section .reloc, "a"
74264095Semaste	.long   0
75264095Semaste	.long   10
76264095Semaste	.word   0
77