Skip to content

macOS syscall numbers must be adjusted #21

@NilSet

Description

@NilSet

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions