Skip to content

Commit 745e7fc

Browse files
committed
fix(interrupts): add preserves_flags option
`IF` from `EFLAGS` must not be restored upon exiting the asm block. https://doc.rust-lang.org/stable/reference/inline-assembly.html#rules-for-inline-assembly Signed-off-by: Martin Kröning <[email protected]>
1 parent bb1bdd4 commit 745e7fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/instructions/interrupts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn enable() {
1818
// Omit `nomem` to imitate a lock release. Otherwise, the compiler
1919
// is free to move reads and writes through this asm block.
2020
unsafe {
21-
asm!("sti", options(nostack));
21+
asm!("sti", options(preserves_flags, nostack));
2222
}
2323
}
2424

@@ -30,7 +30,7 @@ pub fn disable() {
3030
// Omit `nomem` to imitate a lock acquire. Otherwise, the compiler
3131
// is free to move reads and writes through this asm block.
3232
unsafe {
33-
asm!("cli", options(nostack));
33+
asm!("cli", options(preserves_flags, nostack));
3434
}
3535
}
3636

0 commit comments

Comments
 (0)