Skip to content

Commit 5c0199a

Browse files
committed
Keep the memory map sorted (also removes zero-sized regions)
1 parent 7dfff15 commit 5c0199a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/frame_allocator.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,7 @@ impl<'a> FrameAllocator<'a> {
153153
if !region_already_inserted {
154154
self.memory_map.add_region(region);
155155
}
156+
157+
self.memory_map.sort();
156158
}
157159
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ pub extern "C" fn load_elf(
183183

184184
// Construct boot info structure.
185185
let mut boot_info = BootInfo::new(page_table, memory_map);
186-
boot_info.sort_memory_map();
186+
boot_info.memory_map.sort();
187187

188188
// Write boot info to boot info page.
189189
let boot_info_addr = boot_info_page.start_address();

0 commit comments

Comments
 (0)