Re: [PATCH] Detect 64-bit-ness in PowerPC Book III-E

Ulrich Weigand
2014-12-19T15:49:49Z

Yao Qi wrote:
> Ulrich Weigand <uweigand@de.ibm.com> writes:
> > Anton, what would you suggest a user program to use to safely detect
> > whether a ptrace-attached child is 64-bit or not, on either Book III-S
> > or Book III-E systems?
>
> Maybe, we can first detect the Book III-S vs. Book III-E, and then
> detect 64-bit-ness. However, I go through PowerISA, but don't find a
> way to differentiate Book III-S and Book III-E.

Well, on Linux a reliable way should be to check HWCAP for the bit:
#define PPC_FEATURE_BOOKE 0x00008000
This should be true if and only if we're running on any Book E
machine.

Of course, we cannot use the *inferior* process' HWCAP to decide
this, since we need to know the inferior process' wordsize in order
to decode its auxv. We could use gdbserver's (or native GDB's)
*own* HWCAP to check for Book E, I guess, since this is an
invariant for the whole machine ...

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com