05079c15c7a880b8250f97a43d4d1ade52311843
[IRC.git] / Robust / src / Runtime / STM / stmlock.c
1 #include "stmlock.h"
2 #include <stdio.h>
3
4
5 inline void initdsmlocks(volatile unsigned int *addr) {
6   (*addr) = SWAP_LOCK_BIAS;
7 }
8
9 /*
10 int write_trylock(volatile unsigned int *lock) {
11   int retval=0;
12   __asm__ __volatile__("xchgl %0,%1"
13                : "=r"(retval)
14                : "m"(*__xg(lock)), "0"(retval)
15                : "memory");
16   return retval;
17 }
18
19
20 void write_unlock(volatile unsigned int *lock) {
21   __asm __volatile__("movl $1, %0" : "+m" (*lock)::"memory");
22 }
23 */