aboutsummaryrefslogtreecommitdiff
path: root/base/runtime/entry_unix_no_crt_darwin_arm64.asm
blob: 0f71fbdf86e2802b5dce4c20f6e17295501c2918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
	.section __TEXT,__text

	; NOTE(laytan): this should ideally be the -minimum-os-version flag but there is no nice way of preprocessing assembly in Odin.
	; 10 seems to be the lowest it goes and I don't see it mess with any targeted os version so this seems fine.
	.build_version macos, 10, 0

	.extern __start_odin

	.global _main
	.align 2
_main:
	mov x5, sp       ; use x5 as the stack pointer

	str x0, [x5]     ; get argc into x0 (kernel passes 32-bit int argc as 64-bits on stack to keep alignment)
	str x1, [x5, #8] ; get argv into x1

	and sp, x5, #~15 ; force 16-byte alignment of the stack
	
	bl __start_odin  ; call into Odin entry point
	ret              ; should never get here