Skip to content

Commit 1a9eec3

Browse files
committed
Add PAUSE instruction to RISC-V core::arch
Use `#[inline]` instead of `#[inline(always)]`
1 parent 6239a24 commit 1a9eec3

File tree

1 file changed

+9
-0
lines changed
  • crates/core_arch/src/riscv

1 file changed

+9
-0
lines changed

crates/core_arch/src/riscv/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
11
//! RISC-V intrinsics
2+
3+
/// Generates the `PAUSE` instruction
4+
///
5+
/// The PAUSE instruction is a HINT that indicates the current hart's rate of instruction retirement
6+
/// should be temporarily reduced or paused. The duration of its effect must be bounded and may be zero.
7+
#[inline]
8+
pub fn pause() {
9+
unsafe { asm!(".word 0x0100000F", options(nomem, nostack)) }
10+
}

0 commit comments

Comments
 (0)