1       .file   "cprt0.s"
2.data
3        .align 4
4default_environ:
5        .long 0
6.text
7.globl _start
8        .type    _start,@function
9_start:
10        pushl %ebp
11        movl %esp,%ebp
12        subl $4,%esp
13        pushl %ebx
14        call .L6
15.L6:
16        popl %ebx
17        addl $_GLOBAL_OFFSET_TABLE_+[.-.L6],%ebx
18        movl argv_save@GOT(%ebx),%eax
19        movl 12(%ebp),%edi
20        movl %edi,(%eax)
21        movl environ@GOT(%ebx),%eax
22        movl 16(%ebp),%esi
23        movl %esi,(%eax)
24        test %esi,%esi
25        jnz .L4
26        movl environ@GOT(%ebx),%eax
27        movl %ebx,%ecx
28        addl $default_environ@GOTOFF,%ecx
29        movl %ecx,%edx
30        movl %edx,(%eax)
31.L4:
32/*      movl %fs:0x4,%eax   this doesn't work on BeOS 4.0, let's use find_thread instead */
33        pushl $0x0
34        call find_thread
35        movl __main_thread_id@GOT(%ebx),%edx
36        movl %eax,(%edx)
37        pushl %esi
38        pushl %edi
39        movl 8(%ebp),%eax
40        pushl %eax
41        call _init_c_library_
42        call _call_init_routines_
43        movl 8(%ebp),%eax
44        movl %eax,operatingsystem_parameter_argc
45        movl %edi,operatingsystem_parameter_argv
46        movl %esi,operatingsystem_parameter_envp
47        xorl %ebp,%ebp
48        call PASCALMAIN
49
50.globl  _haltproc
51.type   _haltproc,@function
52_haltproc:
53        call _thread_do_exit_notification
54        xorl %ebx,%ebx
55    movw operatingsystem_result,%bx
56        pushl %ebx
57        call exit
58
59
60.bss
61        .comm operatingsystem_parameter_envp,4
62        .comm operatingsystem_parameter_argc,4
63        .comm operatingsystem_parameter_argv,4
64
65