Fixed broken mmu_allocate_physical():
* Now it checks whether the given physical range exists at all. * Not only check whether any range of the given size is free, but also check whether the given range is free. * B_BAD_VALUE is not a particularly good return value for a function supposed to return a bool Fixes #5911. With only 64 MB RAM the usual debug syslog buffer location may be outside the actually existing physical memory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36632 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
863c623f9a
commit
8588e7fc6f
|
@ -450,11 +450,18 @@ mmu_allocate(void *virtualAddress, size_t size)
|
||||||
bool
|
bool
|
||||||
mmu_allocate_physical(addr_t base, size_t size)
|
mmu_allocate_physical(addr_t base, size_t size)
|
||||||
{
|
{
|
||||||
|
// check whether the physical memory range exists at all
|
||||||
|
if (!is_address_range_covered(gKernelArgs.physical_memory_range,
|
||||||
|
gKernelArgs.num_physical_memory_ranges, base, size)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether the physical range is still free
|
||||||
addr_t foundBase;
|
addr_t foundBase;
|
||||||
if (!get_free_address_range(gKernelArgs.physical_allocated_range,
|
if (!get_free_address_range(gKernelArgs.physical_allocated_range,
|
||||||
gKernelArgs.num_physical_allocated_ranges, sNextPhysicalAddress,
|
gKernelArgs.num_physical_allocated_ranges, sNextPhysicalAddress,
|
||||||
size, &foundBase)) {
|
size, &foundBase) || foundBase != base) {
|
||||||
return B_BAD_VALUE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return insert_physical_allocated_range(base, size) == B_OK;
|
return insert_physical_allocated_range(base, size) == B_OK;
|
||||||
|
|
Loading…
Reference in New Issue