File tree 1 file changed +7
-15
lines changed
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) -> ! {
56
56
PhysAddr :: new ( info. kernel . start )
57
57
} ;
58
58
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
74
62
} ;
63
+ let mut frame_allocator = LegacyFrameAllocator :: new_starting_at (
64
+ next_free_frame,
65
+ memory_map. iter ( ) . copied ( ) . map ( MemoryRegion ) ,
66
+ ) ;
75
67
76
68
// We identity-mapped all memory, so the offset between physical and virtual addresses is 0
77
69
let phys_offset = VirtAddr :: new ( 0 ) ;
You can’t perform that action at this time.
0 commit comments