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