*** empty log message ***
authorstefan <none@none>
Mon, 29 Mar 2004 07:12:38 +0000 (07:12 +0000)
committerstefan <none@none>
Mon, 29 Mar 2004 07:12:38 +0000 (07:12 +0000)
jit/i386/machine-instr.h [new file with mode: 0644]
src/vm/jit/i386/machine-instr.h [new file with mode: 0644]

diff --git a/jit/i386/machine-instr.h b/jit/i386/machine-instr.h
new file mode 100644 (file)
index 0000000..0b59ee5
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef _MACHINE_INSTR_H
+#define _MACHINE_INSTR_H
+
+static inline long
+__attribute__ ((unused))
+atomic_swap (volatile long *mem, long val)
+{
+  __asm__ __volatile__ ("xchgl %2,%0"
+            : "=r" (val) : "0" (val), "m" (*mem));
+  return val;
+}
+
+static inline long int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+  long int ret;
+
+  __asm__ __volatile__ ("lock; cmpxchgl %2, %1"
+                        : "=a" (ret), "=m" (*p)
+                        : "r" (newval), "m" (*p), "0" (oldval));
+  return ret;
+}
+
+#endif
diff --git a/src/vm/jit/i386/machine-instr.h b/src/vm/jit/i386/machine-instr.h
new file mode 100644 (file)
index 0000000..0b59ee5
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef _MACHINE_INSTR_H
+#define _MACHINE_INSTR_H
+
+static inline long
+__attribute__ ((unused))
+atomic_swap (volatile long *mem, long val)
+{
+  __asm__ __volatile__ ("xchgl %2,%0"
+            : "=r" (val) : "0" (val), "m" (*mem));
+  return val;
+}
+
+static inline long int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+  long int ret;
+
+  __asm__ __volatile__ ("lock; cmpxchgl %2, %1"
+                        : "=a" (ret), "=m" (*p)
+                        : "r" (newval), "m" (*p), "0" (oldval));
+  return ret;
+}
+
+#endif