@@ -217,3 +217,126 @@ bool cpuinfo_x86_linux_parse_proc_cpuinfo(
217
217
return cpuinfo_linux_parse_multiline_file (
218
218
"/proc/cpuinfo" , BUFFER_SIZE , (cpuinfo_line_callback )parse_line , & state );
219
219
}
220
+
221
+ #ifdef __ANDROID__
222
+ bool cpuinfo_x86_linux_parse_cpuid_info (
223
+ struct cpuinfo_x86_cpuid_info * x86_cpuid_info )
224
+ {
225
+ cpuinfo_log_debug ("reading cpuid.info file" );
226
+ FILE * fd_info = fopen (CPUID_INFO_FILE , "rb" );
227
+ if (!fd_info ) {
228
+ cpuinfo_log_warning ("failed to open file %s: %s" , CPUID_INFO_FILE , strerror (errno ));
229
+ return false;
230
+ }
231
+
232
+ int ret = fread (x86_cpuid_info , sizeof (struct cpuinfo_x86_cpuid_info ), 1 , fd_info );
233
+ if (!ret ) {
234
+ cpuinfo_log_warning ("failed to read cpuid info from %s: %s" , CPUID_INFO_FILE , strerror (errno ));
235
+ }
236
+
237
+ if (fclose (fd_info )) {
238
+ cpuinfo_log_warning ("failed to close file %s: %s" , CPUID_INFO_FILE , strerror (errno ));
239
+ }
240
+
241
+ return ret ? true : false;
242
+ }
243
+
244
+ #ifdef __DEBUG__
245
+ void print_cpuid_info_file (void )
246
+ {
247
+ cpuinfo_log_debug ("----------------------------" );
248
+ /*
249
+ cpuinfo_log_debug("%-20s: %d", "ace", cpuinfo_has_x86_ace());
250
+ cpuinfo_log_debug("%-20s: %d", "ace2", cpuinfo_has_x86_ace2());
251
+ cpuinfo_log_debug("%-20s: %d", "clflush", cpuinfo_has_x86_clflush());
252
+ cpuinfo_log_debug("%-20s: %d", "clflushopt", cpuinfo_has_x86_clflushopt());
253
+ cpuinfo_log_debug("%-20s: %d", "lwp", cpuinfo_has_x86_lwp());
254
+ cpuinfo_log_debug("%-20s: %d", "msr", cpuinfo_has_x86_msr());
255
+ cpuinfo_log_debug("%-20s: %d", "phe", cpuinfo_has_x86_phe());
256
+ cpuinfo_log_debug("%-20s: %d", "pmm", cpuinfo_has_x86_pmm());
257
+ cpuinfo_log_debug("%-20s: %d", "rng", cpuinfo_has_x86_rng());
258
+ cpuinfo_log_debug("%-20s: %d", "sysenter", cpuinfo_has_x86_sysenter());
259
+ cpuinfo_log_debug("%-20s: %d", "syscall", cpuinfo_has_x86_syscall());
260
+ cpuinfo_log_debug("%-20s: %d", "emmx", cpuinfo_has_x86_emmx());
261
+ cpuinfo_log_debug("%-20s: %d", "fs_gs_base", cpuinfo_has_x86_fs_gs_base());
262
+ cpuinfo_log_debug("%-20s: %d", "fxsave", cpuinfo_has_x86_fxsave());
263
+ */
264
+ cpuinfo_log_debug ("%-20s: %d" , "erms" , cpuinfo_has_x86_erms ());
265
+ cpuinfo_log_debug ("%-20s: %d" , "smap" , cpuinfo_has_x86_smap ());
266
+ cpuinfo_log_debug ("%-20s: %d" , "serialize" , cpuinfo_has_x86_serialize ());
267
+ cpuinfo_log_debug ("%-20s: %d" , "adx" , cpuinfo_has_x86_adx ());
268
+ cpuinfo_log_debug ("%-20s: %d" , "aes" , cpuinfo_has_x86_aes ());
269
+ cpuinfo_log_debug ("%-20s: %d" , "avx" , cpuinfo_has_x86_avx ());
270
+ cpuinfo_log_debug ("%-20s: %d" , "avx2" , cpuinfo_has_x86_avx2 ());
271
+ cpuinfo_log_debug ("%-20s: %d" , "avx512bf16" , cpuinfo_has_x86_avx512bf16 ());
272
+ cpuinfo_log_debug ("%-20s: %d" , "avx512bitalg" , cpuinfo_has_x86_avx512bitalg ());
273
+ cpuinfo_log_debug ("%-20s: %d" , "avx512bw" , cpuinfo_has_x86_avx512bw ());
274
+ cpuinfo_log_debug ("%-20s: %d" , "avx512cd" , cpuinfo_has_x86_avx512cd ());
275
+ cpuinfo_log_debug ("%-20s: %d" , "avx512dq" , cpuinfo_has_x86_avx512dq ());
276
+ cpuinfo_log_debug ("%-20s: %d" , "avx512er" , cpuinfo_has_x86_avx512er ());
277
+ cpuinfo_log_debug ("%-20s: %d" , "avx512f" , cpuinfo_has_x86_avx512f ());
278
+ cpuinfo_log_debug ("%-20s: %d" , "avx512ifma" , cpuinfo_has_x86_avx512ifma ());
279
+ cpuinfo_log_debug ("%-20s: %d" , "avx512pf" , cpuinfo_has_x86_avx512pf ());
280
+ cpuinfo_log_debug ("%-20s: %d" , "avx512vbmi" , cpuinfo_has_x86_avx512vbmi ());
281
+ cpuinfo_log_debug ("%-20s: %d" , "avx512vbmi2" , cpuinfo_has_x86_avx512vbmi2 ());
282
+ cpuinfo_log_debug ("%-20s: %d" , "avx512vl" , cpuinfo_has_x86_avx512vl ());
283
+ cpuinfo_log_debug ("%-20s: %d" , "avx512vnni" , cpuinfo_has_x86_avx512vnni ());
284
+ cpuinfo_log_debug ("%-20s: %d" , "avx512vp2intersect" , cpuinfo_has_x86_avx512vp2intersect ());
285
+ cpuinfo_log_debug ("%-20s: %d" , "avx512vpopcntdq" , cpuinfo_has_x86_avx512vpopcntdq ());
286
+ cpuinfo_log_debug ("%-20s: %d" , "avx512_4fmaps" , cpuinfo_has_x86_avx512_4fmaps ());
287
+ cpuinfo_log_debug ("%-20s: %d" , "avx512_4vnniw" , cpuinfo_has_x86_avx512_4vnniw ());
288
+ cpuinfo_log_debug ("%-20s: %d" , "bmi" , cpuinfo_has_x86_bmi ());
289
+ cpuinfo_log_debug ("%-20s: %d" , "bmi2" , cpuinfo_has_x86_bmi2 ());
290
+ cpuinfo_log_debug ("%-20s: %d" , "clwb" , cpuinfo_has_x86_clwb ());
291
+ cpuinfo_log_debug ("%-20s: %d" , "clzero" , cpuinfo_has_x86_clzero ());
292
+ cpuinfo_log_debug ("%-20s: %d" , "cmpxchg16b" , cpuinfo_has_x86_cmpxchg16b ());
293
+ cpuinfo_log_debug ("%-20s: %d" , "f16c" , cpuinfo_has_x86_f16c ());
294
+ cpuinfo_log_debug ("%-20s: %d" , "fma3" , cpuinfo_has_x86_fma3 ());
295
+ cpuinfo_log_debug ("%-20s: %d" , "fma4" , cpuinfo_has_x86_fma4 ());
296
+ cpuinfo_log_debug ("%-20s: %d" , "gfni" , cpuinfo_has_x86_gfni ());
297
+ cpuinfo_log_debug ("%-20s: %d" , "hle" , cpuinfo_has_x86_hle ());
298
+ cpuinfo_log_debug ("%-20s: %d" , "lzcnt" , cpuinfo_has_x86_lzcnt ());
299
+ cpuinfo_log_debug ("%-20s: %d" , "misaligned_sse" , cpuinfo_has_x86_misaligned_sse ());
300
+ cpuinfo_log_debug ("%-20s: %d" , "movbe" , cpuinfo_has_x86_movbe ());
301
+ cpuinfo_log_debug ("%-20s: %d" , "mpx" , cpuinfo_has_x86_mpx ());
302
+ cpuinfo_log_debug ("%-20s: %d" , "mwait" , cpuinfo_has_x86_mwait ());
303
+ cpuinfo_log_debug ("%-20s: %d" , "mwaitx" , cpuinfo_has_x86_mwaitx ());
304
+ cpuinfo_log_debug ("%-20s: %d" , "pclmulqdq" , cpuinfo_has_x86_pclmulqdq ());
305
+ cpuinfo_log_debug ("%-20s: %d" , "popcnt" , cpuinfo_has_x86_popcnt ());
306
+ cpuinfo_log_debug ("%-20s: %d" , "prefetch" , cpuinfo_has_x86_prefetch ());
307
+ cpuinfo_log_debug ("%-20s: %d" , "prefetchw" , cpuinfo_has_x86_prefetchw ());
308
+ cpuinfo_log_debug ("%-20s: %d" , "prefetchwt1" , cpuinfo_has_x86_prefetchwt1 ());
309
+ cpuinfo_log_debug ("%-20s: %d" , "rdpid" , cpuinfo_has_x86_rdpid ());
310
+ cpuinfo_log_debug ("%-20s: %d" , "rdrand" , cpuinfo_has_x86_rdrand ());
311
+ cpuinfo_log_debug ("%-20s: %d" , "rdseed" , cpuinfo_has_x86_rdseed ());
312
+ cpuinfo_log_debug ("%-20s: %d" , "rdtscp" , cpuinfo_has_x86_rdtscp ());
313
+ cpuinfo_log_debug ("%-20s: %d" , "rtm" , cpuinfo_has_x86_rtm ());
314
+ cpuinfo_log_debug ("%-20s: %d" , "sha" , cpuinfo_has_x86_sha ());
315
+ cpuinfo_log_debug ("%-20s: %d" , "sse3" , cpuinfo_has_x86_sse3 ());
316
+ cpuinfo_log_debug ("%-20s: %d" , "sse4a" , cpuinfo_has_x86_sse4a ());
317
+ cpuinfo_log_debug ("%-20s: %d" , "sse4_1" , cpuinfo_has_x86_sse4_1 ());
318
+ cpuinfo_log_debug ("%-20s: %d" , "sse4_2" , cpuinfo_has_x86_sse4_2 ());
319
+ cpuinfo_log_debug ("%-20s: %d" , "ssse3" , cpuinfo_has_x86_ssse3 ());
320
+ cpuinfo_log_debug ("%-20s: %d" , "tbm" , cpuinfo_has_x86_tbm ());
321
+ cpuinfo_log_debug ("%-20s: %d" , "three_d_now" , cpuinfo_has_x86_3dnow ());
322
+ cpuinfo_log_debug ("%-20s: %d" , "three_d_now_plus" , cpuinfo_has_x86_3dnow_plus ());
323
+ cpuinfo_log_debug ("%-20s: %d" , "vaes" , cpuinfo_has_x86_vaes ());
324
+ cpuinfo_log_debug ("%-20s: %d" , "vpclmulqdq" , cpuinfo_has_x86_vpclmulqdq ());
325
+ cpuinfo_log_debug ("%-20s: %d" , "xop" , cpuinfo_has_x86_xop ());
326
+ cpuinfo_log_debug ("%-20s: %d" , "xsave" , cpuinfo_has_x86_xsave ());
327
+ cpuinfo_log_debug ("%-20s: %d" , "xtest" , cpuinfo_has_x86_xtest ());
328
+ cpuinfo_log_debug ("%-20s: %d" , "cmov" , cpuinfo_has_x86_cmov ());
329
+ cpuinfo_log_debug ("%-20s: %d" , "cmpxchg8b" , cpuinfo_has_x86_cmpxchg8b ());
330
+ cpuinfo_log_debug ("%-20s: %d" , "daz" , cpuinfo_has_x86_daz ());
331
+ cpuinfo_log_debug ("%-20s: %d" , "fpu" , cpuinfo_has_x86_fpu ());
332
+ cpuinfo_log_debug ("%-20s: %d" , "mmx" , cpuinfo_has_x86_mmx ());
333
+ cpuinfo_log_debug ("%-20s: %d" , "mmx_plus" , cpuinfo_has_x86_mmx_plus ());
334
+ cpuinfo_log_debug ("%-20s: %d" , "rdtsc" , cpuinfo_has_x86_rdtsc ());
335
+ cpuinfo_log_debug ("%-20s: %d" , "sse" , cpuinfo_has_x86_sse ());
336
+ cpuinfo_log_debug ("%-20s: %d" , "sse2" , cpuinfo_has_x86_sse2 ());
337
+ cpuinfo_log_debug ("%-20s: %d" , "three_d_now_geode" , cpuinfo_has_x86_3dnow_geode ());
338
+ cpuinfo_log_debug ("%-20s: %d" , "lahf_sahf" , cpuinfo_has_x86_lahf_sahf ());
339
+ cpuinfo_log_debug ("----------------------------" );
340
+ }
341
+ #endif // __DEBUG__
342
+ #endif // __ANDROID__
0 commit comments