Function of __syscall_cp In Musl Libc

131 views Asked by At

I am working with a fork of Musl libc to add to a toy operating system I am building for a project. One of the challenges is that my OS has a slightly different calling convention which has necessitated changing how arguments are added to and returned from syscalls in the Musl libc wrapper. So far, this has been fine, but I have recently come across (in sockets) usages of syscall_cp which all get funneled into inline assembly __syscall_cp.

I have been trying to see how __syscall_cp differs in functionality from a standard __syscall, but the only difference I can see is the use of an additional &self->cancel that, if it is non-zero, causes the syscall to immediatly exit.

Any insight into the differences between __syscall and __syscall_cp would be appreciated, both any other differences in functionality and when you would use __syscall_cp over __syscall (i.e. it seems to be preferred in a lot of socket functionality).

I am using arm (aarch64). The __syscall_cp implementation is http://git.musl-libc.org/cgit/musl/tree/src/thread/aarch64/syscall_cp.s, and standard syscalls are here http://git.musl-libc.org/cgit/musl/tree/arch/aarch64/syscall_arch.h. The harness that manages calling them is http://git.musl-libc.org/cgit/musl/tree/src/internal/syscall.h.

I was unable to find much information on these implementations or their usages, other than a few things about them being cancellable.

Thanks!

0

There are 0 answers