- Set a default PCM volume so that something can be heard when driver is
[AROS.git] / arch / all-unix / kernel / allocpages.c
blob5cb80bcfc59ce9079d796f6c5824a2f741997145
1 #include <aros/libcall.h>
3 #include <kernel_base.h>
4 #include <kernel_intern.h>
6 #include <sys/mman.h>
7 #include <inttypes.h>
9 AROS_LH3I(void *, KrnAllocPages,
10 AROS_LHA(uint32_t, length, D0),
11 AROS_LHA(uint32_t, flags, D1),
12 AROS_LHA(KRN_MapAttr, protection, D2),
13 struct KernelBase *, KernelBase, 27, Kernel)
15 AROS_LIBFUNC_INIT
17 int flags_unix = 0;
18 void *map = 0;
20 if (protection & MAP_Readable)
21 flags_unix |= PROT_READ;
22 if (protection & MAP_Writable)
23 flags_unix |= PROT_WRITE;
24 if (protection & MAP_Executable)
25 flags_unix |= PROT_EXEC;
27 /* Darwin does not define MAP_ANONYMOUS */
28 map = KernelIFace.mmap(NULL, length, flags_unix, MAP_PRIVATE | MAP_ANON, -1, 0);
29 AROS_HOST_BARRIER
31 return map;
33 AROS_LIBFUNC_EXIT