Add syscall functions
Draft for resolving https://github.com/bytecodealliance/rustix/issues/1055
If the outlined approach is acceptable, I will port the remaining arches and tweak the gen crate.
I am not sure what to do with x86. Duplicating the vDSO stuff looks a bit too heavy, while using int 0x80 would be too inefficient. We could use the GS register with 0x10 offset, but IIUC it relies on C runtime, which may not be present in some rare cases and the offset may not be stable across platforms. After cursory reading it looks like we could use the sysenter instruction, it's performance should be comparable to vDSO, but I wonder why it was not used in the rustix crate.
The sysenter instruction isn't available in 32-bit mode on all x86 CPUs. Linux's vDSO knows how to pick between the sysenter, syscall, and int 0x80 instructions depending on the CPU architecture. This is another reason why I wouldn't want raw syscall knowledge to spread around to general-purpose crates.
As I mentioned in my comment in https://github.com/bytecodealliance/rustix/issues/1055, I would prefer not to take the approach in this PR.
The sysenter instruction isn't available in 32-bit mode on all x86 CPUs
Are these CPUs supported by Rust in the first place?
Looking at this page, the choice of sysenter vs. syscall still depends on whether the kernel is 32-bit or 64-bit. My understanding is that Rust's i686 target is expected to work on either kind of kernel.