From 94f169a6a683829e4d81c534f5db3bdbd55f5905 Mon Sep 17 00:00:00 2001 From: aapanfilovv Date: Wed, 30 Apr 2025 20:21:32 +0300 Subject: [PATCH] fix build on x86 targets --- src/tsc_now.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tsc_now.rs b/src/tsc_now.rs index fadcfcd..c4b9d13 100644 --- a/src/tsc_now.rs +++ b/src/tsc_now.rs @@ -126,9 +126,13 @@ fn clock_source_has_tsc() -> bool { /// we should enable TSC if the system clock source is TSC. #[inline] fn has_invariant_tsc() -> bool { + #[cfg(target_arch = "x86")] + use core::arch::x86::__cpuid; + #[cfg(target_arch = "x86_64")] + use core::arch::x86_64::__cpuid; + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] unsafe { - use core::arch::x86_64::__cpuid; let cpuid_invariant_tsc_bts = 1 << 8; __cpuid(0x80000000).eax >= 0x80000007 && __cpuid(0x80000007).edx & cpuid_invariant_tsc_bts != 0