068 the arguments for `main': argc, argv. envp will be determined 069 later in libc_start_main. */ 070 popl %esi /** Pop the argument count. */ 071 movl %esp, %ecx /** argv starts just at the current stack top.*/ 072 073 /** Before pushing the arguments align the stack to a 16-byte 074 (SSE needs 16-byte alignment) boundary to avoid penalties from 075 misaligned accesses. Thanks to Edward Seidl <seidl@janed.com> 076 for pointing this out. */ 077 andl $0xfffffff0, %esp 078 pushl %eax /** Push garbage because we allocate 079 28 more bytes. */ 080 081 /** Provide the highest stack address to the user code (for stacks 082 which grow downwards). */ 083 pushl %esp 084 085 pushl %edx /** Push address of the shared library 086 termination function. */ 087 088 #ifdef SHARED 089 /** Load PIC register. */ 090 call 1f 091 addl $_GLOBAL_OFFSET_TABLE_, %ebx 092 093 /** Push address of our own entry points to .fini and .init. */ 094 leal __libc_csu_fini@GOTOFF(%ebx), %eax 095 pushl %eax 096 leal __libc_csu_init@GOTOFF(%ebx), %eax 097 pushl %eax 098 099 pushl %ecx /** Push second argument: argv. */ 100 pushl %esi /** Push first argument: argc. */ 101 102 pushl BP_SYM (main)@GOT(%ebx) 103 104 /** Call the user's main function, and exit with its value. 105 But let the libc call main. */ 106 call BP_SYM (__libc_start_main)@PLT 107 #else 108 /** Push address of our own entry points to .fini and .init. */ 109 pushl $ libc_csu_fini 110 pushl $ libc_csu_init 111 112 pushl %ecx /** Push second argument: argv. */ 113 pushl %esi /** Push first argument: argc. */ 114 115 pushl $BP_SYM (main) 116 117 /** Call the user's main function, and exit with its value. 118 But let the libc call main. */ 119 call BP_SYM (__libc_start_main) 120 #endif 121 122 hlt /** Crash if somehow `exit' does return. */ 123 124 #ifdef SHARED 125 1: movl (%esp), %ebx 126 ret 127 #endif 128 129 /** To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so 130 meaningless since we don't support machines < 80386. */ 131 .section .rodata 132 .globl _fp_hw |