Saving to 32 bits of GPRs in signal context
Segher Boessenkool
segher at kernel.crashing.org
Tue May 29 23:12:24 EST 2007
>> - how can an application know that it can use 64 bit registers and
>> call
>> the optimized routines?
>
> I'd say use the 32 bits ABI, AT_HWCAP will tell you if you are running
> on a 64 bits capable machine. You can then either use hand tuned code
> at
> runtime, or I think ld.so can load alternate libs based on the bits in
> there.
Or you can simply only install 64-bit binaries on 64-bit
machines.
>> Finally, I've not seen a compiler (well, GCC, but I don't have 4.2 or
>> 4.3 installed yet) that allows you to tell the compiler to use 32 bit
>> addresses but assume that integer registers are 64 bit wide. As long
>> as such an option does not exist, the usefulness of this feature is
>> somewhat limited. In other words, GCC for now has support for ILP32
>> and
>> LP64 modes, but it would be better to also have support for IP32L64.
>
> Depends... If such binaries are actual 64 bits binaries from a kernel
> POV, then no change is necessary.
The kernel (and some libraries that do explicit mmap()s)
will have to make sure that all pointers stay within the
32-bit address space. This is most easily done by only
allowing mappings in the low 32-bit, and some initial
memory layout work is needed I guess. Seems quite easy
actually, certainly from the kernel perspective. And the
gain is higher than that of -m32 -mpowerpc64 over -m32.
If you want to do the 32-bit ABI in 64-bit ELF binaries,
more work is involved. Might very well be even better
though.
Segher
More information about the Linuxppc-dev
mailing list