File tree Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -56,22 +56,14 @@ pub extern "C" fn _start(info: &mut BiosInfo) -> ! {
5656 PhysAddr :: new ( info. kernel . start )
5757 } ;
5858 let kernel_size = info. kernel . len ;
59- let mut frame_allocator = if info. ramdisk . start == 0 {
60- let kernel_end = PhysFrame :: containing_address ( kernel_start + kernel_size - 1u64 ) ;
61- let next_free = kernel_end + 1 ;
62- LegacyFrameAllocator :: new_starting_at (
63- next_free,
64- memory_map. iter ( ) . copied ( ) . map ( MemoryRegion ) ,
65- )
66- } else {
67- let ramdisk_end =
68- PhysFrame :: containing_address ( PhysAddr :: new ( info. ramdisk . start + info. ramdisk . len ) ) ;
69- let next_free = ramdisk_end + 1 ;
70- LegacyFrameAllocator :: new_starting_at (
71- next_free,
72- memory_map. iter ( ) . copied ( ) . map ( MemoryRegion ) ,
73- )
59+ let next_free_frame = match info. ramdisk . len {
60+ 0 => PhysFrame :: containing_address ( kernel_start + kernel_size - 1u64 ) + 1 ,
61+ _ => PhysFrame :: containing_address ( PhysAddr :: new ( info. ramdisk . start + info. ramdisk . len ) ) + 1
7462 } ;
63+ let mut frame_allocator = LegacyFrameAllocator :: new_starting_at (
64+ next_free_frame,
65+ memory_map. iter ( ) . copied ( ) . map ( MemoryRegion ) ,
66+ ) ;
7567
7668 // We identity-mapped all memory, so the offset between physical and virtual addresses is 0
7769 let phys_offset = VirtAddr :: new ( 0 ) ;
You can’t perform that action at this time.
0 commit comments