xref: /dragonfly/test/sysperf/mtx.s (revision 86d7f5d3)
1		/*
2		 * $DragonFly: src/test/sysperf/mtx.s,v 1.2 2006/04/22 22:32:52 dillon Exp $
3		 */
4		.text
5		.globl	get_mtx
6		.globl	rel_mtx
7		.globl	try_spin_mtx
8		.globl	rel_spin_mtx
9
10get_mtx:
11		movl	mtx,%edx
12		movl	4(%esp),%ecx
131:		subl	%eax,%eax
14		lock cmpxchgl %ecx,(%edx)
15		jnz	1b
16		ret
17
18rel_mtx:
19		movl	mtx,%edx
20		movl $0,(%edx)
21		ret
22
23try_spin_mtx:
24		movl	mtx,%edx
25		movl	$1,%eax
26		xchgl	%eax,(%edx)
27		ret
28
29rel_spin_mtx:
30		movl	mtx,%edx
31		movl	$0,(%edx)
32		ret
33