revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-unix / kernel / setprotection.c
blob27c7fd51eb0945e157b77e92b6b3165bebbe2bc0
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/kernel.h>
7 #include <aros/libcall.h>
9 #include <kernel_base.h>
10 #include <kernel_intern.h>
12 #include <sys/mman.h>
13 #include <inttypes.h>
15 AROS_LH3I(void, KrnSetProtection,
16 AROS_LHA(void *, address, A0),
17 AROS_LHA(uint32_t, length, D0),
18 AROS_LHA(KRN_MapAttr, flags, D1),
19 struct KernelBase *, KernelBase, 21, Kernel)
21 AROS_LIBFUNC_INIT
23 int flags_unix = 0;
25 if (flags & MAP_Readable)
26 flags_unix |= PROT_READ;
27 if (flags & MAP_Writable)
28 flags_unix |= PROT_WRITE;
29 if (flags & MAP_Executable)
30 flags_unix |= PROT_EXEC;
32 KernelBase->kb_PlatformData->iface->mprotect(address, length, flags_unix);
33 AROS_HOST_BARRIER
35 AROS_LIBFUNC_EXIT