Commit adb5a7a 1 parent 1f59a58 commit adb5a7a Copy full SHA for adb5a7a
File tree 2 files changed +23
-2
lines changed
src/structures/paging/mapper
2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ use crate::structures::paging::{
18
18
} ;
19
19
use crate :: { PhysAddr , VirtAddr } ;
20
20
21
+ use super :: page_table:: FrameError ;
22
+
21
23
mod mapped_page_table;
22
24
mod offset_page_table;
23
25
#[ cfg( feature = "instructions" ) ]
@@ -803,6 +805,15 @@ pub enum UnmapError {
803
805
InvalidFrameAddress ( PhysAddr ) ,
804
806
}
805
807
808
+ impl From < FrameError > for UnmapError {
809
+ fn from ( e : FrameError ) -> Self {
810
+ match e {
811
+ FrameError :: FrameNotPresent => Self :: PageNotMapped ,
812
+ FrameError :: HugeFrame => Self :: ParentEntryHugePage ,
813
+ }
814
+ }
815
+ }
816
+
806
817
impl From < Infallible > for UnmapError {
807
818
fn from ( i : Infallible ) -> Self {
808
819
match i { }
@@ -819,6 +830,15 @@ pub enum FlagUpdateError {
819
830
ParentEntryHugePage ,
820
831
}
821
832
833
+ impl From < FrameError > for FlagUpdateError {
834
+ fn from ( e : FrameError ) -> Self {
835
+ match e {
836
+ FrameError :: FrameNotPresent => Self :: PageNotMapped ,
837
+ FrameError :: HugeFrame => Self :: ParentEntryHugePage ,
838
+ }
839
+ }
840
+ }
841
+
822
842
impl From < Infallible > for FlagUpdateError {
823
843
fn from ( i : Infallible ) -> Self {
824
844
match i { }
Original file line number Diff line number Diff line change @@ -305,9 +305,10 @@ impl<'a> RecursivePageTable<'a> {
305
305
#[ cfg( feature = "experimental" ) ]
306
306
unsafe fn next_table_fn_next_table_mut < ' b , I > (
307
307
_: & mut I ,
308
- _ : & ' b mut PageTableEntry ,
308
+ e : & ' b mut PageTableEntry ,
309
309
page : Page ,
310
- ) -> Result < & ' b mut PageTable , Infallible > {
310
+ ) -> Result < & ' b mut PageTable , FrameError > {
311
+ e. frame ( ) ?;
311
312
Ok ( unsafe { & mut * page. start_address ( ) . as_mut_ptr ( ) } )
312
313
}
313
314
You can’t perform that action at this time.
0 commit comments