@@ -7,9 +7,11 @@ use crate::register::{SysReg, SysRegRead, SysRegWrite};
77/// There is no `modify` method because this register holds a single 32-bit address.
88///
99/// This is only available in EL2.
10- #[ derive( Clone , Copy , PartialEq , Eq ) ]
10+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
1111#[ repr( transparent) ]
12- pub struct Hvbar ( * mut u32 ) ;
12+ #[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
13+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
14+ pub struct Hvbar ( pub u32 ) ;
1315
1416impl SysReg for Hvbar {
1517 const CP : u32 = 15 ;
@@ -28,7 +30,7 @@ impl Hvbar {
2830 #[ inline]
2931 pub fn read ( ) -> Hvbar {
3032 // Safety: Reading this register has no side-effects and is atomic
31- unsafe { Self ( <Self as SysRegRead >:: read_raw ( ) as * mut u32 ) }
33+ unsafe { Self ( <Self as SysRegRead >:: read_raw ( ) ) }
3234 }
3335
3436 /// Write HVBAR (*Hyp Vector Base Address Register*)
@@ -45,16 +47,3 @@ impl Hvbar {
4547 }
4648 }
4749}
48-
49- impl core:: fmt:: Debug for Hvbar {
50- fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
51- write ! ( f, "HVBAR {{ {:010p} }}" , self . 0 )
52- }
53- }
54-
55- #[ cfg( feature = "defmt" ) ]
56- impl defmt:: Format for Hvbar {
57- fn format ( & self , f : defmt:: Formatter ) {
58- defmt:: write!( f, "HVBAR {{ 0x{=usize:08x} }}" , self . 0 as usize )
59- }
60- }
0 commit comments