aboutsummaryrefslogtreecommitdiff
path: root/system/i386/start.S
blob: 762e807ea5415e1e2f8d2a54f170f3c890ba6cc5 (plain)
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
.text	
.global _start
_start:
	popl	%ecx			/* %ecx = argc */
	movl	%esp,%esi		/* %esi = argv */
	pushl	%ecx
	leal	4(%esi,%ecx,4),%eax	/* %eax = envp = (4*ecx)+%esi+4 */

	pushl	%eax
	pushl	%esi
	pushl	%ecx
	movl	%eax,environ

#ifdef WANT_SYSENTER
	movl	%eax,%edx
	xorl	%esi,%esi
1:
	add	$4,%edx
	cmpl	%esi,-4(%edx)
	jne	1b
1:
	movl	(%edx),%edi
	test	%edi,%edi
	jz	1f
	addl	$8,%edx
	cmpl	$32,%edi
	jne	1b
	movl	-4(%edx),%edi
	movl	 %edi,__vsyscall
1:
#endif

	call	main
	pushl	%eax
	call	exit
	hlt	/* die now ! will ya ... */
.size	 _start,.-_start