Skip to content

Commit 35d431d

Browse files
committed
CPU (Linux): detect SOC name on RISCV
Fix #1519
1 parent 6a2e8de commit 35d431d

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

src/detection/cpu/cpu_linux.c

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ FF_MAYBE_UNUSED static void parseIsa(FFstrbuf* cpuIsa)
432432
}
433433
}
434434

435-
FF_MAYBE_UNUSED static void detectArmSoc(FFCPUResult* cpu)
435+
FF_MAYBE_UNUSED static void detectSocName(FFCPUResult* cpu)
436436
{
437437
if (cpu->name.length > 0)
438438
return;
@@ -565,35 +565,36 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
565565
if (!detectFrequency(cpu, options) || cpu->frequencyBase == 0)
566566
cpu->frequencyBase = (uint32_t) ffStrbufToUInt(&cpuMHz, 0);
567567

568-
#if !(__x86_64__ || __i386__ || __arm__ || __aarch64__)
569-
if(cpuUarch.length > 0)
570-
{
571-
if(cpu->name.length > 0)
572-
ffStrbufAppendC(&cpu->name, ' ');
573-
ffStrbufAppend(&cpu->name, &cpuUarch);
574-
}
575-
576-
if(cpuIsa.length > 0)
577-
{
578-
parseIsa(&cpuIsa);
579-
if(cpu->name.length > 0)
580-
ffStrbufAppendC(&cpu->name, ' ');
581-
ffStrbufAppend(&cpu->name, &cpuIsa);
582-
}
568+
#if __ANDROID__
569+
detectAndroid(cpu);
570+
#elif !(__x86_64__ || __i386__)
571+
detectSocName(cpu);
583572
#endif
584573

585574
#if __arm__ || __aarch64__
586575
uint32_t cpuImplementer = (uint32_t) strtoul(cpuImplementerStr.chars, NULL, 16);
587576
ffStrbufSetStatic(&cpu->vendor, hwImplId2Vendor(cpuImplementer));
588577

589-
#if __ANDROID__
590-
detectAndroid(cpu);
591-
#else
592-
detectArmSoc(cpu);
593-
#endif
594-
595578
if (cpu->name.length == 0)
596579
detectArmName(&cpuinfo, cpu, cpuImplementer);
580+
#elif !(__x86_64__ || __i386__)
581+
if (cpu->name.length == 0)
582+
{
583+
if(cpuUarch.length > 0)
584+
{
585+
if(cpu->name.length > 0)
586+
ffStrbufAppendC(&cpu->name, ' ');
587+
ffStrbufAppend(&cpu->name, &cpuUarch);
588+
}
589+
590+
if(cpuIsa.length > 0)
591+
{
592+
parseIsa(&cpuIsa);
593+
if(cpu->name.length > 0)
594+
ffStrbufAppendC(&cpu->name, ' ');
595+
ffStrbufAppend(&cpu->name, &cpuIsa);
596+
}
597+
}
597598
#endif
598599

599600
return NULL;

0 commit comments

Comments
 (0)