Skip to content

Commit

Permalink
Add PAUSE instruction to RISC-V core::arch
Browse files Browse the repository at this point in the history
Use `#[inline]` instead of `#[inline(always)]`
  • Loading branch information
luojia65 committed Dec 4, 2021
1 parent 6239a24 commit 1a9eec3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/core_arch/src/riscv/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
//! RISC-V intrinsics
/// Generates the `PAUSE` instruction
///
/// The PAUSE instruction is a HINT that indicates the current hart's rate of instruction retirement
/// should be temporarily reduced or paused. The duration of its effect must be bounded and may be zero.
#[inline]
pub fn pause() {
unsafe { asm!(".word 0x0100000F", options(nomem, nostack)) }
}

0 comments on commit 1a9eec3

Please sign in to comment.