1
1
//! Assembly instructions
2
2
3
3
macro_rules! instruction {
4
- ( $fnname: ident, $asm: expr, $asm_fn: ident) => (
4
+ ( $( #[ $attr: meta] ) * , $fnname: ident, $asm: expr, $asm_fn: ident) => (
5
+ $( #[ $attr] ) *
5
6
#[ inline]
6
7
pub unsafe fn $fnname( ) {
7
8
match ( ) {
@@ -25,12 +26,35 @@ macro_rules! instruction {
25
26
}
26
27
27
28
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) ;
32
49
33
50
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`.
34
58
#[ inline]
35
59
#[ allow( unused_variables) ]
36
60
pub unsafe fn sfence_vma ( asid : usize , addr : usize ) {
0 commit comments