2 * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
7 #include "compat_cpp.h"
12 #include <kernel/vm/vm.h>
16 _kernel_contigmalloc_cpp(const char* file
, int line
, size_t size
,
17 phys_addr_t low
, phys_addr_t high
, phys_size_t alignment
,
18 phys_size_t boundary
, bool zero
, bool dontWait
)
20 size
= ROUNDUP(size
, B_PAGE_SIZE
);
22 uint32 creationFlags
= (zero
? 0 : CREATE_AREA_DONT_CLEAR
)
23 | (dontWait
? CREATE_AREA_DONT_WAIT
: 0);
25 char name
[B_OS_NAME_LENGTH
];
26 const char* baseName
= strrchr(file
, '/');
27 baseName
= baseName
!= NULL
? baseName
+ 1 : file
;
28 snprintf(name
, sizeof(name
), "contig:%s:%d", baseName
, line
);
30 virtual_address_restrictions virtualRestrictions
= {};
32 physical_address_restrictions physicalRestrictions
= {};
33 physicalRestrictions
.low_address
= low
;
34 physicalRestrictions
.high_address
= high
;
35 physicalRestrictions
.alignment
= alignment
;
36 physicalRestrictions
.boundary
= boundary
;
39 area_id area
= create_area_etc(B_SYSTEM_TEAM
, name
, size
, B_CONTIGUOUS
,
40 B_KERNEL_READ_AREA
| B_KERNEL_WRITE_AREA
, creationFlags
, 0,
41 &virtualRestrictions
, &physicalRestrictions
, &address
);