File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515- Add ` scontext ` CSR
1616- Add ` mconfigptr ` CSR
1717- Bump MSRV to 1.67.0 for ` log ` to ` ilog ` name change
18+ - Add ` mtval2 ` CSR
1819
1920### Changed
2021
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ pub mod mip;
9090pub mod mscratch;
9191pub mod mtinst;
9292pub mod mtval;
93+ pub mod mtval2;
9394
9495// Machine Protection and Translation
9596mod pmpcfgx;
Original file line number Diff line number Diff line change 1+ //! mtval register
2+
3+ const MASK : usize = usize:: MAX ;
4+
5+ read_only_csr ! {
6+ /// mtval2 register
7+ Mtval2 : 0x348 ,
8+ mask: MASK ,
9+ }
10+
11+ impl Mtval2 {
12+ /// Represents the bitshift value of the guest-page address stored in `mtval2`.
13+ pub const GUEST_PAGE_SHIFT : usize = 2 ;
14+
15+ /// Gets the guest-page fault physical address.
16+ ///
17+ /// # Note
18+ ///
19+ /// The address is written when an invalid implicit memory access during address translation.
20+ pub const fn guest_fault_address ( & self ) -> usize {
21+ self . bits ( ) << Self :: GUEST_PAGE_SHIFT
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments