Subversion Repositories HelenOS

Rev

Rev 2726 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2726 vana 1
/* crt0-efi-ia32.S - x86 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
	.align 4
24
 
25
	.globl _start
26
_start:
27
	pushl %ebp
28
	movl %esp,%ebp
29
 
30
	pushl 12(%ebp)			# copy "image" argument
31
	pushl  8(%ebp)			# copy "systab" argument
32
 
33
	call 0f
34
0:	popl %eax
35
	movl %eax,%ebx
36
 
37
	addl $ImageBase-0b,%eax		# %eax = ldbase
38
	addl $_DYNAMIC-0b,%ebx		# %ebx = _DYNAMIC
39
 
40
	pushl %ebx			# pass _DYNAMIC as second argument
41
	pushl %eax			# pass ldbase as first argument
42
	call _relocate
43
	popl %ebx
44
	popl %ebx
45
 	testl %eax,%eax
46
 	jne .exit
47
 
48
  	call efi_main			# call app with "image" and "systab" argument
49
 
50
.exit:	leave
51
  	ret
52
 
53
 	// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
54
 
55
 	.data
56
dummy:	.long	0
57
 
58
#define IMAGE_REL_ABSOLUTE	0
59
 	.section .reloc, "a"
60
 	.long	dummy					// Page RVA
61
 	.long	10					// Block Size (2*4+2)
62
 	.word	(IMAGE_REL_ABSOLUTE<<12) +  0		// reloc for dummy