Lines 49-54
typedef uintmax_t uatomic_max_t;
Link Here
|
49 |
# define MIPS_SYNC sync |
49 |
# define MIPS_SYNC sync |
50 |
#endif |
50 |
#endif |
51 |
|
51 |
|
|
|
52 |
/* Certain revisions of the R10000 Processor need an LL/SC Workaround |
53 |
enabled. Revisions before 3.0 misbehave on atomic operations, and |
54 |
Revs 2.6 and lower deadlock after several seconds due to other errata. |
55 |
|
56 |
To quote the R10K Errata: |
57 |
Workaround: The basic idea is to inhibit the four instructions |
58 |
from simultaneously becoming active in R10000. Padding all |
59 |
ll/sc sequences with nops or changing the looping branch in the |
60 |
routines to a branch likely (which is always predicted taken |
61 |
by R10000) will work. The nops should go after the loop, and the |
62 |
number of them should be 28. This number could be decremented for |
63 |
each additional instruction in the ll/sc loop such as the lock |
64 |
modifier(s) between the ll and sc, the looping branch and its |
65 |
delay slot. For typical short routines with one ll/sc loop, any |
66 |
instructions after the loop could also count as a decrement. The |
67 |
nop workaround pollutes the cache more but would be a few cycles |
68 |
faster if all the code is in the cache and the looping branch |
69 |
is predicted not taken. */ |
70 |
|
71 |
|
72 |
#ifdef _MIPS_ARCH_R10000 |
73 |
#define R10K_BEQZ_INSN "beqzl" |
74 |
#else |
75 |
#define R10K_BEQZ_INSN "beqz" |
76 |
#endif |
77 |
|
52 |
#define MIPS_SYNC_STR_2(X) #X |
78 |
#define MIPS_SYNC_STR_2(X) #X |
53 |
#define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X) |
79 |
#define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X) |
54 |
#define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC) |
80 |
#define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC) |
Lines 74-80
typedef uintmax_t uatomic_max_t;
Link Here
|
74 |
"bne %0,%3,2f\n\t" \ |
100 |
"bne %0,%3,2f\n\t" \ |
75 |
"move %1,%4\n\t" \ |
101 |
"move %1,%4\n\t" \ |
76 |
"sc %1,%2\n\t" \ |
102 |
"sc %1,%2\n\t" \ |
77 |
"beqz %1,1b\n" \ |
103 |
R10K_BEQZ_INSN" %1,1b\n" \ |
78 |
acq "\n\t" \ |
104 |
acq "\n\t" \ |
79 |
".set pop\n" \ |
105 |
".set pop\n" \ |
80 |
"2:\n\t" \ |
106 |
"2:\n\t" \ |
Lines 98-104
typedef uintmax_t uatomic_max_t;
Link Here
|
98 |
"bne %0,%3,2f\n\t" \ |
124 |
"bne %0,%3,2f\n\t" \ |
99 |
"move %1,%4\n\t" \ |
125 |
"move %1,%4\n\t" \ |
100 |
"scd %1,%2\n\t" \ |
126 |
"scd %1,%2\n\t" \ |
101 |
"beqz %1,1b\n" \ |
127 |
R10K_BEQZ_INSN" %1,1b\n" \ |
102 |
acq "\n\t" \ |
128 |
acq "\n\t" \ |
103 |
".set pop\n" \ |
129 |
".set pop\n" \ |
104 |
"2:\n\t" \ |
130 |
"2:\n\t" \ |
Lines 192-198
typedef uintmax_t uatomic_max_t;
Link Here
|
192 |
"ll %0,%4\n\t" \ |
218 |
"ll %0,%4\n\t" \ |
193 |
"move %1,%3\n\t" \ |
219 |
"move %1,%3\n\t" \ |
194 |
"sc %1,%2\n\t" \ |
220 |
"sc %1,%2\n\t" \ |
195 |
"beqz %1,1b\n" \ |
221 |
R10K_BEQZ_INSN" %1,1b\n" \ |
196 |
acq "\n\t" \ |
222 |
acq "\n\t" \ |
197 |
".set pop\n" \ |
223 |
".set pop\n" \ |
198 |
"2:\n\t" \ |
224 |
"2:\n\t" \ |
Lines 216-222
typedef uintmax_t uatomic_max_t;
Link Here
|
216 |
"lld %0,%4\n\t" \ |
242 |
"lld %0,%4\n\t" \ |
217 |
"move %1,%3\n\t" \ |
243 |
"move %1,%3\n\t" \ |
218 |
"scd %1,%2\n\t" \ |
244 |
"scd %1,%2\n\t" \ |
219 |
"beqz %1,1b\n" \ |
245 |
R10K_BEQZ_INSN" %1,1b\n" \ |
220 |
acq "\n\t" \ |
246 |
acq "\n\t" \ |
221 |
".set pop\n" \ |
247 |
".set pop\n" \ |
222 |
"2:\n\t" \ |
248 |
"2:\n\t" \ |
Lines 251-257
typedef uintmax_t uatomic_max_t;
Link Here
|
251 |
"ll %0,%4\n\t" \ |
277 |
"ll %0,%4\n\t" \ |
252 |
"addu %1,%0,%3\n\t" \ |
278 |
"addu %1,%0,%3\n\t" \ |
253 |
"sc %1,%2\n\t" \ |
279 |
"sc %1,%2\n\t" \ |
254 |
"beqz %1,1b\n" \ |
280 |
R10K_BEQZ_INSN" %1,1b\n" \ |
255 |
acq "\n\t" \ |
281 |
acq "\n\t" \ |
256 |
".set pop\n" \ |
282 |
".set pop\n" \ |
257 |
"2:\n\t" \ |
283 |
"2:\n\t" \ |
Lines 275-281
typedef uintmax_t uatomic_max_t;
Link Here
|
275 |
"lld %0,%4\n\t" \ |
301 |
"lld %0,%4\n\t" \ |
276 |
"daddu %1,%0,%3\n\t" \ |
302 |
"daddu %1,%0,%3\n\t" \ |
277 |
"scd %1,%2\n\t" \ |
303 |
"scd %1,%2\n\t" \ |
278 |
"beqz %1,1b\n" \ |
304 |
R10K_BEQZ_INSN" %1,1b\n" \ |
279 |
acq "\n\t" \ |
305 |
acq "\n\t" \ |
280 |
".set pop\n" \ |
306 |
".set pop\n" \ |
281 |
"2:\n\t" \ |
307 |
"2:\n\t" \ |
282 |
- |
|
|