Added mmu_allocate_physical(), which allocates a specified physical memory

range.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35815 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2010-03-11 17:42:00 +00:00
parent bb7711cd5a
commit 90bf6bef34
2 changed files with 18 additions and 0 deletions

View File

@ -444,6 +444,23 @@ mmu_allocate(void *virtualAddress, size_t size)
}
/*! Allocates the given physical range.
\return \c true, if the range could be allocated, \c false otherwise.
*/
bool
mmu_allocate_physical(addr_t base, size_t size)
{
addr_t foundBase;
if (!get_free_address_range(gKernelArgs.physical_allocated_range,
gKernelArgs.num_physical_allocated_ranges, sNextPhysicalAddress,
size, &foundBase)) {
return B_BAD_VALUE;
}
return insert_physical_allocated_range(base, size) == B_OK;
}
/*! This will unmap the allocated chunk of memory from the virtual
address space. It might not actually free memory (as its implementation
is very simple), but it might.

View File

@ -20,6 +20,7 @@ extern void mmu_init(void);
extern void mmu_init_for_kernel(void);
extern addr_t mmu_map_physical_memory(addr_t physicalAddress, size_t size, uint32 flags);
extern void *mmu_allocate(void *virtualAddress, size_t size);
extern bool mmu_allocate_physical(addr_t base, size_t size);
extern void mmu_free(void *virtualAddress, size_t size);
#ifdef __cplusplus