View of xos/usr/lib/libc/shared-crt-start.S


XOS | Parent Directory | View | Download

/* Code de demarrage d'un programme */
/* Copyright (C) 2008  Emmanuel Varoquaux

   This file is part of XOS.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */

	.text

.globl _start
.type _start,@function
.align 4
_start:
	xorl	%ebp, %ebp
	popl	%esi		/* argc */
	movl	%esp, %ecx	/* argv */
	pushl	%edx		/* fonction de terminaison des objets partages */
	call	1f
	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
	leal	__fini@GOTOFF(%ebx), %eax	/* fonction de terminaison de l'executable */
	pushl	%eax
	leal	__init@GOTOFF(%ebx), %eax	/* fonction d'initialisation de l'executable */
	pushl	%eax
	pushl	%ecx		/* argv */
	pushl	%esi		/* argc */
	pushl	main@GOT(%ebx)
	call	__libc_start@PLT

.align 4
1:	movl	(%esp), %ebx
	ret

	.section .note.GNU-stack,"",%progbits