Skip to content

Commit 010568a

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 f0b43a8 commit 010568a

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
@@ -19,7 +19,7 @@ pub fn enable() {
1919
// Otherwise, the compiler is free to move
2020
// reads and writes through this asm block.
2121
unsafe {
22-
asm!("sti", options(nostack));
22+
asm!("sti", options(preserves_flags, nostack));
2323
}
2424
}
2525

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

0 commit comments

Comments
 (0)