Skip to content

Commit bd4ae17

Browse files
committed
[x86] expose __cpuid, __cpuid_count, xgetbv, __readeflags, __writeeflags
Expose the `__cpuid` and `_xgetby` `x86`/`x86_64` intrinsics. The `__cpuid` and `__cpuid_count` intrinsics are not available on all `x86` CPUs. The `has_cpuid() -> bool` intrinsic detect this on non `x86_64` hosts. For convenience, this is exposed on `x86_64` as well but there it always returns `true`. These are exposed by Clang and GCC. The `__readeflags` and `__writeeflags` intrinsics, which read/write the `EFLAGS` register and are required to implement `has_cpuid`, are exposed as well. GCC and Clang exposes them too. When doing run-time feature detection for `x86`/`x86_64` we now properly check whether the `cpuid` instruction is available before using it. If it is not available, are features are exposes as "not available". One TODO: - The `_xgetbv` intrinsic requires the `xsave` target feature but this is not currently exposed by rustc, see #167 .
1 parent 1fd0066 commit bd4ae17

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)