Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2726 | vana | 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>. |
||
4 | |||
5 | This file is part of GNU-EFI, the GNU EFI development environment. |
||
6 | |||
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) |
||
10 | any later version. |
||
11 | |||
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. |
||
16 | |||
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 |
||
20 | 02111-1307, USA. */ |
||
21 | |||
22 | .text |
||
23 | .psr abi64 |
||
24 | .psr lsb |
||
25 | .lsb |
||
26 | |||
27 | .proc _start |
||
28 | _start: |
||
29 | alloc loc0=ar.pfs,2,2,2,0 |
||
30 | mov loc1=rp |
||
31 | movl out0=@gprel(ImageBase) // out0 <- ImageBase (ldbase) |
||
32 | ;; |
||
33 | add out0=out0,gp |
||
34 | movl out1=@gprel(_DYNAMIC) // out1 <- _DYNAMIC |
||
35 | ;; // avoid WAW on CFM |
||
36 | add out1=out1,gp |
||
37 | br.call.sptk.few rp=_relocate |
||
38 | .Lret0: |
||
39 | cmp.ne p6,p0=r0,r8 // r8 == EFI_SUCCESS? |
||
40 | (p6) br.cond.sptk.few .exit // no -> |
||
41 | |||
42 | .Lret1: |
||
43 | |||
44 | mov out0=in0 // image handle |
||
45 | mov out1=in1 // systab |
||
46 | br.call.sptk.few rp=efi_main |
||
47 | .Lret2: |
||
48 | .exit: |
||
49 | mov ar.pfs=loc0 |
||
50 | mov rp=loc1 |
||
51 | ;; |
||
52 | br.ret.sptk.few rp |
||
53 | |||
54 | .endp _start |
||
55 | |||
56 | |||
57 | // PE32+ wants a PLABEL, not the code address of the entry point: |
||
58 | |||
59 | .align 16 |
||
60 | .global _start_plabel |
||
61 | .section .plabel, "a" |
||
62 | _start_plabel: |
||
63 | data8 _start |
||
64 | data8 __gp |
||
65 | |||
66 | // hand-craft a .reloc section for the plabel: |
||
67 | |||
68 | #define IMAGE_REL_BASED_DIR64 10 |
||
69 | |||
70 | .section .reloc, "a" |
||
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 |