don't check when its clang masquerading as gcc
[AROS.git] / arch / arm-native / kernel / getcpunumber.c
blob9484544e6b609f3a5f9d1b4e8163e6ad001f3dd4
1 /*
2 Copyright © 2015, 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 AROS_LH0(cpuid_t, KrnGetCPUNumber,
13 struct KernelBase *, KernelBase, 41, Kernel)
15 AROS_LIBFUNC_INIT
17 register unsigned int superSP;
18 uint32_t tmp;
20 asm volatile (
21 " stmfd sp!, {lr} \n"
22 " mov r1, sp \n"
23 " swi %[swi_no] \n"
24 " mov %[superSP], sp \n"
25 " mov sp, r1 \n"
26 " ldmfd sp!, {lr} \n"
27 : [superSP] "=r" (superSP)
28 : [swi_no] "I" (6 /*SC_SUPERSTATE*/) : "r1"
31 asm volatile (" mrc p15, 0, %0, c0, c0, 5 " : "=r" (tmp));
33 if (superSP)
35 asm volatile (
36 " stmfd sp!, {lr} \n"
37 " mov r1, sp \n"
38 " mov sp, %[superSP] \n"
39 " cpsie i, %[mode_user] \n"
40 " mov sp, r1 \n"
41 " ldmfd sp!, {lr} \n"
42 : : [superSP] "r" (superSP), [mode_user] "I" (CPUMODE_USER) : "r1" );
45 if (tmp & (2 << 30))
47 return (cpuid_t)(((tmp & 0xF00) >> 4) | (tmp & 0xF));
50 // Uniprocessor System
51 return (cpuid_t)0;
53 AROS_LIBFUNC_EXIT