@@ -7,7 +7,7 @@ macro_rules! read_csr {
7
7
#[ cfg( all( riscv, feature = "inline-asm" ) ) ]
8
8
( ) => {
9
9
let r: usize ;
10
- llvm_asm !( "csrrs $0, $1 , x0" : "=r" ( r ) : "i" ( $csr_number) :: "volatile" ) ;
10
+ core :: arch :: asm !( "csrrs {0}, {1} , x0" , out ( reg ) r , const $csr_number) ;
11
11
r
12
12
}
13
13
@@ -36,7 +36,7 @@ macro_rules! read_csr_rv32 {
36
36
#[ cfg( all( riscv32, feature = "inline-asm" ) ) ]
37
37
( ) => {
38
38
let r: usize ;
39
- llvm_asm !( "csrrs $0, $1 , x0" : "=r" ( r ) : "i" ( $csr_number) :: "volatile" ) ;
39
+ core :: arch :: asm !( "csrrs {0}, {1} , x0" , out ( reg ) r , const $csr_number) ;
40
40
r
41
41
}
42
42
@@ -102,7 +102,7 @@ macro_rules! write_csr {
102
102
unsafe fn _write( bits: usize ) {
103
103
match ( ) {
104
104
#[ cfg( all( riscv, feature = "inline-asm" ) ) ]
105
- ( ) => llvm_asm !( "csrrw x0, $1, $0" :: "r" ( bits ) , "i" ( $csr_number) :: "volatile" ) ,
105
+ ( ) => core :: arch :: asm !( "csrrw x0, {1}, {0}" , in ( reg ) bits , const $csr_number) ,
106
106
107
107
#[ cfg( all( riscv, not( feature = "inline-asm" ) ) ) ]
108
108
( ) => {
@@ -128,7 +128,7 @@ macro_rules! write_csr_rv32 {
128
128
unsafe fn _write( bits: usize ) {
129
129
match ( ) {
130
130
#[ cfg( all( riscv32, feature = "inline-asm" ) ) ]
131
- ( ) => llvm_asm !( "csrrw x0, $1, $0" :: "r" ( bits ) , "i" ( $csr_number) :: "volatile" ) ,
131
+ ( ) => core :: arch :: asm !( "csrrw x0, {1}, {0}" , in ( reg ) bits , const $csr_number) ,
132
132
133
133
#[ cfg( all( riscv32, not( feature = "inline-asm" ) ) ) ]
134
134
( ) => {
@@ -178,7 +178,7 @@ macro_rules! set {
178
178
unsafe fn _set( bits: usize ) {
179
179
match ( ) {
180
180
#[ cfg( all( riscv, feature = "inline-asm" ) ) ]
181
- ( ) => llvm_asm !( "csrrs x0, $1, $0" :: "r" ( bits ) , "i" ( $csr_number) :: "volatile" ) ,
181
+ ( ) => core :: arch :: asm !( "csrrs x0, {1}, {0}" , in ( reg ) bits , const $csr_number) ,
182
182
183
183
#[ cfg( all( riscv, not( feature = "inline-asm" ) ) ) ]
184
184
( ) => {
@@ -204,7 +204,7 @@ macro_rules! clear {
204
204
unsafe fn _clear( bits: usize ) {
205
205
match ( ) {
206
206
#[ cfg( all( riscv, feature = "inline-asm" ) ) ]
207
- ( ) => llvm_asm !( "csrrc x0, $1, $0" :: "r" ( bits ) , "i" ( $csr_number) :: "volatile" ) ,
207
+ ( ) => core :: arch :: asm !( "csrrc x0, {1}, {0}" , in ( reg ) bits , const $csr_number) ,
208
208
209
209
#[ cfg( all( riscv, not( feature = "inline-asm" ) ) ) ]
210
210
( ) => {
@@ -229,7 +229,7 @@ macro_rules! set_csr {
229
229
pub unsafe fn $set_field( ) {
230
230
_set( $e) ;
231
231
}
232
- }
232
+ } ;
233
233
}
234
234
235
235
macro_rules! clear_csr {
@@ -239,7 +239,7 @@ macro_rules! clear_csr {
239
239
pub unsafe fn $clear_field( ) {
240
240
_clear( $e) ;
241
241
}
242
- }
242
+ } ;
243
243
}
244
244
245
245
macro_rules! set_clear_csr {
@@ -270,3 +270,4 @@ macro_rules! read_composite_csr {
270
270
}
271
271
} ;
272
272
}
273
+
0 commit comments