From 88ef3116f6dbcf3d98ce2019eaf28fbf0d8c2da3 Mon Sep 17 00:00:00 2001
From: Jeffrey Lee <me@phlamethrower.co.uk>
Date: Thu, 27 Oct 2022 21:59:36 +0100
Subject: [PATCH] Define RISCOS_KERNEL when building the kernel

To match BuildSys 7.76
---
 Makefile              | 4 ++--
 aborttrap/c/aborttrap | 4 ++--
 aborttrap/c/atmem     | 8 ++++----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 9fcb924..261308f 100644
--- a/Makefile
+++ b/Makefile
@@ -35,8 +35,8 @@ TOKHELPSRC      = ${TOKENSOURCE}
 HELPSRC         = HelpStrs
 OBJS            = GetAll
 KERNEL_MODULE   = bin${SEP}${COMPONENT}
-ASFLAGS        += -PD "FreezeDevRel SETL {${FREEZE_DEV_REL}}" -PD "USE_SYNCLIB SETL {${USE_SYNCLIB}}"
-CFLAGS         += -ff -APCS 3/32bit/nofp/noswst -DKERNEL
+ASFLAGS        += -PD "FreezeDevRel SETL {${FREEZE_DEV_REL}}" -PD "USE_SYNCLIB SETL {${USE_SYNCLIB}}" -PD "RISCOS_KERNEL SETL {TRUE}"
+CFLAGS         += -ff -APCS 3/32bit/nofp/noswst -DRISCOS_KERNEL
 CUSTOMROM       = custom
 CUSTOMEXP       = custom
 CUSTOMSA        = custom
diff --git a/aborttrap/c/aborttrap b/aborttrap/c/aborttrap
index 233419c..4cc4cc9 100644
--- a/aborttrap/c/aborttrap
+++ b/aborttrap/c/aborttrap
@@ -52,7 +52,7 @@
 edfsr_type dfsr_type;
 bool loadwritepc_interworking;
 
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 #include "swis.h"
 
 uint32_t g_ProcessorFlags;
@@ -88,7 +88,7 @@ static inline bool get_loadwritepc_interworking(void)
 void aborttrap_init(void)
 {
 	dfsr_type = get_dfsr_type();
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 	_swix(OS_PlatformFeatures,_IN(0)|_OUT(0),OSPlatformFeatures_ReadCodeFeatures,&g_ProcessorFlags);
 #endif
 	loadwritepc_interworking = get_loadwritepc_interworking();
diff --git a/aborttrap/c/atmem b/aborttrap/c/atmem
index f50b54d..5549704 100644
--- a/aborttrap/c/atmem
+++ b/aborttrap/c/atmem
@@ -32,7 +32,7 @@
 #endif
 
 #include "kernel.h"
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 #include "swis.h"
 #endif
 
@@ -151,7 +151,7 @@ static inline _kernel_oserror *mem_access_via_aborttrap(int flags,uint8_t *buf,u
 
 static inline _kernel_oserror *mem_access_internal(uint8_t *buf,uint32_t addr,int len,int flags)
 {
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 	int mem24_flags=0;
 	if ((flags & AbortTrap_Reason_Mask) == AbortTrap_Reason_MemMap)
 	{
@@ -195,7 +195,7 @@ static inline _kernel_oserror *mem_access_internal(uint8_t *buf,uint32_t addr,in
 #endif
 	while (len > 0)
 	{
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 		if(addr < 512<<20)
 		{
 			/* Application space, skip to avoid fighting against lazy task swapping */
@@ -211,7 +211,7 @@ static inline _kernel_oserror *mem_access_internal(uint8_t *buf,uint32_t addr,in
 		bool have_permission;
 		_kernel_oserror *e;
 		int flags2 = flags;
-#ifndef KERNEL
+#ifndef RISCOS_KERNEL
 		uint32_t access;
 		e = _swix(OS_Memory,_INR(0,2)|_OUT(1),OSMemReason_CheckMemoryAccess,addr,addr+chunk,&access);
 		if (e)
-- 
GitLab