syscalls
syscalls copied to clipboard
Implementing `sparc` and `sparc64` support
Hi, it seems like there's no support for sparc or sparc64 architectures currently. What would be the steps to implement support for making syscalls on them? Would it be possible to incorporate the required assembly code from similar Rust libraries?
As long as Rust supports inline assembly on sparc and sparc64, there's nothing blocking it.
If you're interested in implementing this yourself, here's what needs to be done:
- Add building/testing for sparc/sparc64 to CI: https://github.com/jasonwhite/syscalls/blob/288d146210fd378999d0f825ffef9cb3a002f38e/.github/workflows/ci.yml#L40-L41 It looks like cargo-cross now supports sparc64 with
sparc64-unknown-linux-gnu, but notsparc. - Modify
src/syscall/sparc.rsandsrc/syscall/sparc64.rsto add the implementation.
Here are some helpful references when implementing syscalls with inline assembly:
- https://man7.org/linux/man-pages/man2/syscall.2.html
- glibc generic stuff for sparc32/sparc64: https://elixir.bootlin.com/glibc/latest/source/sysdeps/unix/sysv/linux/sparc/sysdep.h
- glibc sparc32-specific stuff: https://elixir.bootlin.com/glibc/latest/source/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
- glibc sparc64-specific stuff: https://elixir.bootlin.com/glibc/latest/source/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
Normally the musl libc code is a better reference than glibc, but they don't have support for sparc/sparc64 it seems.