gz / rust-x86

Rust library to use x86 (amd64) specific functionality and registers.
https://docs.rs/x86
MIT License
303 stars 63 forks source link

The rdtscp function should return the value in the IA32_TSC_AUX MSR #124

Closed iankronquist closed 2 years ago

iankronquist commented 2 years ago

The x86 rdtscp instruction puts the value of the current time step counter into eax:edx and the value of the IA32_TSC_AUX msr into ecx. However, the rust __rdtscp intrinsic does not return the value of IA32_TSC_AUX. The value of IA32_TSC_AUX is useful for a variety of reasons, but most notably it's the easiest way to get the current core id from userland. Getting this information atomically in one instruction can be useful for implementing certain types of fair locks too.

This crate should give us all of the information returned by the rdtscp instruction

gz commented 2 years ago

This has been implemented and is released in x86 version 0.50.0