ports/gaspardos64/crt0.asm¶
System V ELF startup that passes the optional GO64_StartInfo argument record to the C runtime.
Source files · Download crt0.asm
bits 64
default rel
section .text
global _start
extern gaspardos_start
_start:
cld
; Optional GO64_StartInfo lives above initial RSP in the mapped user stack.
; Retain the historical fallback for loaders that pass RDI=0.
mov rax,rdi
xor edi,edi
xor esi,esi
test rax,rax
jz .ready
cmp rax,rsp
jb .ready
mov rdx,0x00007ffffff00000-24
cmp rax,rdx
ja .ready
mov rcx,0x474f363441524753
cmp [rax],rcx
jne .ready
cmp qword [rax+8],1
jb .ready
cmp qword [rax+8],20
ja .ready
mov rdi,[rax+8]
mov rsi,[rax+16]
.ready:
and rsp,-16
call gaspardos_start
ud2
section .note.GNU-stack noalloc noexec nowrite progbits