Skip to content

Commit 4e3517a

Browse files
bors[bot]Disasm
andcommitted
Merge #17
17: Update docs and bump version r=dvc94ch a=Disasm cc @rust-embedded/riscv Co-authored-by: Vadim Kaushan <[email protected]>
2 parents d67f4ac + 6c82b0a commit 4e3517a

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "riscv"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
repository = "https://github.com/rust-embedded/riscv"
55
authors = ["David Craven <[email protected]>"]
66
categories = ["embedded", "hardware-support", "no-std"]
7-
description = "Low level access to RISCV processors"
7+
description = "Low level access to RISC-V processors"
88
keywords = ["riscv", "register", "peripheral"]
99
license = "ISC"
1010

src/asm.rs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//! Assembly instructions
22
33
macro_rules! instruction {
4-
($fnname:ident, $asm:expr, $asm_fn:ident) => (
4+
($(#[$attr:meta])*, $fnname:ident, $asm:expr, $asm_fn:ident) => (
5+
$(#[$attr])*
56
#[inline]
67
pub unsafe fn $fnname() {
78
match () {
@@ -25,12 +26,35 @@ macro_rules! instruction {
2526
}
2627

2728

28-
/// Priviledged ISA Instructions
29-
instruction!(ebreak, "ebreak", __ebreak);
30-
instruction!(wfi, "wfi", __wfi);
31-
instruction!(sfence_vma_all, "sfence.vma", __sfence_vma_all);
29+
instruction!(
30+
/// `EBREAK` instruction wrapper
31+
///
32+
/// Generates a breakpoint exception.
33+
, ebreak, "ebreak", __ebreak);
34+
instruction!(
35+
/// `WFI` instruction wrapper
36+
///
37+
/// Provides a hint to the implementation that the current hart can be stalled until an interrupt might need servicing.
38+
/// The WFI instruction is just a hint, and a legal implementation is to implement WFI as a NOP.
39+
, wfi, "wfi", __wfi);
40+
instruction!(
41+
/// `SFENCE.VMA` instruction wrapper (all address spaces and page table levels)
42+
///
43+
/// Synchronizes updates to in-memory memory-management data structures with current execution.
44+
/// Instruction execution causes implicit reads and writes to these data structures; however, these implicit references
45+
/// are ordinarily not ordered with respect to loads and stores in the instruction stream.
46+
/// Executing an `SFENCE.VMA` instruction guarantees that any stores in the instruction stream prior to the
47+
/// `SFENCE.VMA` are ordered before all implicit references subsequent to the `SFENCE.VMA`.
48+
, sfence_vma_all, "sfence.vma", __sfence_vma_all);
3249

3350

51+
/// `SFENCE.VMA` instruction wrapper
52+
///
53+
/// Synchronizes updates to in-memory memory-management data structures with current execution.
54+
/// Instruction execution causes implicit reads and writes to these data structures; however, these implicit references
55+
/// are ordinarily not ordered with respect to loads and stores in the instruction stream.
56+
/// Executing an `SFENCE.VMA` instruction guarantees that any stores in the instruction stream prior to the
57+
/// `SFENCE.VMA` are ordered before all implicit references subsequent to the `SFENCE.VMA`.
3458
#[inline]
3559
#[allow(unused_variables)]
3660
pub unsafe fn sfence_vma(asid: usize, addr: usize) {

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
//! Low level access to RISCV processors
1+
//! Low level access to RISC-V processors
22
//!
33
//! This crate provides:
44
//!
55
//! - Access to core registers like mstatus or mcause.
66
//! - Interrupt manipulation mechanisms.
7-
//! - Safe wrappers around assembly instructions like `mret`.
7+
//! - Wrappers around assembly instructions like `WFI`.
88
99
#![no_std]
1010
#![deny(warnings)]

src/register/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! RISCV CSR's
1+
//! RISC-V CSR's
22
//!
33
//! The following registers are not available on 64-bit implementations.
44
//!

0 commit comments

Comments
 (0)