aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/head_8xx.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/head_8xx.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/head_8xx.S')
-rw-r--r--arch/powerpc/kernel/head_8xx.S13
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 52ff8c53b93c..6ded19d01891 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -110,8 +110,8 @@ turn_on_mmu:
110 * task's thread_struct. 110 * task's thread_struct.
111 */ 111 */
112#define EXCEPTION_PROLOG \ 112#define EXCEPTION_PROLOG \
113 mtspr SPRN_SPRG0,r10; \ 113 mtspr SPRN_SPRG_SCRATCH0,r10; \
114 mtspr SPRN_SPRG1,r11; \ 114 mtspr SPRN_SPRG_SCRATCH1,r11; \
115 mfcr r10; \ 115 mfcr r10; \
116 EXCEPTION_PROLOG_1; \ 116 EXCEPTION_PROLOG_1; \
117 EXCEPTION_PROLOG_2 117 EXCEPTION_PROLOG_2
@@ -121,7 +121,7 @@ turn_on_mmu:
121 andi. r11,r11,MSR_PR; \ 121 andi. r11,r11,MSR_PR; \
122 tophys(r11,r1); /* use tophys(r1) if kernel */ \ 122 tophys(r11,r1); /* use tophys(r1) if kernel */ \
123 beq 1f; \ 123 beq 1f; \
124 mfspr r11,SPRN_SPRG3; \ 124 mfspr r11,SPRN_SPRG_THREAD; \
125 lwz r11,THREAD_INFO-THREAD(r11); \ 125 lwz r11,THREAD_INFO-THREAD(r11); \
126 addi r11,r11,THREAD_SIZE; \ 126 addi r11,r11,THREAD_SIZE; \
127 tophys(r11,r11); \ 127 tophys(r11,r11); \
@@ -133,9 +133,9 @@ turn_on_mmu:
133 stw r10,_CCR(r11); /* save registers */ \ 133 stw r10,_CCR(r11); /* save registers */ \
134 stw r12,GPR12(r11); \ 134 stw r12,GPR12(r11); \
135 stw r9,GPR9(r11); \ 135 stw r9,GPR9(r11); \
136 mfspr r10,SPRN_SPRG0; \ 136 mfspr r10,SPRN_SPRG_SCRATCH0; \
137 stw r10,GPR10(r11); \ 137 stw r10,GPR10(r11); \
138 mfspr r12,SPRN_SPRG1; \ 138 mfspr r12,SPRN_SPRG_SCRATCH1; \
139 stw r12,GPR11(r11); \ 139 stw r12,GPR11(r11); \
140 mflr r10; \ 140 mflr r10; \
141 stw r10,_LINK(r11); \ 141 stw r10,_LINK(r11); \
@@ -603,8 +603,9 @@ start_here:
603 /* ptr to phys current thread */ 603 /* ptr to phys current thread */
604 tophys(r4,r2) 604 tophys(r4,r2)
605 addi r4,r4,THREAD /* init task's THREAD */ 605 addi r4,r4,THREAD /* init task's THREAD */
606 mtspr SPRN_SPRG3,r4 606 mtspr SPRN_SPRG_THREAD,r4
607 li r3,0 607 li r3,0
608 /* XXX What is that for ? SPRG2 appears otherwise unused on 8xx */
608 mtspr SPRN_SPRG2,r3 /* 0 => r1 has kernel sp */ 609 mtspr SPRN_SPRG2,r3 /* 0 => r1 has kernel sp */
609 610
610 /* stack */ 611 /* stack */