http://netbsd.i2p/gallery/presentations/maya/asiabsdcon-2019-golang-netbsd-arm64.html
Simple implementation: exit x86_64: // Exit the entire program (like C exit)
TEXT runtime·exit(SB),NOSPLIT,$-8
MOVL code+0(FP), DI // arg 1 - exit status
MOVL $1, AX // sys_exit
SYSCALL
MOVL $0xf1, 0xf1 // crash
RET arm64: #define SYS_exit 1
// Exit the entire program (like C exit)
TEXT runtime·exit(SB),NOSPLIT,$-8
MOVD code+0(FP), R0 // arg 1 - exit status
SVC ...