Ticket #9074: 0002-Fix-3079-and-9074-Memory-alocation-beyond-256MB.patch

File 0002-Fix-3079-and-9074-Memory-alocation-beyond-256MB.patch, 2.5 KB (added by jerl1, 10 years ago)
  • src/add-ons/kernel/drivers/audio/ice1712/Jamfile

    From 3c5e4d99d67be38c39c8b1a65c9f18be2a28e563 Mon Sep 17 00:00:00 2001
    From: Jerome Leveque <leveque.jerome@gmail.com>
    Date: Sat, 7 Feb 2015 12:34:18 +0100
    Subject: [PATCH 2/2] Fix #3079 and #9074 Memory alocation beyond 256MB
    
    ---
     src/add-ons/kernel/drivers/audio/ice1712/Jamfile  |  1 +
     src/add-ons/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 d21536d..70d5e8f 100644
    a b SubDir HAIKU_TOP src add-ons kernel drivers audio ice1712 ;  
    22
    33SetSubDirSupportedPlatformsBeOSCompatible ;
    44
     5UsePrivateKernelHeaders ;
    56UsePrivateHeaders media ;
    67
    78KernelAddon ice1712 :
  • src/add-ons/kernel/drivers/audio/ice1712/util.cpp

    diff --git a/src/add-ons/kernel/drivers/audio/ice1712/util.cpp b/src/add-ons/kernel/drivers/audio/ice1712/util.cpp
    index 01a172e..b091e32 100644
    a b  
    1212#include <OS.h>
    1313#include <string.h>
    1414
     15#include <vm/vm.h>
     16#include <vm/VMAddressSpace.h>
     17
    1518#include "debug.h"
    1619#include "util.h"
    1720
    1821static spinlock slock = B_SPINLOCK_INITIALIZER;
    19 static uint32 round_to_pagesize(uint32 size);
    2022
    2123cpu_status
    2224lock(void)
    unlock(cpu_status status)  
    3537}
    3638
    3739
    38 uint32
    39 round_to_pagesize(uint32 size)
    40 {
    41     return (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);
    42 }
    43 
    44 
    4540area_id
    4641alloc_mem(physical_entry *phy, addr_t *log, size_t size, const char *name)
    4742{
    4843    void * logadr;
    4944    area_id areaid;
    5045    status_t rv;
     46    team_id teamid = VMAddressSpace::KernelID();
     47    virtual_address_restrictions virtual_add = {};
     48    physical_address_restrictions phys_add = {};
     49    phys_add.high_address = 1 << 28;
     50    // ICE1712 chipset can not deal with memory area beyond 256MB
    5151
    5252    ITRACE("Allocating %s: ", name);
    5353
    54     size = round_to_pagesize(size);
    55     areaid = create_area(name, &logadr, B_ANY_KERNEL_ADDRESS, size,
    56         B_32_BIT_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
    57         // TODO: The rest of the code doesn't deal correctly with physical
    58         // addresses > 4 GB, so we have to force 32 bit addresses here.
     54    areaid = vm_create_anonymous_area(teamid, name, size, B_CONTIGUOUS,
     55        B_READ_AREA | B_WRITE_AREA, 0, B_PAGE_SIZE,
     56        &virtual_add, &phys_add, true, &logadr);
     57
    5958    if (areaid < B_OK) {
    6059        ITRACE("couldn't allocate\n");
    6160        return B_ERROR;