Skip to content

Commit 4341cf5

Browse files
authored
fix: use proper import path for __cpuid on x86 arch (#6)
1 parent 4f330f8 commit 4341cf5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/tsc_now.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,13 @@ fn clock_source_has_tsc() -> bool {
126126
/// we should enable TSC if the system clock source is TSC.
127127
#[inline]
128128
fn has_invariant_tsc() -> bool {
129+
#[cfg(target_arch = "x86")]
130+
use core::arch::x86::__cpuid;
131+
#[cfg(target_arch = "x86_64")]
132+
use core::arch::x86_64::__cpuid;
133+
129134
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
130135
unsafe {
131-
use core::arch::x86_64::__cpuid;
132136
let cpuid_invariant_tsc_bts = 1 << 8;
133137
__cpuid(0x80000000).eax >= 0x80000007
134138
&& __cpuid(0x80000007).edx & cpuid_invariant_tsc_bts != 0

0 commit comments

Comments
 (0)