We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9bc28f6 commit 39be34dCopy full SHA for 39be34d
src/x86/misc.rs
@@ -51,17 +51,15 @@ pub unsafe fn cpuid(eax: u32, ecx: u32) -> CpuidResult {
51
#[inline(always)]
52
pub unsafe fn pushfd() -> u32 {
53
let eflags: u32;
54
- asm!("pushfd"); // FIXME: this clobbers the stack
55
- asm!("popl %eax" : "={eax}"(eflags) : : "eax" : "volatile");
+ asm!("pushfd; popl $0" : "=r"(eflags) : : : "volatile");
56
eflags
57
}
58
59
/// Write EFLAGS.
60
#[cfg(target_arch = "x86")]
61
62
pub unsafe fn popfd(eflags: u32) {
63
- asm!("pushl %eax" : : "{eax}"(eflags) : "flags" : "volatile");
64
- asm!("popfd");
+ asm!("pushl $0; popfd" : : "r"(eflags) : "cc", "flags" : "volatile");
65
66
67
/// Does the host support the `cpuid` instruction?
0 commit comments