My first attempt did not work:
Code: Select all
__asm__ ("syscall\n"::"rdi"(0), "rax"(param): "rcx", "r11");
Code: Select all
_asm__ ("syscall\n"::"D"(0), "a"(param): "rcx", "r11");
I found this documentation on local register variables that suggests you could do:
Code: Select all
register unsigned long long int syscall_num asm ("rdi") = 0;
register unsigned long long int r_param asm ("rax") = param;
__asm__ ("syscall\n"::"r"(syscall_num), "r"(r_param): "rcx", "r11");