File: start.S

package info (click to toggle)
dietlibc 0.34~cvs20160606-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,336 kB
  • sloc: ansic: 71,631; asm: 13,006; cpp: 1,860; makefile: 799; sh: 292; perl: 62
file content (67 lines) | stat: -rw-r--r-- 1,157 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "dietfeatures.h"
#include "PIC.h"

.file "start.S"

.text
.global _start
_start:
	popl	%ecx			/* %ecx = argc */
	movl	%esp,%eax		/* %eax = argv */
	pushl	%ecx
	leal	4(%eax,%ecx,4),%esi	/* %esi = envp = (4*ecx)+%eax+4 */

#ifdef WANT_DYNAMIC
/* in %edx we have the ld.so dynamic _fini ( register this if non null ) */
	push	%edx
#endif

	pushl	%esi
	pushl	%eax
	pushl	%ecx
	PIC_INIT			/* non-PIC: this is an empty line */
	PUT_VAR %esi, environ, %ecx	/* non-PIC: movl %esi,environ */

#ifdef WANT_SYSENTER
/* skip environment, scan for NULL */
1:
	lodsl
	testl	%eax,%eax
	jnz	1b
/* The ELF auxvec follows the environment, consists of key/value pairs.
   We are looking for key 32, which stands for the vsyscall page */
1:
	lodsl
	testl	%eax,%eax
	jz	1f
	cmpl	$32,%eax
	lodsl
	jne	1b
	PUT_VAR %eax, __vsyscall, %edx
1:
#endif

#ifdef PROFILING
	pushl	$_etext
	pushl	$.text
	call	monitor
	addl	$0x8, %esp
#endif

#ifdef WANT_DYNAMIC
	call	_dyn_start
#else
	call	CALL_IN_STARTCODE
#endif

#ifdef PROFILING
	pushl	%eax
	call	_stop_monitor
	popl	%eax
#endif
	pushl	%eax
	call	exit
	hlt	/* die now ! will ya ... */
.Lstart:
	.size	 _start,.Lstart-_start