entry_unix_no_crt_darwin_arm64.asm 691 B

1234567891011121314151617181920
  1. .section __TEXT,__text
  2. ; NOTE(laytan): this should ideally be the -minimum-os-version flag but there is no nice way of preprocessing assembly in Odin.
  3. ; 10 seems to be the lowest it goes and I don't see it mess with any targeted os version so this seems fine.
  4. .build_version macos, 10, 0
  5. .extern __start_odin
  6. .global _main
  7. .align 2
  8. _main:
  9. mov x5, sp ; use x5 as the stack pointer
  10. str x0, [x5] ; get argc into x0 (kernel passes 32-bit int argc as 64-bits on stack to keep alignment)
  11. str x1, [x5, #8] ; get argv into x1
  12. and sp, x5, #~15 ; force 16-byte alignment of the stack
  13. bl __start_odin ; call into Odin entry point
  14. ret ; should never get here