diff options
| author | Aleksa Vučković <aleksav013@gmail.com> | 2022-01-13 01:17:04 +0100 |
|---|---|---|
| committer | Aleksa Vučković <aleksav013@gmail.com> | 2022-01-13 01:17:19 +0100 |
| commit | 8e377d9241ed4098b58d3531c80aa2c0cb285077 (patch) | |
| tree | f358d47a143258902b6b4f54d284dce31b083518 /files/crt0.s | |
| parent | 0daf9be64d6e5ef7c3e2883254d4982120488566 (diff) | |
bugfixes and additions
Diffstat (limited to 'files/crt0.s')
| -rw-r--r-- | files/crt0.s | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/files/crt0.s b/files/crt0.s new file mode 100644 index 0000000..8c735f1 --- /dev/null +++ b/files/crt0.s @@ -0,0 +1,31 @@ +.section .text + +.global _start +_start: + # Set up end of the stack frame linked list. + movl $0, %ebp + pushl %ebp # rip=0 + pushl %ebp # rbp=0 + movl %esp, %ebp + + # We need those in a moment when we call main. + pushl %esi + pushl %edi + + # Prepare signals, memory allocation, stdio and such. +# call initialize_standard_library + + # Run the global constructors. + call _init + + # Restore argc and argv. + popl %edi + popl %esi + + # Run main + call main + + # Terminate the process with the exit code. + movl %eax, %edi +# call exit +.size _start, . - _start |
