@@ -80,7 +80,6 @@ impl<'a> Mapper for Rv32PageTable<'a> {
8080 }
8181}
8282
83-
8483/// This struct is a three level page table with `Mapper` trait implemented.
8584#[ cfg( riscv64) ]
8685pub struct Rv39PageTable < ' a > {
@@ -217,12 +216,12 @@ impl<'a> Rv48PageTable<'a> {
217216
218217 let p2_table = if p3_table[ p3_index] . is_unused ( ) {
219218 let frame = allocator. alloc ( ) . ok_or ( MapToError :: FrameAllocationFailed ) ?;
220- self . root_table [ p3_index] . set ( frame. clone ( ) , F :: VALID ) ;
219+ p3_table [ p3_index] . set ( frame. clone ( ) , F :: VALID ) ;
221220 let p2_table: & mut PageTable = unsafe { frame. as_kernel_mut ( self . linear_offset ) } ;
222221 p2_table. zero ( ) ;
223222 p2_table
224223 } else {
225- let frame = self . root_table [ p3_index] . frame ( ) ;
224+ let frame = p3_table [ p3_index] . frame ( ) ;
226225 unsafe { frame. as_kernel_mut ( self . linear_offset ) }
227226 } ;
228227
@@ -249,7 +248,12 @@ impl<'a> Mapper for Rv48PageTable<'a> {
249248 flags : PageTableFlags ,
250249 allocator : & mut impl FrameAllocator ,
251250 ) -> Result < MapperFlush , MapToError > {
252- let p1_table = self . create_p1_if_not_exist ( page. p4_index ( ) , page. p3_index ( ) , page. p2_index ( ) , allocator) ?;
251+ let p1_table = self . create_p1_if_not_exist (
252+ page. p4_index ( ) ,
253+ page. p3_index ( ) ,
254+ page. p2_index ( ) ,
255+ allocator,
256+ ) ?;
253257 if !p1_table[ page. p1_index ( ) ] . is_unused ( ) {
254258 return Err ( MapToError :: PageAlreadyMapped ) ;
255259 }
@@ -304,4 +308,4 @@ impl<'a> Mapper for Rv48PageTable<'a> {
304308 let p1_table: & mut PageTable = unsafe { p1_frame. as_kernel_mut ( self . linear_offset ) } ;
305309 Ok ( & mut p1_table[ page. p1_index ( ) ] )
306310 }
307- }
311+ }
0 commit comments