1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#define SYS_exit 0x3c .text .weak exit exit: .global _exit _exit: mov $SYS_exit,%al .global __unified_syscall __unified_syscall: movzbl %al, %eax mov %rcx, %r10 syscall cmpq $-128, %rax jbe .Lnoerror negl %eax pushq %rax call __errno_location popq %rcx movl %ecx,(%rax) orq $-1, %rax .Lnoerror: ret .Lhere: .size __unified_syscall,.Lhere-__unified_syscall