If we want to detect user level processor features under Unix-like platforms, we would use auxvec
where some features can be judged from which bit of returned bitset is set. But there are some features that can't be detected this way. It would either be a RISC-V ISA modules (like Zfh
or Zks
, other than F
, K
etc), or some ARM features (ARM7 tick, ref at OpenSSL).
Some libraries under C world (OpenSSL etc.) uses signal catching as a method to detect such features. It registers a signal handler, execute instructions as if it exists, and catch probable illegal instruction signal if that instruction does not exist. It would provide more accurate instruction set information, but none of the is_xxx_feature_detected!
in current Rust standard library uses this way. This method could be of significant use under RISC-V architecture, where furtherly bare metal Rust can detect instruction sets under trap vector handling (ref: zihai hypervisor).
Will it be appropriate to implement is_xxx_feature_detected!
under signal catching in Linux? If current Rust does not write standard library macro in this way, what could be the reason? Thanks!