PERFORCE change 148880 for review
    Rui Paulo 
    rpaulo at FreeBSD.org
       
    Sun Aug 31 00:18:01 UTC 2008
    
    
  
http://perforce.freebsd.org/chv.cgi?CH=148880
Change 148880 by rpaulo at 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
    
    
More information about the p4-projects
mailing list