syscall.rs icon indicating copy to clipboard operation
syscall.rs copied to clipboard

macOS syscall numbers must be adjusted

Open NilSet opened this issue 6 years ago • 0 comments

Crossposting from parent project: https://github.com/kmcallister/syscall.rs/issues/24 https://github.com/kmcallister/syscall.rs/issues/29

The issue is that for macos syscalls, they require that you also pack in an indicator which type of syscall it is. This should probably work:

syscall::platform::syscall4(
        syscall::platform::nr::SENDFILE | (2usize<<24),
        out_fd as usize,
        in_fd as usize,
        0,
        count as usize);

2<<24 marks it as a unix syscall. There are also mach style syscalls which I believe are less documented. https://opensource.apple.com/source/xnu/xnu-4570.41.2/osfmk/mach/i386/syscall_sw.h.auto.html https://filippo.io/making-system-calls-from-assembly-in-mac-os-x/

NilSet avatar Jul 20 '18 03:07 NilSet