1 /* crt0-efi-ia64.S - IA-64 EFI startup code.
2 Copyright (C) 1999 Hewlett-Packard Co.
3 Contributed by David Mosberger <davidm@hpl.hp.com>.
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
11 * Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above
14 copyright notice, this list of conditions and the following
15 disclaimer in the documentation and/or other materials
16 provided with the distribution.
17 * Neither the name of Hewlett-Packard Co. nor the names of its
18 contributors may be used to endorse or promote products derived
19 from this software without specific prior written permission.
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
22 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
26 BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 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
42 alloc loc0=ar.pfs,2,2,2,0
44 movl out0=@gprel(ImageBase) // out0 <- ImageBase (ldbase)
47 movl out1=@gprel(_DYNAMIC) // out1 <- _DYNAMIC
48 ;; // avoid WAW on CFM
50 br.call.sptk.few rp=_relocate
52 cmp.ne p6,p0=r0,r8 // r8 == EFI_SUCCESS?
53 (p6) br.cond.sptk.few .exit // no ->
57 mov out0=in0 // image handle
58 mov out1=in1 // systab
59 br.call.sptk.few rp=efi_main
70 // PE32+ wants a PLABEL, not the code address of the entry point:
79 // hand-craft a .reloc section for the plabel:
81 #define IMAGE_REL_BASED_DIR64 10
84 data4 _start_plabel // Page RVA
85 data4 12 // Block Size (2*4+2*2)
86 data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point
87 data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer