summary refs log tree commit diff
path: root/db2/mutex/alpha.dec
blob: 83ed3711361387ba683491ddfc50faf4cd8dfc68 (plain) (blame)
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
/*
 * @(#)alpha.dec	8.3 (Sleepycat Software) 1/18/97
 *
 * The DEC C asm acts as a pseudo-call.  The first argument is the assembly
 * code, and the remaining arguments are assigned as in a procedure call, to
 * r16, r17, etc. (represented in asm as %a0, %a1, and so forth).
 *
 * From: Dave Butenhof.
 */

#include <c_asm.h>

#define	TSL_SET(tsl)	(asm ("mb;					\
    10:	ldl_l	%v0,(%a0) ;						\
	bne	%v0,30f ;						\
	or	%v0,1,%r1 ;						\
	stl_c	%r1,(%a0) ;						\
	beq	%r1,20f ;						\
	mb	;							\
	br	%r31,30f ;						\
    20:	br	%r31,10b ;						\
    30:	", (tsl)))

THIS WAS NOT CONVERTED TO TAKE A POINTER AS AN ARGUMENT...
#define	TSL_UNSET(tsl)	(asm ("mb"), *(tsl) = 0)