We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 950a941 commit 71375b1Copy full SHA for 71375b1
src/instructions/interrupts.rs
@@ -1,6 +1,7 @@
1
//! Enabling and disabling interrupts
2
3
use core::arch::asm;
4
+use core::sync::atomic::{Ordering, compiler_fence};
5
6
/// Returns whether interrupts are enabled.
7
#[inline]
@@ -15,6 +16,8 @@ pub fn are_enabled() -> bool {
15
16
/// This is a wrapper around the `sti` instruction.
17
18
pub fn enable() {
19
+ // Prevent earlier writes to be moved beyond this point
20
+ compiler_fence(Ordering::Release);
21
unsafe {
22
asm!("sti", options(nomem, nostack));
23
}
@@ -25,6 +28,8 @@ pub fn enable() {
25
28
/// This is a wrapper around the `cli` instruction.
26
29
27
30
pub fn disable() {
31
+ // Prevent future writes to be moved before this point.
32
+ compiler_fence(Ordering::Acquire);
33
34
asm!("cli", options(nomem, nostack));
35
0 commit comments