make.tmpl: add missing compiler attribute to build_progs
[AROS.git] / arch / m68k-all / kernel / setprotection.c
blobfdb8f4338b73447c9a76d4479c949cc4d54bbb53
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 <proto/kernel.h>
14 /* See rom/kernel/setprotection.c for documentation */
16 AROS_LH3(void, KrnSetProtection,
17 AROS_LHA(void *, address, A0),
18 AROS_LHA(uint32_t, length, D0),
19 AROS_LHA(KRN_MapAttr, flags, D1),
20 struct KernelBase *, KernelBase, 21, Kernel)
22 AROS_LIBFUNC_INIT
24 BOOL invalid = (flags & (MAP_Readable | MAP_Writable | MAP_Executable)) == 0;
25 BOOL readonly = (flags & MAP_Writable) == 0;
26 BOOL supervisor = (flags & MAP_Supervisor) != 0;
27 UBYTE cm = (flags & MAP_CacheInhibit) ? CM_SERIALIZED : ((flags & MAP_WriteThrough) ? CM_WRITETHROUGH : CM_COPYBACK);
29 /* We need MAP_Supervisor and MAP_CacheInhibitSerialized */
31 if ((ULONG)address < 0x00200000 && cm == CM_SERIALIZED)
32 cm = CM_NONCACHEABLE; /* Chip RAM does not need to be non-cacheable + serialized, only noncacheable */
34 map_region(KernelBase, address, NULL, length, invalid, readonly, supervisor, cm);
36 AROS_LIBFUNC_EXIT