File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -58,3 +58,53 @@ pub fn wfi() {
5858 ( ) => { }
5959 }
6060}
61+
62+ /// Instruction Synchronization Barrier
63+ ///
64+ /// Flushes the pipeline in the processor, so that all instructions following the `ISB` are fetched
65+ /// from cache or memory, after the instruction has been completed.
66+ pub fn isb ( ) {
67+ match ( ) {
68+ #[ cfg( target_arch = "arm" ) ]
69+ ( ) => unsafe {
70+ asm ! ( "isb 0xF" : : : "memory" : "volatile" ) ;
71+ } ,
72+ #[ cfg( not( target_arch = "arm" ) ) ]
73+ ( ) => { }
74+ }
75+ }
76+
77+ /// Data Synchronization Barrier
78+ ///
79+ /// Acts as a special kind of memory barrier. No instruction in program order after this
80+ /// instruction can execute until this instruction completes. This instruction completes only when
81+ /// both:
82+ ///
83+ /// * any explicit memory access made before this instruction is complete
84+ /// * all cache and branch predictor maintenance operations before this instruction complete
85+ pub fn dsb ( ) {
86+ match ( ) {
87+ #[ cfg( target_arch = "arm" ) ]
88+ ( ) => unsafe {
89+ asm ! ( "dsb 0xF" : : : "memory" : "volatile" ) ;
90+ } ,
91+ #[ cfg( not( target_arch = "arm" ) ) ]
92+ ( ) => { }
93+ }
94+ }
95+
96+ /// Data Memory Barrier
97+ ///
98+ /// Ensures that all explicit memory accesses that appear in program order before the `DMB`
99+ /// instruction are observed before any explicit memory accesses that appear in program order
100+ /// after the `DMB` instruction.
101+ pub fn dmb ( ) {
102+ match ( ) {
103+ #[ cfg( target_arch = "arm" ) ]
104+ ( ) => unsafe {
105+ asm ! ( "dmb 0xF" : : : "memory" : "volatile" ) ;
106+ } ,
107+ #[ cfg( not( target_arch = "arm" ) ) ]
108+ ( ) => { }
109+ }
110+ }
You can’t perform that action at this time.
0 commit comments