Skip to content

Commit

Permalink
fix(interrupts): add preserves_flags option
Browse files Browse the repository at this point in the history
`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 <martin.kroening@eonerc.rwth-aachen.de>
  • Loading branch information
mkroening committed Oct 10, 2023
1 parent f0b43a8 commit 010568a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/instructions/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn enable() {
// Otherwise, the compiler is free to move
// reads and writes through this asm block.
unsafe {
asm!("sti", options(nostack));
asm!("sti", options(preserves_flags, nostack));
}
}

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

Expand Down

0 comments on commit 010568a

Please sign in to comment.