1
1
//! mstatus register
2
2
3
3
pub use super :: misa:: XLEN ;
4
+ #[ cfg( not( target_arch = "riscv32" ) ) ]
4
5
use crate :: bits:: { bf_extract, bf_insert} ;
5
6
#[ cfg( target_arch = "riscv32" ) ]
6
7
use crate :: result:: Error ;
@@ -336,29 +337,15 @@ impl Mstatus {
336
337
/// affect the mstatus CSR itself. See [`set_sbe`] to directly update the
337
338
/// CSR.
338
339
///
339
- /// **NOTE**: panics on RISCV-32 platforms.
340
- #[ inline]
341
- pub fn set_sbe ( & mut self , endianness : Endianness ) {
342
- self . try_set_sbe ( endianness) . unwrap ( ) ;
343
- }
344
-
345
- /// Update S-mode non-instruction-fetch memory endianness
340
+ /// # Note
346
341
///
347
- /// Note this updates a previously read [`Mstatus`] value, but does not
348
- /// affect the mstatus CSR itself. See [`set_sbe`] to directly update the
349
- /// CSR .
342
+ /// On RISCV-32 platforms, this function does not exist on the [`Mstatus`] instance.
343
+ ///
344
+ /// Instead, RISCV-32 users should use the [`Mstatush`](crate::register::mstatush::Mstatush) register .
350
345
#[ inline]
351
- #[ cfg_attr( not( target_arch = "riscv64" ) , allow( unused_variables) ) ]
352
- pub fn try_set_sbe ( & mut self , endianness : Endianness ) -> Result < ( ) > {
353
- match ( ) {
354
- #[ cfg( not( target_arch = "riscv32" ) ) ]
355
- ( ) => {
356
- self . bits = bf_insert ( self . bits , 36 , 1 , endianness as usize ) ;
357
- Ok ( ( ) )
358
- }
359
- #[ cfg( target_arch = "riscv32" ) ]
360
- ( ) => Err ( Error :: Unimplemented ) ,
361
- }
346
+ #[ cfg( not( target_arch = "riscv32" ) ) ]
347
+ pub fn set_sbe ( & mut self , endianness : Endianness ) {
348
+ self . bits = bf_insert ( self . bits , 36 , 1 , endianness as usize ) ;
362
349
}
363
350
364
351
/// M-mode non-instruction-fetch memory endianness
@@ -379,29 +366,15 @@ impl Mstatus {
379
366
/// affect the mstatus CSR itself. See [`set_mbe`] to directly update the
380
367
/// CSR.
381
368
///
382
- /// **NOTE**: panics on RISCV-32 platforms.
383
- #[ inline]
384
- pub fn set_mbe ( & mut self , endianness : Endianness ) {
385
- self . try_set_mbe ( endianness) . unwrap ( ) ;
386
- }
387
-
388
- /// Update M-mode non-instruction-fetch memory endianness
369
+ /// # Note
389
370
///
390
- /// Note this updates a previously read [`Mstatus`] value, but does not
391
- /// affect the mstatus CSR itself. See [`set_mbe`] to directly update the
392
- /// CSR .
371
+ /// On RISCV-32 platforms, this function does not exist on the [`Mstatus`] instance.
372
+ ///
373
+ /// Instead, RISCV-32 users should use the [`Mstatush`](crate::register::mstatush::Mstatush) register .
393
374
#[ inline]
394
- #[ cfg_attr( not( target_arch = "riscv64" ) , allow( unused_variables) ) ]
395
- pub fn try_set_mbe ( & mut self , endianness : Endianness ) -> Result < ( ) > {
396
- match ( ) {
397
- #[ cfg( not( target_arch = "riscv32" ) ) ]
398
- ( ) => {
399
- self . bits = bf_insert ( self . bits , 37 , 1 , endianness as usize ) ;
400
- Ok ( ( ) )
401
- }
402
- #[ cfg( target_arch = "riscv32" ) ]
403
- ( ) => Err ( Error :: Unimplemented ) ,
404
- }
375
+ #[ cfg( not( target_arch = "riscv32" ) ) ]
376
+ pub fn set_mbe ( & mut self , endianness : Endianness ) {
377
+ self . bits = bf_insert ( self . bits , 37 , 1 , endianness as usize ) ;
405
378
}
406
379
}
407
380
0 commit comments