diff --git a/src/system/boot/platform/bios_ia32/mmu.cpp b/src/system/boot/platform/bios_ia32/mmu.cpp index 1d6384a5f3..83d5334f06 100644 --- a/src/system/boot/platform/bios_ia32/mmu.cpp +++ b/src/system/boot/platform/bios_ia32/mmu.cpp @@ -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. diff --git a/src/system/boot/platform/bios_ia32/mmu.h b/src/system/boot/platform/bios_ia32/mmu.h index 7cd38633f9..fc197e98c8 100644 --- a/src/system/boot/platform/bios_ia32/mmu.h +++ b/src/system/boot/platform/bios_ia32/mmu.h @@ -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