Skip to content

Commit

Permalink
Merge pull request #44 from niklasf/ensure-cpuid
Browse files Browse the repository at this point in the history
Break compilation on SGX and 32-bit x86 without SSE (fixes #41)
  • Loading branch information
gz committed Jan 21, 2021
2 parents 582b6d7 + 147cf9c commit 643c4d8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib.rs
Expand Up @@ -19,12 +19,14 @@ extern crate bitflags;
pub mod native_cpuid {
use super::CpuIdResult;

#[cfg(target_arch = "x86")]
#[cfg(all(target_arch = "x86", not(target_env = "sgx"), target_feature = "sse"))]
use core::arch::x86 as arch;
#[cfg(target_arch = "x86_64")]
#[cfg(all(target_arch = "x86_64", not(target_env = "sgx")))]
use core::arch::x86_64 as arch;

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

CpuIdResult {
Expand Down

0 comments on commit 643c4d8

Please sign in to comment.