9
9
10
10
mod sealed {
11
11
pub trait Dmb {
12
- unsafe fn __dmb ( & self ) ;
12
+ fn __dmb ( & self ) ;
13
13
}
14
14
15
15
pub trait Dsb {
16
- unsafe fn __dsb ( & self ) ;
16
+ fn __dsb ( & self ) ;
17
17
}
18
18
19
19
pub trait Isb {
20
- unsafe fn __isb ( & self ) ;
20
+ fn __isb ( & self ) ;
21
21
}
22
22
}
23
23
24
24
macro_rules! dmb_dsb {
25
25
( $A: ident) => {
26
26
impl sealed:: Dmb for $A {
27
27
#[ inline( always) ]
28
- unsafe fn __dmb( & self ) {
28
+ fn __dmb( & self ) {
29
29
match ( ) {
30
30
#[ cfg( target_arch = "aarch64" ) ]
31
- ( ) => {
31
+ ( ) => unsafe {
32
32
core:: arch:: asm!( concat!( "DMB " , stringify!( $A) ) , options( nostack) )
33
- }
33
+ } ,
34
34
35
35
#[ cfg( not( target_arch = "aarch64" ) ) ]
36
36
( ) => unimplemented!( ) ,
@@ -39,12 +39,12 @@ macro_rules! dmb_dsb {
39
39
}
40
40
impl sealed:: Dsb for $A {
41
41
#[ inline( always) ]
42
- unsafe fn __dsb( & self ) {
42
+ fn __dsb( & self ) {
43
43
match ( ) {
44
44
#[ cfg( target_arch = "aarch64" ) ]
45
- ( ) => {
45
+ ( ) => unsafe {
46
46
core:: arch:: asm!( concat!( "DSB " , stringify!( $A) ) , options( nostack) )
47
- }
47
+ } ,
48
48
49
49
#[ cfg( not( target_arch = "aarch64" ) ) ]
50
50
( ) => unimplemented!( ) ,
@@ -64,46 +64,38 @@ dmb_dsb!(SY);
64
64
65
65
impl sealed:: Isb for SY {
66
66
#[ inline( always) ]
67
- unsafe fn __isb ( & self ) {
67
+ fn __isb ( & self ) {
68
68
match ( ) {
69
69
#[ cfg( target_arch = "aarch64" ) ]
70
- ( ) => {
71
- core:: arch:: asm!( "ISB SY" , options( nostack) )
72
- }
70
+ ( ) => unsafe { core:: arch:: asm!( "ISB SY" , options( nostack) ) } ,
73
71
74
72
#[ cfg( not( target_arch = "aarch64" ) ) ]
75
73
( ) => unimplemented ! ( ) ,
76
74
}
77
75
}
78
76
}
79
77
80
- /// # Safety
81
- ///
82
- /// In your own hands, this is hardware land!
78
+ /// Data Memory Barrier.
83
79
#[ inline( always) ]
84
- pub unsafe fn dmb < A > ( arg : A )
80
+ pub fn dmb < A > ( arg : A )
85
81
where
86
82
A : sealed:: Dmb ,
87
83
{
88
84
arg. __dmb ( )
89
85
}
90
86
91
- /// # Safety
92
- ///
93
- /// In your own hands, this is hardware land!
87
+ /// Data Synchronization Barrier.
94
88
#[ inline( always) ]
95
- pub unsafe fn dsb < A > ( arg : A )
89
+ pub fn dsb < A > ( arg : A )
96
90
where
97
91
A : sealed:: Dsb ,
98
92
{
99
93
arg. __dsb ( )
100
94
}
101
95
102
- /// # Safety
103
- ///
104
- /// In your own hands, this is hardware land!
96
+ /// Instruction Synchronization Barrier.
105
97
#[ inline( always) ]
106
- pub unsafe fn isb < A > ( arg : A )
98
+ pub fn isb < A > ( arg : A )
107
99
where
108
100
A : sealed:: Isb ,
109
101
{
0 commit comments