Note · evergreen
The MIPS n32 syscall table is not n64 plus 1000
- Stage
- evergreen
- Links
- 1 out, 1 in
Linux on MIPS numbers its system calls in three ranges, one per ABI: o32 from 4000, n64 from 5000, n32 from 6000. It is tempting to generate the n32 table by adding 1000 to the n64 one.
That is wrong for 140 entries. The two tables diverge wherever n32 needs a different call from n64, and the offsets drift apart from there.
I found this porting relibc, the C library written in Rust for Redox, to big-endian n32 for IRIX 7. The port generates its 369 syscall constants from the kernel’s own unistd_n32.h.
The rest of the port was small: 23 files and about 220 added lines. Redox-only dependencies had to be made conditional, the thread-control-block, clone and setjmp hooks written for MIPS, and a custom Rust target supplied, because the compiler has none for n32. Hello world, thread-local storage, setjmp and pthreads all pass under QEMU’s n32 user mode.
It is static only, signal types are placeholders, and 64-bit syscall arguments are truncated, so it is a demonstration that the route works and not yet a library to depend on.
Projects
- IRIX 7 A Rust operating system for the SGI Indy, meant to run IRIX 6.5 applications unchanged.
Projects
- IRIX 7 A Rust operating system for the SGI Indy, meant to run IRIX 6.5 applications unchanged.