Removed autodocs of arch specific variants of ROM modules.
[AROS.git] / arch / m68k-all / kernel / setprotection.c
blob30c3f0c7b5647f356b9e0c9d1dd54b9643b4908c
1 #include <aros/kernel.h>
2 #include <aros/libcall.h>
4 #include <kernel_base.h>
5 #include <kernel_intern.h>
7 #include <proto/kernel.h>
9 /* See rom/kernel/setprotection.c for documentation */
11 AROS_LH3(void, KrnSetProtection,
12 AROS_LHA(void *, address, A0),
13 AROS_LHA(uint32_t, length, D0),
14 AROS_LHA(KRN_MapAttr, flags, D1),
15 struct KernelBase *, KernelBase, 21, Kernel)
17 AROS_LIBFUNC_INIT
19 BOOL invalid = (flags & (MAP_Readable | MAP_Writable | MAP_Executable)) == 0;
20 BOOL readonly = (flags & MAP_Writable) == 0;
21 BOOL supervisor = (flags & MAP_Supervisor) != 0;
22 UBYTE cm = (flags & MAP_CacheInhibit) ? CM_SERIALIZED : ((flags & MAP_WriteThrough) ? CM_WRITETHROUGH : CM_COPYBACK);
24 /* We need MAP_Supervisor and MAP_CacheInhibitSerialized */
26 if ((ULONG)address < 0x00200000 && cm == CM_SERIALIZED)
27 cm = CM_NONCACHEABLE; /* Chip RAM does not need to be non-cacheable + serialized, only noncacheable */
29 map_region(KernelBase, address, NULL, length, invalid, readonly, supervisor, cm);
31 AROS_LIBFUNC_EXIT