2022-10-01 18:59:22 +00:00
|
|
|
section .text
|
|
|
|
|
|
|
|
extern _init
|
|
|
|
extern main
|
|
|
|
extern _fini
|
2022-10-11 19:08:46 +00:00
|
|
|
extern initialize_libc
|
2022-10-01 18:59:22 +00:00
|
|
|
extern exit
|
|
|
|
|
|
|
|
global _start
|
|
|
|
_start:
|
|
|
|
; Set up end of the stack frame linked list.
|
|
|
|
xor rbp, rbp
|
|
|
|
push rbp ; rip=0
|
|
|
|
push rbp ; rbp=0
|
|
|
|
mov rbp, rsp
|
|
|
|
|
2022-10-11 19:08:46 +00:00
|
|
|
call initialize_libc
|
|
|
|
|
2022-10-01 18:59:22 +00:00
|
|
|
call _init
|
|
|
|
|
|
|
|
mov rdi, 0 ; argc = 0
|
|
|
|
mov rsi, 0 ; argv = 0
|
|
|
|
|
|
|
|
call main
|
|
|
|
|
|
|
|
push rax
|
|
|
|
|
|
|
|
call _fini
|
|
|
|
|
|
|
|
pop rdi
|
|
|
|
|
|
|
|
call exit
|