Skip to content

Commit fe15d60

Browse files
committed
Simplify _x86_64_asm_read_rflags
Signed-off-by: Joe Richey <[email protected]>
1 parent 92920d5 commit fe15d60

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/asm/asm.s

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,8 @@ _x86_64_asm_write_rflags:
135135
.global _x86_64_asm_read_rflags
136136
.p2align 4
137137
_x86_64_asm_read_rflags:
138-
pushq %rbp
139-
movq %rsp, %rbp
140138
pushfq
141139
popq %rax
142-
popq %rbp
143140
retq
144141

145142
.global _x86_64_asm_load_ss

src/registers/rflags.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ mod x86_64 {
8181

8282
#[cfg(feature = "inline_asm")]
8383
unsafe {
84-
asm!("pushf; pop {}", out(reg) r, options(nomem, preserves_flags));
84+
asm!("pushfq; pop {}", out(reg) r, options(nomem, preserves_flags));
8585
}
8686
#[cfg(not(feature = "inline_asm"))]
8787
unsafe {
@@ -122,7 +122,7 @@ mod x86_64 {
122122
// HACK: we mark this function as preserves_flags to prevent Rust from restoring
123123
// saved flags after the "popf" below. See above note on safety.
124124
#[cfg(feature = "inline_asm")]
125-
asm!("push {}; popf", in(reg) val, options(nomem, preserves_flags));
125+
asm!("push {}; popfq", in(reg) val, options(nomem, preserves_flags));
126126

127127
#[cfg(not(feature = "inline_asm"))]
128128
crate::asm::x86_64_asm_write_rflags(val);

0 commit comments

Comments
 (0)