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 ;
|
2 | 2 | |
3 | 3 | SetSubDirSupportedPlatformsBeOSCompatible ; |
4 | 4 | |
| 5 | UsePrivateKernelHeaders ; |
5 | 6 | UsePrivateHeaders media ; |
6 | 7 | |
7 | 8 | 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 01a172e..b091e32 100644
a
|
b
|
|
12 | 12 | #include <OS.h> |
13 | 13 | #include <string.h> |
14 | 14 | |
| 15 | #include <vm/vm.h> |
| 16 | #include <vm/VMAddressSpace.h> |
| 17 | |
15 | 18 | #include "debug.h" |
16 | 19 | #include "util.h" |
17 | 20 | |
18 | 21 | static spinlock slock = B_SPINLOCK_INITIALIZER; |
19 | | static uint32 round_to_pagesize(uint32 size); |
20 | 22 | |
21 | 23 | cpu_status |
22 | 24 | lock(void) |
… |
… |
unlock(cpu_status status)
|
35 | 37 | } |
36 | 38 | |
37 | 39 | |
38 | | uint32 |
39 | | round_to_pagesize(uint32 size) |
40 | | { |
41 | | return (size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); |
42 | | } |
43 | | |
44 | | |
45 | 40 | area_id |
46 | 41 | alloc_mem(physical_entry *phy, addr_t *log, size_t size, const char *name) |
47 | 42 | { |
48 | 43 | void * logadr; |
49 | 44 | area_id areaid; |
50 | 45 | 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 |
51 | 51 | |
52 | 52 | ITRACE("Allocating %s: ", name); |
53 | 53 | |
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 | |
59 | 58 | if (areaid < B_OK) { |
60 | 59 | ITRACE("couldn't allocate\n"); |
61 | 60 | return B_ERROR; |