Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita7ea9f4

Browse files
committed
Still further tweaking of s_lock assembler: do not assume that leading
whitespace is unimportant in assembly code. Also, move VAX definitionof typedef slock_t to port header files to be like all the other ports.Note that netbsd.h and openbsd.h are now identical, and I rather thinkthat freebsd.h is broken in the places where it doesn't agree --- butI'll leave it to the freebsders to look at that.
1 parent58f4028 commita7ea9f4

File tree

3 files changed

+70
-67
lines changed

3 files changed

+70
-67
lines changed

‎src/include/port/freebsd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ typedef long int slock_t;
1414
#endif
1515

1616
#if defined(__vax__)
17+
typedefunsignedcharslock_t;
1718
#defineNEED_VAX_TAS_ASM
1819
#defineHAS_TEST_AND_SET
1920
#endif

‎src/include/port/openbsd.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
11
#if defined(__i386__)
22
#defineNEED_I386_TAS_ASM
33
#defineHAS_TEST_AND_SET
4+
typedefunsignedcharslock_t;
45
#endif
56

67
#if defined(__sparc__)
78
#defineNEED_SPARC_TAS_ASM
89
#defineHAS_TEST_AND_SET
10+
typedefunsignedcharslock_t;
911
#endif
1012

1113
#if defined(__vax__)
1214
#defineNEED_VAX_TAS_ASM
1315
#defineHAS_TEST_AND_SET
16+
typedefunsignedcharslock_t;
1417
#endif
1518

1619
#if defined(__ns32k__)
1720
#defineNEED_NS32K_TAS_ASM
1821
#defineHAS_TEST_AND_SET
22+
typedefunsignedcharslock_t;
1923
#endif
2024

2125
#if defined(__m68k__)
2226
#defineHAS_TEST_AND_SET
27+
typedefunsignedcharslock_t;
2328
#endif
2429

2530
#if defined(__arm__)
2631
#defineHAS_TEST_AND_SET
32+
typedefunsignedcharslock_t;
2733
#endif
2834

2935
#if defined(__mips__)
3036
/* #undef HAS_TEST_AND_SET */
3137
#endif
3238

33-
#if defined(__powerpc__)
39+
#if defined(__alpha__)
3440
#defineHAS_TEST_AND_SET
41+
typedefunsigned longslock_t;
3542
#endif
3643

3744
#if defined(__powerpc__)
45+
#defineHAS_TEST_AND_SET
3846
typedefunsignedintslock_t;
39-
40-
#else
41-
typedefunsignedcharslock_t;
42-
4347
#endif

‎src/include/storage/s_lock.h

Lines changed: 60 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.84 2001/01/19 21:09:57 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.85 2001/01/20 00:03:54 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -100,15 +100,15 @@ extern void s_lock_sleep(unsigned spins, int microsec,
100100
*/
101101

102102
/*
103-
* Standard_asm format:
103+
* Standardgcc asm format:
104104
*
105-
*__asm__ __volatile__(
106-
"command\n"
107-
"command\n"
108-
"command\n"
109-
:"=r"(_res)return value, in register
110-
:"r"(lock)argument, 'lock pointer', in register
111-
:"r0");inline code uses this register
105+
__asm__ __volatile__(
106+
"command\n"
107+
"command\n"
108+
"command\n"
109+
:"=r"(_res)return value, in register
110+
:"r"(lock)argument, 'lock pointer', in register
111+
:"r0");inline code uses this register
112112
*/
113113

114114

@@ -121,10 +121,10 @@ tas(volatile slock_t *lock)
121121
registerslock_t_res=1;
122122

123123
__asm__ __volatile__(
124-
"lock\n"
125-
"xchgb%0,%1\n"
126-
:"=q"(_res),"=m"(*lock)
127-
:"0"(_res));
124+
"lock\n"
125+
"xchgb%0,%1\n"
126+
:"=q"(_res),"=m"(*lock)
127+
:"0"(_res));
128128
return (int)_res;
129129
}
130130

@@ -140,10 +140,10 @@ tas(volatile slock_t *lock)
140140
longintret;
141141

142142
__asm__ __volatile__(
143-
"xchg4 %0=%1,%2\n"
144-
:"=r"(ret),"=m"(*lock)
145-
:"r"(1),"1"(*lock)
146-
:"memory");
143+
"xchg4 %0=%1,%2\n"
144+
:"=r"(ret),"=m"(*lock)
145+
:"r"(1),"1"(*lock)
146+
:"memory");
147147

148148
return (int)ret;
149149
}
@@ -160,9 +160,9 @@ tas(volatile slock_t *lock)
160160
registerslock_t_res=1;
161161

162162
__asm__ __volatile__(
163-
"swpb %0, %0, [%3]\n"
164-
:"=r"(_res),"=m"(*lock)
165-
:"0"(_res),"r"(lock));
163+
"swpb %0, %0, [%3]\n"
164+
:"=r"(_res),"=m"(*lock)
165+
:"0"(_res),"r"(lock));
166166
return (int)_res;
167167
}
168168

@@ -180,14 +180,14 @@ tas(volatile slock_t *lock)
180180
int_res;
181181

182182
__asm____volatile__(
183-
"la1,1\n"
184-
"l2,%2\n"
185-
"slr0,0\n"
186-
"cs 0,1,0(2)\n"
187-
"lr %1,0\n"
188-
:"=m"(lock),"=d"(_res)
189-
:"m"(lock)
190-
:"0","1","2");
183+
"la1,1\n"
184+
"l 2,%2\n"
185+
"slr 0,0\n"
186+
"cs 0,1,0(2)\n"
187+
"lr %1,0\n"
188+
:"=m"(lock),"=d"(_res)
189+
:"m"(lock)
190+
:"0","1","2");
191191

192192
return (_res);
193193
}
@@ -204,9 +204,9 @@ tas(volatile slock_t *lock)
204204
registerslock_t_res=1;
205205

206206
__asm__ __volatile__(
207-
"ldstub[%2], %0\n"
208-
:"=r"(_res),"=m"(*lock)
209-
:"r"(lock));
207+
"ldstub[%2], %0\n"
208+
:"=r"(_res),"=m"(*lock)
209+
:"r"(lock));
210210
return (int)_res;
211211
}
212212

@@ -222,11 +222,11 @@ tas(volatile slock_t *lock)
222222
registerintrv;
223223

224224
__asm____volatile__(
225-
"tas%1\n"
226-
"sne%0\n"
227-
:"=d"(rv),"=m"(*lock)
228-
:"1"(*lock)
229-
:"cc");
225+
"tas%1\n"
226+
"sne%0\n"
227+
:"=d"(rv),"=m"(*lock)
228+
:"1"(*lock)
229+
:"cc");
230230

231231
returnrv;
232232
}
@@ -241,21 +241,19 @@ tas(volatile slock_t *lock)
241241
*/
242242
#defineTAS(lock) tas(lock)
243243

244-
typedefunsignedcharslock_t;
245-
246244
static __inline__int
247245
tas(volatileslock_t*lock)
248246
{
249247
register_res;
250248

251249
__asm__ __volatile__(
252-
"movl $1, r0\n"
253-
"bbssi$0, (%1), 1f\n"
254-
"clrlr0\n"
255-
"1:movlr0, %0\n"
256-
:"=r"(_res)
257-
:"r"(lock)
258-
:"r0");
250+
"movl $1, r0\n"
251+
"bbssi$0, (%1), 1f\n"
252+
"clrlr0\n"
253+
"1:movlr0, %0\n"
254+
:"=r"(_res)
255+
:"r"(lock)
256+
:"r0");
259257
return (int)_res;
260258
}
261259

@@ -271,9 +269,9 @@ tas(volatile slock_t *lock)
271269
register_res;
272270

273271
__asm__ __volatile__(
274-
"sbitb0, %0\n"
275-
"sfsd%1\n"
276-
:"=m"(*lock),"=r"(_res));
272+
"sbitb0, %0\n"
273+
"sfsd%1\n"
274+
:"=m"(*lock),"=r"(_res));
277275
return (int)_res;
278276
}
279277

@@ -329,7 +327,7 @@ tas(volatile slock_t *s_lock)
329327
#defineS_UNLOCK(lock)\
330328
do \
331329
{\
332-
__asm__ __volatile__ ("mb"); \
330+
__asm__ __volatile__ ("mb \n"); \
333331
*(lock) = 0; \
334332
} while (0)
335333

@@ -339,20 +337,20 @@ tas(volatile slock_t *lock)
339337
registerslock_t_res;
340338

341339
__asm____volatile__(
342-
"ldq$0, %0\n"
343-
"bne$0, 2f\n"
344-
"ldq_l%1, %0\n"
345-
"bne%1, 2f\n"
346-
"mov1, $0\n"
347-
"stq_c$0, %0\n"
348-
"beq$0, 2f\n"
349-
"mb\n"
350-
"br3f\n"
351-
"2:mov1, %1\n"
352-
"3:\n"
353-
:"=m"(*lock),"=r"(_res)
340+
"ldq$0, %0\n"
341+
"bne$0, 2f\n"
342+
"ldq_l%1, %0\n"
343+
"bne%1, 2f\n"
344+
"mov1, $0\n"
345+
"stq_c$0, %0\n"
346+
"beq$0, 2f\n"
347+
"mb\n"
348+
"br3f\n"
349+
"2:mov1, %1\n"
350+
"3:\n"
351+
:"=m"(*lock),"=r"(_res)
354352
:
355-
:"0");
353+
:"0");
356354

357355
return (int)_res;
358356
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp