_nx_xlate_probe.nx source
↩ module page · 11 lines · 577 B
1// Discriminator for the rv64->x86 syscall translation capability (debt 1785528831).
2// __syscall(51,...) is rv64 CHROOT. If the toolchain carries the 51->161 row it emits
3// x86 chroot(161): chroot(NULL) returns -EFAULT(14) or -EPERM(1). If the row is MISSING
4// the number passes through verbatim as x86 51 = GETSOCKNAME, and getsockname(0,NULL,NULL)
5// returns -ENOTSOCK(88) because fd 0 is not a socket. 88 is the untranslated signature.
6func main() -> i64 {
7 let r: i64 = __syscall(51, 0, 0, 0, 0, 0, 0)
8 var v: i64 = 0 - r
9 if v < 0 { v = 0 - v }
10 return v
11}