File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ impl Write for Writer {
3232#[ panic_handler]
3333#[ cfg( not( test) ) ]
3434pub fn panic ( info : & core:: panic:: PanicInfo ) -> ! {
35- let _ = writeln ! ( Writer , "\n PANIC: {}" , info ) ;
35+ let _ = writeln ! ( Writer , "\n PANIC: {info}" ) ;
3636
3737 loop {
3838 unsafe {
Original file line number Diff line number Diff line change @@ -61,7 +61,8 @@ pub fn enter_long_mode_and_jump_to_stage_4(info: &mut BiosInfo) {
6161 // enter endless loop in case 4th stage returns
6262 "2:" ,
6363 "jmp 2b" ,
64- out( "eax" ) _
64+ out( "eax" ) _,
65+ options( noreturn) ,
6566 ) ;
6667 }
6768}
Original file line number Diff line number Diff line change @@ -15,14 +15,13 @@ fn create_mappings() {
1515 let l4 = unsafe { LEVEL_4 . get_mut ( ) } ;
1616 let l3 = unsafe { LEVEL_3 . get_mut ( ) } ;
1717 let l2s = unsafe { LEVEL_2 . get_mut ( ) } ;
18- let common_flags = 0b11 ;
18+ let common_flags = 0b11 ; // PRESENT | WRITEABLE
1919 l4. entries [ 0 ] = ( l3 as * mut PageTable as u64 ) | common_flags;
20- for i in 0 ..l2s. len ( ) {
21- let l2 = & mut l2s[ i] ;
20+ for ( i, l2) in l2s. iter_mut ( ) . enumerate ( ) {
2221 l3. entries [ i] = ( l2 as * mut PageTable as u64 ) | common_flags;
2322 let offset = u64:: try_from ( i) . unwrap ( ) * 1024 * 1024 * 1024 ;
24- for j in 0 .. 512 {
25- l2 . entries [ j ] =
23+ for ( j , entry ) in l2 . entries . iter_mut ( ) . enumerate ( ) {
24+ * entry =
2625 ( offset + u64:: try_from ( j) . unwrap ( ) * ( 2 * 1024 * 1024 ) ) | common_flags | ( 1 << 7 ) ;
2726 }
2827 }
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ fn create_page_tables(frame_allocator: &mut impl FrameAllocator<Size4KiB>) -> Pa
153153 let ( kernel_page_table, kernel_level_4_frame) = {
154154 // get an unused frame for new level 4 page table
155155 let frame: PhysFrame = frame_allocator. allocate_frame ( ) . expect ( "no unused frames" ) ;
156- log:: info!( "New page table at: {:#?}" , & frame ) ;
156+ log:: info!( "New page table at: {frame :#?}" ) ;
157157 // get the corresponding virtual address
158158 let addr = phys_offset + frame. start_address ( ) . as_u64 ( ) ;
159159 // initialize a new page table
@@ -215,7 +215,7 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
215215 . get ( )
216216 . map ( |l| l. force_unlock ( ) )
217217 } ;
218- log:: error!( "{}" , info ) ;
218+ log:: error!( "{info}" ) ;
219219 loop {
220220 unsafe { core:: arch:: asm!( "cli; hlt" ) } ;
221221 }
You can’t perform that action at this time.
0 commit comments