From 711d2087c3b558fe3fcfd493edc1b895cdbe0a5e Mon Sep 17 00:00:00 2001 From: Jerome Leveque Date: Sat, 7 Feb 2015 12:34:18 +0100 Subject: [PATCH] Fix #3079 and #9074 Memory allocation beyond 256MB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Duval --- .../kernel/drivers/audio/ice1712/Jamfile | 1 + .../kernel/drivers/audio/ice1712/util.cpp | 25 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/ice1712/Jamfile b/src/add-ons/kernel/drivers/audio/ice1712/Jamfile index d21536d088..70d5e8f691 100644 --- a/src/add-ons/kernel/drivers/audio/ice1712/Jamfile +++ b/src/add-ons/kernel/drivers/audio/ice1712/Jamfile @@ -2,6 +2,7 @@ SubDir HAIKU_TOP src add-ons kernel drivers audio ice1712 ; SetSubDirSupportedPlatformsBeOSCompatible ; +UsePrivateKernelHeaders ; UsePrivateHeaders media ; KernelAddon ice1712 : diff --git a/src/add-ons/kernel/drivers/audio/ice1712/util.cpp b/src/add-ons/kernel/drivers/audio/ice1712/util.cpp index 01a172edca..622565dbc7 100644 --- a/src/add-ons/kernel/drivers/audio/ice1712/util.cpp +++ b/src/add-ons/kernel/drivers/audio/ice1712/util.cpp @@ -12,11 +12,13 @@ #include #include +#include +#include + #include "debug.h" #include "util.h" static spinlock slock = B_SPINLOCK_INITIALIZER; -static uint32 round_to_pagesize(uint32 size); cpu_status lock(void) @@ -35,27 +37,24 @@ unlock(cpu_status status) } -uint32 -round_to_pagesize(uint32 size) -{ - return (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); -} - - area_id alloc_mem(physical_entry *phy, addr_t *log, size_t size, const char *name) { void * logadr; area_id areaid; status_t rv; + virtual_address_restrictions virtualRestrictions = {}; + virtualRestrictions.address_specification = B_ANY_KERNEL_ADDRESS; + physical_address_restrictions physicalRestrictions = {}; + physicalRestrictions.high_address = 1 << 28; + // ICE1712 chipset can not deal with memory area beyond 256MB ITRACE("Allocating %s: ", name); - size = round_to_pagesize(size); - areaid = create_area(name, &logadr, B_ANY_KERNEL_ADDRESS, size, - B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA); - // TODO: The rest of the code doesn't deal correctly with physical - // addresses > 4 GB, so we have to force 32 bit addresses here. + areaid = vm_create_anonymous_area(B_SYSTEM_TEAM, name, size, B_CONTIGUOUS, + B_READ_AREA | B_WRITE_AREA, 0, 0, + &virtualRestrictions, &physicalRestrictions, true, &logadr); + if (areaid < B_OK) { ITRACE("couldn't allocate\n"); return B_ERROR;