Misc sysperf cleanups. Add another mutex tester to test the xchgl
[dragonfly.git] / test / sysperf / mtx.s
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
10 get_mtx:
11                 movl    mtx,%edx
12                 movl    4(%esp),%ecx
13 1:              subl    %eax,%eax
14                 lock cmpxchgl %ecx,(%edx)
15                 jnz     1b
16                 ret
17
18 rel_mtx:
19                 movl    mtx,%edx
20                 movl $0,(%edx)
21                 ret
22
23 try_spin_mtx:
24                 movl    mtx,%edx
25                 movl    $1,%eax
26                 xchgl   %eax,(%edx)
27                 ret
28
29 rel_spin_mtx:
30                 movl    mtx,%edx
31                 movl    $0,(%edx)
32                 ret