I have the following inline assembly which used to work in Rust, but it seems there has been some changes to the syntax, and it throws error at "={ecx}(features)
with the message expected type
. How can I rewrite this in new assembly syntax?
use std::arch::asm;
let features: u32;
unsafe {
asm!("mov eax, 1
cpuid"
: "={ecx}"(features)
:
: "eax"
: "intel"
);
}
let support: u32 = (features >> 25) & 1;
CodePudding user response:
Try this:
use std::arch::asm;
fn main() {
let features: u32;
unsafe {
asm!("mov eax, 1",
"cpuid",
out("ecx") features,
out("eax") _
);
}
println!("features: {:x}", features);
}