aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-sparc64/cpudata.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index 16d628913837..f83768883e98 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -101,20 +101,25 @@ extern void setup_tba(void);
101 ldx [%g1 + %g6], %g6; 101 ldx [%g1 + %g6], %g6;
102 102
103/* Given the current thread info pointer in %g6, load the per-cpu 103/* Given the current thread info pointer in %g6, load the per-cpu
104 * area base of the current processor into %g5. REG1 and REG2 are 104 * area base of the current processor into %g5. REG1, REG2, and REG3 are
105 * clobbered. 105 * clobbered.
106 *
107 * You absolutely cannot use %g5 as a temporary in this code. The
108 * reason is that traps can happen during execution, and return from
109 * trap will load the fully resolved %g5 per-cpu base. This can corrupt
110 * the calculations done by the macro mid-stream.
106 */ 111 */
107#ifdef CONFIG_SMP 112#ifdef CONFIG_SMP
108#define LOAD_PER_CPU_BASE(REG1, REG2) \ 113#define LOAD_PER_CPU_BASE(REG1, REG2, REG3) \
109 ldub [%g6 + TI_CPU], REG1; \ 114 ldub [%g6 + TI_CPU], REG1; \
110 sethi %hi(__per_cpu_shift), %g5; \ 115 sethi %hi(__per_cpu_shift), REG3; \
111 sethi %hi(__per_cpu_base), REG2; \ 116 sethi %hi(__per_cpu_base), REG2; \
112 ldx [%g5 + %lo(__per_cpu_shift)], %g5; \ 117 ldx [REG3 + %lo(__per_cpu_shift)], REG3; \
113 ldx [REG2 + %lo(__per_cpu_base)], REG2; \ 118 ldx [REG2 + %lo(__per_cpu_base)], REG2; \
114 sllx REG1, %g5, %g5; \ 119 sllx REG1, REG3, REG3; \
115 add %g5, REG2, %g5; 120 add REG3, REG2, %g5;
116#else 121#else
117#define LOAD_PER_CPU_BASE(REG1, REG2) 122#define LOAD_PER_CPU_BASE(REG1, REG2, REG3)
118#endif 123#endif
119 124
120#endif /* _SPARC64_CPUDATA_H */ 125#endif /* _SPARC64_CPUDATA_H */