Skip to content

Commit 36a452c

Browse files
committed
CPU (NetBSD): support non-intel CPUs
Fix #1573
1 parent c66b32f commit 36a452c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/detection/cpu/cpu_nbsd.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ static const char* detectCpuTemp(double* current)
4242

4343
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
4444
{
45-
if (ffSysctlGetString("machdep.cpu_brand", &cpu->name) != NULL)
45+
if (ffSysctlGetString("machdep.cpu_brand", &cpu->name) != NULL &&
46+
ffSysctlGetString("machdep.dmi.processor-version", &cpu->name) != NULL &&
47+
ffSysctlGetString("hw.cpu0.name", &cpu->name) != NULL)
4648
{
47-
if (ffSysctlGetString("machdep.dmi.processor-version", &cpu->name) != NULL)
48-
return "sysctlbyname(machdep.cpu_brand) failed";
49+
ffStrbufSetS(&cpu->name, "Unknown CPU");
4950
}
5051

5152
if (ffSysctlGetString("machdep.dmi.processor-vendor", &cpu->vendor) == NULL)
@@ -58,6 +59,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
5859
ffCPUDetectSpeedByCpuid(cpu);
5960

6061
uint32_t freq = (uint32_t) ffSysctlGetInt("machdep.cpu.frequency.target", 0);
62+
if (freq == 0) freq = (uint32_t) (ffSysctlGetInt64("hw.cpu0.clock_frequency", 0) / 1000000);
6163
if (freq > cpu->frequencyBase) cpu->frequencyBase = freq;
6264

6365
cpu->temperature = FF_CPU_TEMP_UNSET;

0 commit comments

Comments
 (0)