diff options
-rw-r--r-- | src/libFLAC/cpu.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libFLAC/cpu.c b/src/libFLAC/cpu.c index 64da9cbc..c90b8999 100644 --- a/src/libFLAC/cpu.c +++ b/src/libFLAC/cpu.c @@ -245,11 +245,24 @@ ppc_cpu_info (FLAC__CPUInfo *info) #define PPC_FEATURE2_ARCH_2_07 0x80000000 #endif +#ifdef __linux__ if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_00) { info->ppc.arch_3_00 = true; } else if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07) { info->ppc.arch_2_07 = true; } +#elif defined(__FreeBSD__) + long hwcaps; + elf_aux_info(AT_HWCAP2, &hwcaps, sizeof(hwcaps)); +#else +#error Unsupported platform! Please add support for reading ppc hwcaps. +#endif + + if (hwcaps & PPC_FEATURE2_ARCH_3_00) { + info->ppc.arch_3_00 = true; + } else if (hwcaps & PPC_FEATURE2_ARCH_2_07) { + info->ppc.arch_2_07 = true; + } #else info->ppc.arch_2_07 = false; info->ppc.arch_3_00 = false; |