[haiku-commits] r35815 - haiku/trunk/src/system/boot/platform/bios_ia32

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 11 Mar 2010 18:42:00 +0100 (CET)

Author: bonefish
Date: 2010-03-11 18:42:00 +0100 (Thu, 11 Mar 2010)
New Revision: 35815
Changeset: http://dev.haiku-os.org/changeset/35815/haiku

Modified:
   haiku/trunk/src/system/boot/platform/bios_ia32/mmu.cpp
   haiku/trunk/src/system/boot/platform/bios_ia32/mmu.h
Log:
Added mmu_allocate_physical(), which allocates a specified physical memory
range.


Modified: haiku/trunk/src/system/boot/platform/bios_ia32/mmu.cpp
===================================================================
--- haiku/trunk/src/system/boot/platform/bios_ia32/mmu.cpp      2010-03-11 
17:13:12 UTC (rev 35814)
+++ haiku/trunk/src/system/boot/platform/bios_ia32/mmu.cpp      2010-03-11 
17:42:00 UTC (rev 35815)
@@ -444,6 +444,23 @@
 }
 
 
+/*!    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.

Modified: haiku/trunk/src/system/boot/platform/bios_ia32/mmu.h
===================================================================
--- haiku/trunk/src/system/boot/platform/bios_ia32/mmu.h        2010-03-11 
17:13:12 UTC (rev 35814)
+++ haiku/trunk/src/system/boot/platform/bios_ia32/mmu.h        2010-03-11 
17:42:00 UTC (rev 35815)
@@ -20,6 +20,7 @@
 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


Other related posts:

  • » [haiku-commits] r35815 - haiku/trunk/src/system/boot/platform/bios_ia32 - ingo_weinhold