File tree 1 file changed +4
-4
lines changed
src/drivers/virtio/transport
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -528,19 +528,19 @@ impl ComCfg {
528
528
// Indicate device to show high 32 bits in device_feature field.
529
529
// See Virtio specification v1.1. - 4.1.4.3
530
530
memory_barrier ( ) ;
531
- self . com_cfg . device_feature_select = 1 ;
531
+ unsafe { ptr :: from_mut ( & mut self . com_cfg . device_feature_select ) . write_volatile ( 1 ) } ;
532
532
memory_barrier ( ) ;
533
533
534
534
// read high 32 bits of device features
535
- let mut dev_feat = u64:: from ( self . com_cfg . device_feature ) << 32 ;
535
+ let mut dev_feat = u64:: from ( unsafe { ptr :: from_mut ( & mut self . com_cfg . device_feature ) . read_volatile ( ) } ) << 32 ;
536
536
537
537
// Indicate device to show low 32 bits in device_feature field.
538
538
// See Virtio specification v1.1. - 4.1.4.3
539
- self . com_cfg . device_feature_select = 0 ;
539
+ unsafe { ptr :: from_mut ( & mut self . com_cfg . device_feature_select ) . write_volatile ( 0 ) } ;
540
540
memory_barrier ( ) ;
541
541
542
542
// read low 32 bits of device features
543
- dev_feat |= u64:: from ( self . com_cfg . device_feature ) ;
543
+ dev_feat |= u64:: from ( unsafe { ptr :: from_mut ( & mut self . com_cfg . device_feature ) . read_volatile ( ) } ) ;
544
544
545
545
dev_feat
546
546
}
You can’t perform that action at this time.
0 commit comments