ps3 64-bit kernel: patched prpmc2800.c (fwd)

Maik Nijhuis maik at cs.vu.nl
Fri May 25 16:39:53 EST 2007


I had an earlier discussion with Geoff Levand, he suggested me to post it
here.

While compiling a 64-bit kernel for the playstation 3 I noticed that
arch/powerpc/boot/prpmc2800.c doesn't compile. The assembler complains
about a constant that is too big.

When I compile prpmc2800.c this is what 'make V=1' shows:

gcc -m32 -Wp,-MD,arch/powerpc/boot/.prpmc2800.o.d -Wall
-Wstrict-prototypes -O2 -fomit-frame-pointer -fno-builtin -nostdinc
-isystem /usr/lib/gcc/powerpc64-unknown-linux-gnu/4.1.2/include -fPIC
-fno-stack-protector -Iarch/powerpc/boot
-I/usr/src/ps3-linux/arch/powerpc/boot -c -o arch/powerpc/boot/prpmc2800.o
arch/powerpc/boot/prpmc2800.c

And then this error follows:

/tmp/ccYHAOD7.s: Assembler messages:
/tmp/ccYHAOD7.s:9: Error: operand out of range (0xffffffffffff7fff is not
between 0x0000000000000000 and 0x00000000ffffffff)

I managed to fix this issue as follows: At the end of
arch/powerpc/boot/prpmc2800.c, there is an assembly instruction

rlwinm  10,10,0,~(1<<15)

I replaced this by

rlwinm  10,10,0,~(1<<15) & ((1<<32)-1)

I am running 64-bit gentoo linux with binutils 2.17.50.0.16. It has been
compiled on my ps3 using gentoo ebuild scripts.

After downgrading to binutils 2.17 the problem is gone..

In the binutils bugzilla I couldn't find anything when I searched for
'operand out of range'. It seems like an assembler bug: A 64-bit value is
assumed in a 32 bit instruction, even though the assembler runs in 32 bit
mode because of the -m32. As the value is used in an 'and', the high bits
can safely be ignored.

Could you please either fix binutils or apply the above patch?

Maik



More information about the Linuxppc-dev mailing list