aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/entry_32.S
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-07-14 16:52:54 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-19 20:12:27 -0400
commitee43eb788b3a06425fffb912677e2e1c8b00dd3b (patch)
tree7233cb47647837ab00af81270b3a16555d88a1f1 /arch/powerpc/kernel/entry_32.S
parent8aa34ab8b2dc96ca6c4feecfb87ed13f0d40ef98 (diff)
powerpc: Use names rather than numbers for SPRGs (v2)
The kernel uses SPRG registers for various purposes, typically in low level assembly code as scratch registers or to hold per-cpu global infos such as the PACA or the current thread_info pointer. We want to be able to easily shuffle the usage of those registers as some implementations have specific constraints realted to some of them, for example, some have userspace readable aliases, etc.. and the current choice isn't always the best. This patch should not change any code generation, and replaces the usage of SPRN_SPRGn everywhere in the kernel with a named replacement and adds documentation next to the definition of the names as to what those are used for on each processor family. The only parts that still use the original numbers are bits of KVM or suspend/resume code that just blindly needs to save/restore all the SPRGs. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/entry_32.S')
-rw-r--r--arch/powerpc/kernel/entry_32.S20
1 files changed, 10 insertions, 10 deletions
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 3cadba60a4b6..1175a8539e6c 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -88,7 +88,7 @@ crit_transfer_to_handler:
88 mfspr r0,SPRN_SRR1 88 mfspr r0,SPRN_SRR1
89 stw r0,_SRR1(r11) 89 stw r0,_SRR1(r11)
90 90
91 mfspr r8,SPRN_SPRG3 91 mfspr r8,SPRN_SPRG_THREAD
92 lwz r0,KSP_LIMIT(r8) 92 lwz r0,KSP_LIMIT(r8)
93 stw r0,SAVED_KSP_LIMIT(r11) 93 stw r0,SAVED_KSP_LIMIT(r11)
94 rlwimi r0,r1,0,0,(31-THREAD_SHIFT) 94 rlwimi r0,r1,0,0,(31-THREAD_SHIFT)
@@ -108,7 +108,7 @@ crit_transfer_to_handler:
108 mfspr r0,SPRN_SRR1 108 mfspr r0,SPRN_SRR1
109 stw r0,crit_srr1@l(0) 109 stw r0,crit_srr1@l(0)
110 110
111 mfspr r8,SPRN_SPRG3 111 mfspr r8,SPRN_SPRG_THREAD
112 lwz r0,KSP_LIMIT(r8) 112 lwz r0,KSP_LIMIT(r8)
113 stw r0,saved_ksp_limit@l(0) 113 stw r0,saved_ksp_limit@l(0)
114 rlwimi r0,r1,0,0,(31-THREAD_SHIFT) 114 rlwimi r0,r1,0,0,(31-THREAD_SHIFT)
@@ -138,7 +138,7 @@ transfer_to_handler:
138 mfspr r2,SPRN_XER 138 mfspr r2,SPRN_XER
139 stw r12,_CTR(r11) 139 stw r12,_CTR(r11)
140 stw r2,_XER(r11) 140 stw r2,_XER(r11)
141 mfspr r12,SPRN_SPRG3 141 mfspr r12,SPRN_SPRG_THREAD
142 addi r2,r12,-THREAD 142 addi r2,r12,-THREAD
143 tovirt(r2,r2) /* set r2 to current */ 143 tovirt(r2,r2) /* set r2 to current */
144 beq 2f /* if from user, fix up THREAD.regs */ 144 beq 2f /* if from user, fix up THREAD.regs */
@@ -680,7 +680,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_SPE)
680 680
681 tophys(r0,r4) 681 tophys(r0,r4)
682 CLR_TOP32(r0) 682 CLR_TOP32(r0)
683 mtspr SPRN_SPRG3,r0 /* Update current THREAD phys addr */ 683 mtspr SPRN_SPRG_THREAD,r0 /* Update current THREAD phys addr */
684 lwz r1,KSP(r4) /* Load new stack pointer */ 684 lwz r1,KSP(r4) /* Load new stack pointer */
685 685
686 /* save the old current 'last' for return value */ 686 /* save the old current 'last' for return value */
@@ -1057,7 +1057,7 @@ exc_exit_restart_end:
1057#ifdef CONFIG_40x 1057#ifdef CONFIG_40x
1058 .globl ret_from_crit_exc 1058 .globl ret_from_crit_exc
1059ret_from_crit_exc: 1059ret_from_crit_exc:
1060 mfspr r9,SPRN_SPRG3 1060 mfspr r9,SPRN_SPRG_THREAD
1061 lis r10,saved_ksp_limit@ha; 1061 lis r10,saved_ksp_limit@ha;
1062 lwz r10,saved_ksp_limit@l(r10); 1062 lwz r10,saved_ksp_limit@l(r10);
1063 tovirt(r9,r9); 1063 tovirt(r9,r9);
@@ -1074,7 +1074,7 @@ ret_from_crit_exc:
1074#ifdef CONFIG_BOOKE 1074#ifdef CONFIG_BOOKE
1075 .globl ret_from_crit_exc 1075 .globl ret_from_crit_exc
1076ret_from_crit_exc: 1076ret_from_crit_exc:
1077 mfspr r9,SPRN_SPRG3 1077 mfspr r9,SPRN_SPRG_THREAD
1078 lwz r10,SAVED_KSP_LIMIT(r1) 1078 lwz r10,SAVED_KSP_LIMIT(r1)
1079 stw r10,KSP_LIMIT(r9) 1079 stw r10,KSP_LIMIT(r9)
1080 RESTORE_xSRR(SRR0,SRR1); 1080 RESTORE_xSRR(SRR0,SRR1);
@@ -1083,7 +1083,7 @@ ret_from_crit_exc:
1083 1083
1084 .globl ret_from_debug_exc 1084 .globl ret_from_debug_exc
1085ret_from_debug_exc: 1085ret_from_debug_exc:
1086 mfspr r9,SPRN_SPRG3 1086 mfspr r9,SPRN_SPRG_THREAD
1087 lwz r10,SAVED_KSP_LIMIT(r1) 1087 lwz r10,SAVED_KSP_LIMIT(r1)
1088 stw r10,KSP_LIMIT(r9) 1088 stw r10,KSP_LIMIT(r9)
1089 lwz r9,THREAD_INFO-THREAD(r9) 1089 lwz r9,THREAD_INFO-THREAD(r9)
@@ -1097,7 +1097,7 @@ ret_from_debug_exc:
1097 1097
1098 .globl ret_from_mcheck_exc 1098 .globl ret_from_mcheck_exc
1099ret_from_mcheck_exc: 1099ret_from_mcheck_exc:
1100 mfspr r9,SPRN_SPRG3 1100 mfspr r9,SPRN_SPRG_THREAD
1101 lwz r10,SAVED_KSP_LIMIT(r1) 1101 lwz r10,SAVED_KSP_LIMIT(r1)
1102 stw r10,KSP_LIMIT(r9) 1102 stw r10,KSP_LIMIT(r9)
1103 RESTORE_xSRR(SRR0,SRR1); 1103 RESTORE_xSRR(SRR0,SRR1);
@@ -1255,7 +1255,7 @@ _GLOBAL(enter_rtas)
1255 MTMSRD(r0) /* don't get trashed */ 1255 MTMSRD(r0) /* don't get trashed */
1256 li r9,MSR_KERNEL & ~(MSR_IR|MSR_DR) 1256 li r9,MSR_KERNEL & ~(MSR_IR|MSR_DR)
1257 mtlr r6 1257 mtlr r6
1258 mtspr SPRN_SPRG2,r7 1258 mtspr SPRN_SPRG_RTAS,r7
1259 mtspr SPRN_SRR0,r8 1259 mtspr SPRN_SRR0,r8
1260 mtspr SPRN_SRR1,r9 1260 mtspr SPRN_SRR1,r9
1261 RFI 1261 RFI
@@ -1265,7 +1265,7 @@ _GLOBAL(enter_rtas)
1265 FIX_SRR1(r9,r0) 1265 FIX_SRR1(r9,r0)
1266 addi r1,r1,INT_FRAME_SIZE 1266 addi r1,r1,INT_FRAME_SIZE
1267 li r0,0 1267 li r0,0
1268 mtspr SPRN_SPRG2,r0 1268 mtspr SPRN_SPRG_RTAS,r0
1269 mtspr SPRN_SRR0,r8 1269 mtspr SPRN_SRR0,r8
1270 mtspr SPRN_SRR1,r9 1270 mtspr SPRN_SRR1,r9
1271 RFI /* return to caller */ 1271 RFI /* return to caller */