[OpenBIOS] [PATCH, RFC 6/6] ppc: Fix stack setup

Segher Boessenkool segher at kernel.crashing.org
Mon Oct 11 04:53:24 CEST 2010


> +	mfpvr	r14				/* check if ppc64 */
> +	li		r15, 4
> +	srw		r14, r14, r15	/* >> 4 */

srwi 14,14,4

but you actually want to shift 16, not 4.

> +	cmplwi	r14, 0x33
> +	blt		1f
> +	cmplwi	r14, 0x7033
> +	bge		1f

This is too simplistic.  Here's something that detects
whether the CPU is currently in 64-bit mode, without
using 64-bit-only instructions:

lis 3,0x4000
add 3,3,3
addc 3,3,3
adde 3,3,3
cmplwi 3,0
beq 64bit
bne 32bit


Anyway, can't you always align to 128 bytes, and create
one frame for the 64-bit ABI?  Or do you really want to
save those few bytes...


Segher




More information about the OpenBIOS mailing list