sparc64: Do not clobber %g2 in xcall_fetch_glob_regs().
authorDavid S. Miller <davem@davemloft.net>
Thu, 10 May 2012 18:00:46 +0000 (11:00 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 May 2012 21:56:42 +0000 (22:56 +0100)
[ Upstream commit a5a737e090e25981e99d69f01400e3a80356581c ]

%g2 is meant to hold the CPUID number throughout this routine, since
at the very beginning, and at the very end, we use %g2 to calculate
indexes into per-cpu arrays.

However we erroneously clobber it in order to hold the %cwp register
value mid-stream.

Fix this code to use %g3 for the %cwp read and related calulcations
instead.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/sparc/kernel/central.c
arch/sparc/mm/ultra.S

index 38d48a5..9708851 100644 (file)
@@ -269,4 +269,4 @@ static int __init sunfire_init(void)
        return 0;
 }
 
-subsys_initcall(sunfire_init);
+fs_initcall(sunfire_init);
index b57a594..874162a 100644 (file)
@@ -495,11 +495,11 @@ xcall_fetch_glob_regs:
        stx             %o7, [%g1 + GR_SNAP_O7]
        stx             %i7, [%g1 + GR_SNAP_I7]
        /* Don't try this at home kids... */
-       rdpr            %cwp, %g2
-       sub             %g2, 1, %g7
+       rdpr            %cwp, %g3
+       sub             %g3, 1, %g7
        wrpr            %g7, %cwp
        mov             %i7, %g7
-       wrpr            %g2, %cwp
+       wrpr            %g3, %cwp
        stx             %g7, [%g1 + GR_SNAP_RPC]
        sethi           %hi(trap_block), %g7
        or              %g7, %lo(trap_block), %g7