diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-02-03 00:55:10 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:11:35 -0500 |
commit | ffe483d55229fadbaf4cc7316d47024a24ecd1a2 (patch) | |
tree | 70bdb6c94d5b3512a7b2a3ff06979ac2e4e869bf /include/asm-sparc64/cpudata.h | |
parent | 92704a1c63c3b481870d02636d0b5a70c7e21cd1 (diff) |
[SPARC64]: Add explicit register args to trap state loading macros.
This, as well as making the code cleaner, allows a simplification in
the TSB miss handling path.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/cpudata.h')
-rw-r--r-- | include/asm-sparc64/cpudata.h | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h index da54b4f35403..c15514f82c33 100644 --- a/include/asm-sparc64/cpudata.h +++ b/include/asm-sparc64/cpudata.h | |||
@@ -107,67 +107,67 @@ extern struct cpuid_patch_entry __cpuid_patch, __cpuid_patch_end; | |||
107 | lduwa [REG] ASI_PHYS_BYPASS_EC_E, REG;\ | 107 | lduwa [REG] ASI_PHYS_BYPASS_EC_E, REG;\ |
108 | .previous; | 108 | .previous; |
109 | 109 | ||
110 | /* Clobbers %g1, current address space PGD phys address into %g7. */ | 110 | /* Clobbers TMP, current address space PGD phys address into DEST. */ |
111 | #define TRAP_LOAD_PGD_PHYS \ | 111 | #define TRAP_LOAD_PGD_PHYS(DEST, TMP) \ |
112 | __GET_CPUID(%g1) \ | 112 | __GET_CPUID(TMP) \ |
113 | sethi %hi(trap_block), %g7; \ | 113 | sethi %hi(trap_block), DEST; \ |
114 | sllx %g1, TRAP_BLOCK_SZ_SHIFT, %g1; \ | 114 | sllx TMP, TRAP_BLOCK_SZ_SHIFT, TMP; \ |
115 | or %g7, %lo(trap_block), %g7; \ | 115 | or DEST, %lo(trap_block), DEST; \ |
116 | add %g7, %g1, %g7; \ | 116 | add DEST, TMP, DEST; \ |
117 | ldx [%g7 + TRAP_PER_CPU_PGD_PADDR], %g7; | 117 | ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST; |
118 | 118 | ||
119 | /* Clobbers %g1, loads local processor's IRQ work area into %g6. */ | 119 | /* Clobbers TMP, loads local processor's IRQ work area into DEST. */ |
120 | #define TRAP_LOAD_IRQ_WORK \ | 120 | #define TRAP_LOAD_IRQ_WORK(DEST, TMP) \ |
121 | __GET_CPUID(%g1) \ | 121 | __GET_CPUID(TMP) \ |
122 | sethi %hi(__irq_work), %g6; \ | 122 | sethi %hi(__irq_work), DEST; \ |
123 | sllx %g1, 6, %g1; \ | 123 | sllx TMP, 6, TMP; \ |
124 | or %g6, %lo(__irq_work), %g6; \ | 124 | or DEST, %lo(__irq_work), DEST; \ |
125 | add %g6, %g1, %g6; | 125 | add DEST, TMP, DEST; |
126 | 126 | ||
127 | /* Clobbers %g1, loads %g6 with current thread info pointer. */ | 127 | /* Clobbers TMP, loads DEST with current thread info pointer. */ |
128 | #define TRAP_LOAD_THREAD_REG \ | 128 | #define TRAP_LOAD_THREAD_REG(DEST, TMP) \ |
129 | __GET_CPUID(%g1) \ | 129 | __GET_CPUID(TMP) \ |
130 | sethi %hi(trap_block), %g6; \ | 130 | sethi %hi(trap_block), DEST; \ |
131 | sllx %g1, TRAP_BLOCK_SZ_SHIFT, %g1; \ | 131 | sllx TMP, TRAP_BLOCK_SZ_SHIFT, TMP; \ |
132 | or %g6, %lo(trap_block), %g6; \ | 132 | or DEST, %lo(trap_block), DEST; \ |
133 | ldx [%g6 + %g1], %g6; | 133 | ldx [DEST + TMP], DEST; |
134 | 134 | ||
135 | /* Given the current thread info pointer in %g6, load the per-cpu | 135 | /* Given the current thread info pointer in THR, load the per-cpu |
136 | * area base of the current processor into %g5. REG1, REG2, and REG3 are | 136 | * area base of the current processor into DEST. REG1, REG2, and REG3 are |
137 | * clobbered. | 137 | * clobbered. |
138 | * | 138 | * |
139 | * You absolutely cannot use %g5 as a temporary in this code. The | 139 | * You absolutely cannot use DEST as a temporary in this code. The |
140 | * reason is that traps can happen during execution, and return from | 140 | * reason is that traps can happen during execution, and return from |
141 | * trap will load the fully resolved %g5 per-cpu base. This can corrupt | 141 | * trap will load the fully resolved DEST per-cpu base. This can corrupt |
142 | * the calculations done by the macro mid-stream. | 142 | * the calculations done by the macro mid-stream. |
143 | */ | 143 | */ |
144 | #define LOAD_PER_CPU_BASE(REG1, REG2, REG3) \ | 144 | #define LOAD_PER_CPU_BASE(DEST, THR, REG1, REG2, REG3) \ |
145 | ldub [%g6 + TI_CPU], REG1; \ | 145 | ldub [THR + TI_CPU], REG1; \ |
146 | sethi %hi(__per_cpu_shift), REG3; \ | 146 | sethi %hi(__per_cpu_shift), REG3; \ |
147 | sethi %hi(__per_cpu_base), REG2; \ | 147 | sethi %hi(__per_cpu_base), REG2; \ |
148 | ldx [REG3 + %lo(__per_cpu_shift)], REG3; \ | 148 | ldx [REG3 + %lo(__per_cpu_shift)], REG3; \ |
149 | ldx [REG2 + %lo(__per_cpu_base)], REG2; \ | 149 | ldx [REG2 + %lo(__per_cpu_base)], REG2; \ |
150 | sllx REG1, REG3, REG3; \ | 150 | sllx REG1, REG3, REG3; \ |
151 | add REG3, REG2, %g5; | 151 | add REG3, REG2, DEST; |
152 | 152 | ||
153 | #else | 153 | #else |
154 | 154 | ||
155 | /* Uniprocessor versions, we know the cpuid is zero. */ | 155 | /* Uniprocessor versions, we know the cpuid is zero. */ |
156 | #define TRAP_LOAD_PGD_PHYS \ | 156 | #define TRAP_LOAD_PGD_PHYS(DEST, TMP) \ |
157 | sethi %hi(trap_block), %g7; \ | 157 | sethi %hi(trap_block), DEST; \ |
158 | or %g7, %lo(trap_block), %g7; \ | 158 | or DEST, %lo(trap_block), DEST; \ |
159 | ldx [%g7 + TRAP_PER_CPU_PGD_PADDR], %g7; | 159 | ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST; |
160 | 160 | ||
161 | #define TRAP_LOAD_IRQ_WORK \ | 161 | #define TRAP_LOAD_IRQ_WORK(DEST, TMP) \ |
162 | sethi %hi(__irq_work), %g6; \ | 162 | sethi %hi(__irq_work), DEST; \ |
163 | or %g6, %lo(__irq_work), %g6; | 163 | or DEST, %lo(__irq_work), DEST; |
164 | 164 | ||
165 | #define TRAP_LOAD_THREAD_REG \ | 165 | #define TRAP_LOAD_THREAD_REG(DEST, TMP) \ |
166 | sethi %hi(trap_block), %g6; \ | 166 | sethi %hi(trap_block), DEST; \ |
167 | ldx [%g6 + %lo(trap_block)], %g6; | 167 | ldx [DEST + %lo(trap_block)], DEST; |
168 | 168 | ||
169 | /* No per-cpu areas on uniprocessor, so no need to load %g5. */ | 169 | /* No per-cpu areas on uniprocessor, so no need to load DEST. */ |
170 | #define LOAD_PER_CPU_BASE(REG1, REG2, REG3) | 170 | #define LOAD_PER_CPU_BASE(DEST, THR, REG1, REG2, REG3) |
171 | 171 | ||
172 | #endif /* !(CONFIG_SMP) */ | 172 | #endif /* !(CONFIG_SMP) */ |
173 | 173 | ||