3 ms·
If the asm was written a little more cleverly, the syscalls would avoid almost all moves, because the compiler'd put everything in place: _syscall5: mov
by beeforpork 10y ago
If the asm was written a little more cleverly, the syscalls would avoid almost all moves, because the compiler'd put everything in place:
_syscall5:
mov %r9, %r10
_syscall3:
mov %rcx, %rax
syscall
ret
And then:
extern unsigned long _syscall3(
unsigned long, unsigned long,
unsigned long, unsigned long);
extern unsigned long _syscall5(
unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long, unsigned long);
#define syscall0(NUM) _syscall3(0,0,0,NUM)
#define syscall1(NUM,A) _syscall3(A,0,0,NUM)
#define syscall2(NUM,A,B) _syscall3(A,B,0,NUM)
#define syscall3(NUM,A,B,C) _syscall3(A,B,C,NUM)
#define syscall4(NUM,A,B,C,D) _syscall5(A,B,C,NUM,0,D)
#define syscall5(NUM,A,B,C,D,E) _syscall5(A,B,C,NUM,E,D)
- ant6n 10y agoIs that going to be inlined properly?