Skip to content

Commit 2df21a6

Browse files
ccawley2011rillian
authored andcommitted
Add CPU detection on RISC OS.
Signed-off-by: Ralph Giles <giles@thaumas.net>
1 parent fa5707d commit 2df21a6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

lib/arm/armcpu.c

+38
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,44 @@ ogg_uint32_t oc_cpu_flags_get(void){
107107
return flags;
108108
}
109109

110+
#elif defined(__riscos__)
111+
#include <kernel.h>
112+
#include <swis.h>
113+
114+
ogg_uint32_t oc_cpu_flags_get(void) {
115+
ogg_uint32_t flags = 0;
116+
117+
#if defined(OC_ARM_ASM_EDSP) || defined(OC_ARM_ASM_MEDIA)
118+
119+
if (_swi(OS_Byte,_IN(0)|_IN(2)|_RETURN(1), 129, 0xFF) <= 0xA9)
120+
_swix(OS_Module, _INR(0,1), 1, "System:Modules.CallASWI");
121+
122+
ogg_uint32_t features;
123+
_kernel_oserror* test = _swix(OS_PlatformFeatures, _IN(0)|_OUT(0), 0, &features);
124+
if (test == NULL) {
125+
#if defined(OC_ARM_ASM_EDSP)
126+
if((features>>10 & 1) == 1)flags|=OC_CPU_ARM_EDSP;
127+
#endif
128+
129+
#if defined(OC_ARM_ASM_MEDIA)
130+
if ((features>>31 & 1) == 1) {
131+
ogg_uint32_t shadd = 0;
132+
test =_swix(OS_PlatformFeatures, _INR(0,1)|_OUT(0), 34, 29, &shadd);
133+
if (test==NULL && shadd==1)flags|=OC_CPU_ARM_MEDIA;
134+
}
135+
#endif
136+
}
137+
#endif
138+
139+
#if defined(OC_ARM_ASM_NEON)
140+
ogg_uint32_t mvfr1;
141+
test = _swix(VFPSupport_Features, _IN(0)|_OUT(2), 0, &mvfr1);
142+
if (test==NULL && (mvfr1 & 0xFFF00)==0x11100)flags|=OC_CPU_ARM_NEON;
143+
#endif
144+
145+
return flags;
146+
}
147+
110148
#else
111149
/*The feature registers which can tell us what the processor supports are
112150
accessible in priveleged modes only, so we can't have a general user-space

0 commit comments

Comments
 (0)