Skip to content

Commit 39be34d

Browse files
committed
fixup
1 parent 9bc28f6 commit 39be34d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/x86/misc.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,15 @@ pub unsafe fn cpuid(eax: u32, ecx: u32) -> CpuidResult {
5151
#[inline(always)]
5252
pub unsafe fn pushfd() -> u32 {
5353
let eflags: u32;
54-
asm!("pushfd"); // FIXME: this clobbers the stack
55-
asm!("popl %eax" : "={eax}"(eflags) : : "eax" : "volatile");
54+
asm!("pushfd; popl $0" : "=r"(eflags) : : : "volatile");
5655
eflags
5756
}
5857

5958
/// Write EFLAGS.
6059
#[cfg(target_arch = "x86")]
6160
#[inline(always)]
6261
pub unsafe fn popfd(eflags: u32) {
63-
asm!("pushl %eax" : : "{eax}"(eflags) : "flags" : "volatile");
64-
asm!("popfd");
62+
asm!("pushl $0; popfd" : : "r"(eflags) : "cc", "flags" : "volatile");
6563
}
6664

6765
/// Does the host support the `cpuid` instruction?

0 commit comments

Comments
 (0)