Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Aug 2008 00:18:01 GMT
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 148880 for review
Message-ID:  <200808310018.m7V0I1LF026851@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148880

Change 148880 by rpaulo@rpaulo_alpha on 2008/08/31 00:17:48

	Add a _start function based on gnu-efi.

Affected files ...

.. //depot/projects/efi/boot/i386/efi/start.S#2 edit

Differences ...

==== //depot/projects/efi/boot/i386/efi/start.S#2 (text+ko) ====

@@ -32,9 +32,34 @@
 
 #define EFI_SUCCESS		0
 
+/*
+ * EFI entry point. 
+ * _start(EFI_IMAGE image_handle, EFI_SYSTEM_TABLE *system_table);
+ *
+ * We calculate the base address along with _DYNAMIC, relocate us and finally
+ * pass control to efi_main.
+ */
+
 ENTRY(_start)
-	// TBD
-	leave
+	pushl	%ebp
+	movl	%esp, %ebp
+
+	pushl	12(%ebp)	/* image_handle */
+	pushl	8(%ebp)		/* system_table */
+	call	0f
+0:	popl	%eax
+	movl	%eax, %ebx
+	addl	$ImageBase-0b, %eax
+	addl	$_DYNAMIC-0b, %ebx
+	pushl	%ebx		/* dynamic */
+	pushl	%eax		/* ImageBase */
+	call	_reloc
+	cmpl	$EFI_SUCCESS, %eax
+	jne	1f
+	popl	%ebx		/* remove ImageBase from the stack */
+	popl	%ebx		/* remove dynamic from the stack */
+	call	efi_main
+1:	leave
 	ret
 END(_start)
 
@@ -42,4 +67,4 @@
 	.section .reloc, "a"
 	.long	0
 	.long	10
-	.word	(0 << 12)
+	.word	0



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808310018.m7V0I1LF026851>