[PATCH] PPC64: Fix recent regression

Jimi Xenidis jimix at watson.ibm.com
Thu Sep 15 22:42:19 EST 2005


>>>>> "OJ" == Olof Johansson <olof at lixom.net> writes:

 OJ> On Wed, Sep 14, 2005 at 09:16:57PM -0700, Linus Torvalds wrote:
 >> 
 >> Hmm.. The patch that you say broke things changed _two_ cases of
 >> 
 >> cmpldi  r3,PLATFORM_PSERIES_LPAR
 >> 
 >> to
 >> 
 >> andi.   r3,r3,PLATFORM_LPAR
 >> 
 >> (and changed one "andi. r3,r3,0x1" to use the symbolic form and also 
 >> become a "andi. r3,r3,PLATFORM_LPAR").

Yes Linus, there were 3 changes overall, the first 2 should have had
the polarity changed (my apologies).  Olaf's patch only changes the
first.  The third is explain by Olaf's in his reply.
Olaf, good catch!

 >> I won't claim to understand the code, but it looks like there's one change 
 >> missing. Or maybe an explanation of why that ones polarity stays the same.

Operations "addic.", "andi.", and "andis." set the CR bits to the
result signed compared with 0 (which is eq=1). So perhaps a more
"descriptive" mnemonic would be "bz" but thats not available.

Here is a patch that hopefully explains them all wihout knowing that
CR bits.
Signed-off-by: Jimi Xenidis <jimix at watson.ibm.com>

diff -r 4f2651e19e59 arch/ppc64/kernel/head.S
--- a/arch/ppc64/kernel/head.S	Wed Sep 14 15:48:20 2005
+++ b/arch/ppc64/kernel/head.S	Thu Sep 15 08:25:47 2005
@@ -1649,7 +1649,7 @@
 	ld	r3,0(r3)
 	lwz	r3,PLATFORM(r3)		/* r3 = platform flags		 */
 	andi.	r3,r3,PLATFORM_LPAR	/* Test if bit 0 is set (LPAR bit) */
-	bne	98f
+	beq	98f			/* branch if result is 0  */
 	mfspr	r3,PVR
 	srwi	r3,r3,16
 	cmpwi	r3,0x37			/* SStar  */
@@ -1813,7 +1813,7 @@
 	ld	r3,0(r3)
 	lwz	r3,PLATFORM(r3)		/* r3 = platform flags */
 	andi.	r3,r3,PLATFORM_LPAR	/* Test if bit 0 is set (LPAR bit) */
-	bne	98f
+	beq	98f			/* branch if result is 0  */
 	mfspr	r3,PVR
 	srwi	r3,r3,16
 	cmpwi	r3,0x37			/* SStar */
@@ -1834,7 +1834,7 @@
 	lwz	r3,PLATFORM(r3)		/* r3 = platform flags */
 	/* Test if bit 0 is set (LPAR bit) */
 	andi.	r3,r3,PLATFORM_LPAR
-	bne	98f
+	bne	98f			/* branch if result is !0  */
 	LOADADDR(r6,_SDR1)		/* Only if NOT LPAR */
 	sub	r6,r6,r26
 	ld	r6,0(r6)		/* get the value of _SDR1 */



More information about the Linuxppc64-dev mailing list