Skip to content

Commit 354c388

Browse files
authored
Merge pull request #1977 from sayantn/fix-cpuid
Panic if cpuid is called with SGX
2 parents c468038 + 2f7d8e3 commit 354c388

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/core_arch/src/x86/cpuid.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ pub struct CpuidResult {
5959
#[cfg_attr(test, assert_instr(cpuid))]
6060
#[stable(feature = "simd_x86", since = "1.27.0")]
6161
pub fn __cpuid_count(leaf: u32, sub_leaf: u32) -> CpuidResult {
62+
if cfg!(target_env = "sgx") {
63+
panic!("`__cpuid` cannot be used in SGX");
64+
}
65+
6266
let eax;
6367
let ebx;
6468
let ecx;

0 commit comments

Comments
 (0)