File: alpha.gcc

package info (click to toggle)
htdig 1%3A3.2.0b6-16
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 15,624 kB
  • ctags: 9,630
  • sloc: ansic: 49,630; cpp: 46,470; sh: 17,400; xml: 4,180; perl: 2,543; makefile: 886; php: 79; asm: 14
file content (29 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * @(#)alpha.gcc	11.1 (Sleepycat) 8/30/99
 *
 * For gcc/alpha, 0 is clear, 1 is set.
 */
#ifdef __GNUC__
#define	MUTEX_SET(tsl) ({						\
	register tsl_t *__l = (tsl);					\
	int __r;							\
	asm volatile(							\
		"1:	ldl_l	%0,%1\n"				\
		"	blbs	%0,2f\n"				\
		"	mov	1,%0\n"					\
		"	stl_c	%0,%1\n"				\
		"	bne	%0,1b\n"				\
		"	mb\n"						\
		"2:"							\
		: "=&r"(__r), "=m"(*__l) : "m"(*__l) : "memory");	\
	__r;								\
})
#endif

#ifdef __DECC
#include <alpha/builtins.h>
#define MUTEX_SET(tsl) (__LOCK_LONG_RETRY((tsl), 1) != 0)
#endif

#define	MUTEX_UNSET(tsl)	(*(tsl) = 0)
#define	MUTEX_INIT(tsl)		MUTEX_UNSET(tsl)