get_next_physical_address(): Directly update the

gKernelArgs.physical_allocated_range array. This way it is always up to date
and we don't need to fix it in mmu_init_for_kernel().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35802 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-03-10 18:38:57 +00:00
parent 73a72c42e2
commit 5d1f3d53e2

View File

@ -111,10 +111,19 @@ get_next_virtual_address(size_t size)
static addr_t
get_next_physical_address(size_t size)
{
addr_t address = sNextPhysicalAddress;
sNextPhysicalAddress += size;
addr_t base;
if (!get_free_address_range(gKernelArgs.physical_allocated_range,
gKernelArgs.num_physical_allocated_ranges, sNextPhysicalAddress,
size, &base)) {
panic("Out of physical memory!");
return 0;
}
return address;
insert_physical_allocated_range(base, size);
sNextPhysicalAddress = base + size;
// TODO: Can overflow theoretically.
return base;
}
@ -559,10 +568,6 @@ mmu_init_for_kernel(void)
(void*)gKernelArgs.arch_args.vir_gdt);
}
// save the memory we've physically allocated
gKernelArgs.physical_allocated_range[0].size
= sNextPhysicalAddress - gKernelArgs.physical_allocated_range[0].start;
// Save the memory we've virtually allocated (for the kernel and other
// stuff)
gKernelArgs.virtual_allocated_range[0].start = KERNEL_BASE;