Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame Allocator can create duplicate free regions during initialization #1105

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kernel/frame_allocator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ fn check_and_add_free_region<P, R>(
where P: Borrow<PhysicalMemoryRegion>,
R: IntoIterator<Item = P> + Clone,
{
let mut area = area.clone();
// This will be set to the frame that is the start of the current free region.
let mut current_start = *area.start();
// This will be set to the frame that is the end of the current free region.
Expand Down Expand Up @@ -229,11 +230,14 @@ fn check_and_add_free_region<P, R>(
free_list_idx,
reserved_physical_memory_areas.clone(),
);
area = FrameRange::new(*area.start(), current_end);
// info!("Updating original region after exiting recursive function: {:X?}", area);
}
}
}

let new_area = FrameRange::new(current_start, current_end);
// info!("Adding new area: {:X?}", new_area);
if new_area.size_in_frames() > 0 {
free_list[*free_list_idx] = Some(PhysicalMemoryRegion {
typ: MemoryRegionType::Free,
Expand Down
Loading