Skip to content

Commit eda8dd1

Browse files
committed
xtensa: use a14 instead of a15 in inline assembly
a15 is a frame pointer in the call0 xtensa ABI, don't use it explicitly in the inline assembly. Use a14 instead, as it has the same properties as a15 w.r.t. window overflow. Signed-off-by: Max Filippov <[email protected]>
1 parent e369953 commit eda8dd1

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

arch/xtensa/include/asm/atomic.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
*
2626
* Locking interrupts looks like this:
2727
*
28-
* rsil a15, TOPLEVEL
28+
* rsil a14, TOPLEVEL
2929
* <code>
30-
* wsr a15, PS
30+
* wsr a14, PS
3131
* rsync
3232
*
33-
* Note that a15 is used here because the register allocation
33+
* Note that a14 is used here because the register allocation
3434
* done by the compiler is not guaranteed and a window overflow
3535
* may not occur between the rsil and wsr instructions. By using
36-
* a15 in the rsil, the machine is guaranteed to be in a state
36+
* a14 in the rsil, the machine is guaranteed to be in a state
3737
* where no register reference will cause an overflow.
3838
*/
3939

@@ -185,15 +185,15 @@ static inline void arch_atomic_##op(int i, atomic_t * v) \
185185
unsigned int vval; \
186186
\
187187
__asm__ __volatile__( \
188-
" rsil a15, "__stringify(TOPLEVEL)"\n" \
188+
" rsil a14, "__stringify(TOPLEVEL)"\n" \
189189
" l32i %[result], %[mem]\n" \
190190
" " #op " %[result], %[result], %[i]\n" \
191191
" s32i %[result], %[mem]\n" \
192-
" wsr a15, ps\n" \
192+
" wsr a14, ps\n" \
193193
" rsync\n" \
194194
: [result] "=&a" (vval), [mem] "+m" (*v) \
195195
: [i] "a" (i) \
196-
: "a15", "memory" \
196+
: "a14", "memory" \
197197
); \
198198
} \
199199

@@ -203,15 +203,15 @@ static inline int arch_atomic_##op##_return(int i, atomic_t * v) \
203203
unsigned int vval; \
204204
\
205205
__asm__ __volatile__( \
206-
" rsil a15,"__stringify(TOPLEVEL)"\n" \
206+
" rsil a14,"__stringify(TOPLEVEL)"\n" \
207207
" l32i %[result], %[mem]\n" \
208208
" " #op " %[result], %[result], %[i]\n" \
209209
" s32i %[result], %[mem]\n" \
210-
" wsr a15, ps\n" \
210+
" wsr a14, ps\n" \
211211
" rsync\n" \
212212
: [result] "=&a" (vval), [mem] "+m" (*v) \
213213
: [i] "a" (i) \
214-
: "a15", "memory" \
214+
: "a14", "memory" \
215215
); \
216216
\
217217
return vval; \
@@ -223,16 +223,16 @@ static inline int arch_atomic_fetch_##op(int i, atomic_t * v) \
223223
unsigned int tmp, vval; \
224224
\
225225
__asm__ __volatile__( \
226-
" rsil a15,"__stringify(TOPLEVEL)"\n" \
226+
" rsil a14,"__stringify(TOPLEVEL)"\n" \
227227
" l32i %[result], %[mem]\n" \
228228
" " #op " %[tmp], %[result], %[i]\n" \
229229
" s32i %[tmp], %[mem]\n" \
230-
" wsr a15, ps\n" \
230+
" wsr a14, ps\n" \
231231
" rsync\n" \
232232
: [result] "=&a" (vval), [tmp] "=&a" (tmp), \
233233
[mem] "+m" (*v) \
234234
: [i] "a" (i) \
235-
: "a15", "memory" \
235+
: "a14", "memory" \
236236
); \
237237
\
238238
return vval; \

arch/xtensa/include/asm/cmpxchg.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,16 @@ __cmpxchg_u32(volatile int *p, int old, int new)
5252
return new;
5353
#else
5454
__asm__ __volatile__(
55-
" rsil a15, "__stringify(TOPLEVEL)"\n"
55+
" rsil a14, "__stringify(TOPLEVEL)"\n"
5656
" l32i %[old], %[mem]\n"
5757
" bne %[old], %[cmp], 1f\n"
5858
" s32i %[new], %[mem]\n"
5959
"1:\n"
60-
" wsr a15, ps\n"
60+
" wsr a14, ps\n"
6161
" rsync\n"
6262
: [old] "=&a" (old), [mem] "+m" (*p)
6363
: [cmp] "a" (old), [new] "r" (new)
64-
: "a15", "memory");
64+
: "a14", "memory");
6565
return old;
6666
#endif
6767
}
@@ -116,10 +116,10 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
116116
/*
117117
* xchg_u32
118118
*
119-
* Note that a15 is used here because the register allocation
119+
* Note that a14 is used here because the register allocation
120120
* done by the compiler is not guaranteed and a window overflow
121121
* may not occur between the rsil and wsr instructions. By using
122-
* a15 in the rsil, the machine is guaranteed to be in a state
122+
* a14 in the rsil, the machine is guaranteed to be in a state
123123
* where no register reference will cause an overflow.
124124
*/
125125

@@ -157,14 +157,14 @@ static inline unsigned long xchg_u32(volatile int * m, unsigned long val)
157157
#else
158158
unsigned long tmp;
159159
__asm__ __volatile__(
160-
" rsil a15, "__stringify(TOPLEVEL)"\n"
160+
" rsil a14, "__stringify(TOPLEVEL)"\n"
161161
" l32i %[tmp], %[mem]\n"
162162
" s32i %[val], %[mem]\n"
163-
" wsr a15, ps\n"
163+
" wsr a14, ps\n"
164164
" rsync\n"
165165
: [tmp] "=&a" (tmp), [mem] "+m" (*m)
166166
: [val] "a" (val)
167-
: "a15", "memory");
167+
: "a14", "memory");
168168
return tmp;
169169
#endif
170170
}

0 commit comments

Comments
 (0)