ref: d8959a4a6d41b0a1328d81eef7c29d10ec669f8e
dir: /lib/thread/exit+freebsd-x64.s/
/* const thread.exit : (stacksz : std.size -> void) NOTE: must be called from the bottom of the stack, since we assume that %rbp is in the top 4k of the stack. */ .globl thread$exit thread$exit: /* find top of stack */ movq %rbp,%rdi /* addr */ andq $~0xfff,%rdi /* align it */ addq $0x1000,%rdi /* munmap(base, size) */ movq $73,%rax /* munmap */ movq -8(%rdi),%rsi /* size */ subq %rsi,%rdi /* move to base ptr */ syscall /* thr_exit(null) */ movq $431,%rax /* exit */ xorq %rdi,%rdi /* 0 */ syscall