1 #include <stdint.h> 2 3 4 #if CPUINFO_MOCK 5 extern uint32_t cpuinfo_arm_fpsid; 6 extern uint32_t cpuinfo_arm_mvfr0; 7 extern uint32_t cpuinfo_arm_wcid; 8 read_fpsid(void)9 static inline uint32_t read_fpsid(void) { 10 return cpuinfo_arm_fpsid; 11 } 12 read_mvfr0(void)13 static inline uint32_t read_mvfr0(void) { 14 return cpuinfo_arm_mvfr0; 15 } 16 read_wcid(void)17 static inline uint32_t read_wcid(void) { 18 return cpuinfo_arm_wcid; 19 } 20 #else 21 #if !defined(__ARM_ARCH_7A__) && !defined(__ARM_ARCH_8A__) && !(defined(__ARM_ARCH) && (__ARM_ARCH >= 7)) 22 /* 23 * CoProcessor 10 is inaccessible from user mode since ARMv7, 24 * and clang refuses to compile inline assembly when targeting ARMv7+ 25 */ read_fpsid(void)26 static inline uint32_t read_fpsid(void) { 27 uint32_t fpsid; 28 __asm__ __volatile__("MRC p10, 0x7, %[fpsid], cr0, cr0, 0" : [fpsid] "=r" (fpsid)); 29 return fpsid; 30 } 31 read_mvfr0(void)32 static inline uint32_t read_mvfr0(void) { 33 uint32_t mvfr0; 34 __asm__ __volatile__("MRC p10, 0x7, %[mvfr0], cr7, cr0, 0" : [mvfr0] "=r" (mvfr0)); 35 return mvfr0; 36 } 37 #endif 38 read_wcid(void)39 static inline uint32_t read_wcid(void) { 40 uint32_t wcid; 41 __asm__ __volatile__("MRC p1, 0, %[wcid], c0, c0" : [wcid] "=r" (wcid)); 42 return wcid; 43 } 44 #endif 45