4 ms·
> I will be using the Linux system call values, but ‘porting’ this program to, say, FreeBSD, would only require to change those values Is that true? I remembe
by asveikau 3y ago
> I will be using the Linux system call values, but ‘porting’ this program to, say, FreeBSD, would only require to change those values
Is that true? I remember ~20 years ago I was looking at the i386 syscall ABIs (since amd64 wasn't big then), and there, Linux syscalls passed arguments by register and FreeBSD passed them on the stack. Maybe for amd64, FreeBSD switched to pass by register on Intel, but I wouldn't assume a syscall ABI is such a quick and simple substitution.
- bitshiffed 3y agoFor amd64 they both use the same registers to pass arguments. But, the BSD syscalls use the carry flag to indicate error, rather than the returned value of rax being negative. If your syscalls always succeed, and never return values within what would be a negative range as a signed value, then the code would run; but that's not exactly "portable".