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>.
5
This file is part of GNU-EFI, the GNU EFI development environment.
7
GNU EFI is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2, or (at your option)
12
GNU EFI is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with GNU EFI; see the file COPYING. If not, write to the Free
19
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
29
alloc loc0=ar.pfs,2,2,2,0
31
movl out0=@gprel(ImageBase) // out0 <- ImageBase (ldbase)
34
movl out1=@gprel(_DYNAMIC) // out1 <- _DYNAMIC
35
;; // avoid WAW on CFM
37
br.call.sptk.few rp=_relocate
39
cmp.ne p6,p0=r0,r8 // r8 == EFI_SUCCESS?
40
(p6) br.cond.sptk.few .exit // no ->
44
mov out0=in0 // image handle
45
mov out1=in1 // systab
46
br.call.sptk.few rp=efi_main
57
// PE32+ wants a PLABEL, not the code address of the entry point:
66
// hand-craft a .reloc section for the plabel:
68
#define IMAGE_REL_BASED_DIR64 10
71
data4 _start_plabel // Page RVA
72
data4 12 // Block Size (2*4+2*2)
73
data2 (IMAGE_REL_BASED_DIR64<<12) + 0 // reloc for plabel's entry point
74
data2 (IMAGE_REL_BASED_DIR64<<12) + 8 // reloc for plabel's global pointer