Closed ghost closed 6 years ago
I'm sorry but I'm currently not expanding support for architectures that do not have CPUFLAGS*. The support for PPC is planned eventually but it strongly relies on some Gentoo developer (or possibly user) taking the effort to design CPU_FLAGS_PPC, i.e. find all relevant flags used in Gentoo, collect and describe them, prepare profile updates.
Hi,
I checked this issue out and apparently the way grepwood implemented it is the easiest.
The only thing analogous to x86's cpuid instruction on PowerPC is copying the value of the Processor Version Register. This special register is read-only and it is restricted to supervisors only. Some kernels like Linux and FreeBSD do the smart thing and trap its value in memory and expose it for userspace applications to have a look at. That makes reading /proc/self/auxv fair enough a method. The PVR is a 32bit register and its first half contains the version, the other revision. More info: http://www.cebix.net/downloads/bebox/pem32b.pdf pages 78-79
Example: the PVR on Cell Broadband Engine is 0x 0070 0501. From arch/powerpc/kernel/cputable.c:
We can see that version clearly matches 0x0070. Checking for PPC_FEATURE_HAS_ALTIVEC is legit, because of $(grep PPC_FEATURE_HAS_ALTIVEC arch/powerpc) in the kernel source tree. These 2 macros are always equal.