2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
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
)
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
);