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