Skip to content

Commit 147cf9c

Browse files
committed
Break compilation on SGX and 32-bit x86 without SSE (fixes #41)
1 parent 441d109 commit 147cf9c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ extern crate bitflags;
1919
pub mod native_cpuid {
2020
use super::CpuIdResult;
2121

22-
#[cfg(target_arch = "x86")]
22+
#[cfg(all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"))]
2323
use core::arch::x86 as arch;
24-
#[cfg(target_arch = "x86_64")]
24+
#[cfg(all(target_arch = "x86_64", not(target_env = "sgx")))]
2525
use core::arch::x86_64 as arch;
2626

2727
pub fn cpuid_count(a: u32, c: u32) -> CpuIdResult {
28+
// Safety: CPUID is supported on all x86_64 CPUs and all x86 CPUs with
29+
// SSE, but not by SGX.
2830
let result = unsafe { self::arch::__cpuid_count(a, c) };
2931

3032
CpuIdResult {

0 commit comments

Comments
 (0)