> +     /* Check if the processor is running in 32 bit mode, using
> +      * only 32 bit instructions which should be safe on 32 and
> +      * 64 bit processors.
> +      *
> +      * Subtract the bottom 32 bits of MSR from the full value
> +      * recording the result.  Since MSR[SF] is in the high word,
> +      * the result will be not-equal iff in 32 bit mode (either
> +      * the processor is a 32 bit processor or MSR[SF] = 0).
> +      */

The other way around -- the processor is 64-bit and MSR[SF]=1.

Great trick btw! :-)

> +     mfmsr   r0              /* grab whole msr               */
> +     rlwinm  r8,r0,0,0,31    /* extract bottom word          */
> +     subf.   r8,r8,r0        /* subtract, same?              */
> +     beq     0f              /* yes: we are 32 bit mode      */

The code is fine though.


Segher

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to