Syscall from inline asm in x86_64 Linux?
问题 Why does this print garbage instead of exiting my program gracefully? I use system calls this way on BSD, and I wonder what would I need to make it work in Linux. int main(int argc, char **argv) { __asm ("movq $1,%rax; movq $0,%rdi; syscall"); /* exit(0) ? */ return 0; } Thanks. 回答1: Why does this print garbage instead of exiting my program gracefully? Per CESA-2009-001, "Syscall 1 is exit on i386 but write on x86_64". what would I need to make it work in Linux Use the syscall ordinals from