mirror of
https://review.haiku-os.org/haiku
synced 2025-02-07 14:25:58 +01:00
kernel/vm: Clean up vm_allocate_early_physical_page.
Clean up comments, merge assignments with declarations, etc. No functional change intended.
This commit is contained in:
parent
b1e579c6f1
commit
27d0a861e0
@ -4341,19 +4341,18 @@ vm_allocate_early_physical_page(kernel_args* args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Try expanding the existing physical ranges upwards.
|
||||
for (uint32 i = 0; i < args->num_physical_allocated_ranges; i++) {
|
||||
phys_addr_t nextPage;
|
||||
|
||||
nextPage = args->physical_allocated_range[i].start
|
||||
phys_addr_t nextPage = args->physical_allocated_range[i].start
|
||||
+ args->physical_allocated_range[i].size;
|
||||
// see if the page after the next allocated paddr run can be allocated
|
||||
if (i + 1 < args->num_physical_allocated_ranges
|
||||
&& args->physical_allocated_range[i + 1].size != 0) {
|
||||
// see if the next page will collide with the next allocated range
|
||||
if (nextPage >= args->physical_allocated_range[i+1].start)
|
||||
|
||||
// make sure the next page does not collide with the next allocated range
|
||||
if ((i + 1) < args->num_physical_allocated_ranges
|
||||
&& args->physical_allocated_range[i + 1].size != 0) {
|
||||
if (nextPage >= args->physical_allocated_range[i + 1].start)
|
||||
continue;
|
||||
}
|
||||
// see if the next physical page fits in the memory block
|
||||
// see if the next page fits in the memory block
|
||||
if (is_page_in_physical_memory_range(args, nextPage)) {
|
||||
// we got one!
|
||||
args->physical_allocated_range[i].size += B_PAGE_SIZE;
|
||||
@ -4363,14 +4362,12 @@ vm_allocate_early_physical_page(kernel_args* args)
|
||||
|
||||
// Expanding upwards didn't work, try going downwards.
|
||||
for (uint32 i = 0; i < args->num_physical_allocated_ranges; i++) {
|
||||
phys_addr_t nextPage;
|
||||
phys_addr_t nextPage = args->physical_allocated_range[i].start - B_PAGE_SIZE;
|
||||
|
||||
nextPage = args->physical_allocated_range[i].start - B_PAGE_SIZE;
|
||||
// see if the page after the prev allocated paddr run can be allocated
|
||||
if (i > 0 && args->physical_allocated_range[i - 1].size != 0) {
|
||||
// see if the next page will collide with the next allocated range
|
||||
if (nextPage < args->physical_allocated_range[i-1].start
|
||||
+ args->physical_allocated_range[i-1].size)
|
||||
// make sure the next page does not collide with the previous allocated range
|
||||
if ((i > 0) && args->physical_allocated_range[i - 1].size != 0) {
|
||||
if (nextPage < args->physical_allocated_range[i - 1].start
|
||||
+ args->physical_allocated_range[i - 1].size)
|
||||
continue;
|
||||
}
|
||||
// see if the next physical page fits in the memory block
|
||||
|
Loading…
x
Reference in New Issue
Block a user