Authors: Andreas Krall
- $Id: asmpart.S 1119 2004-06-02 11:12:03Z twisti $
+ $Id: asmpart.S 1160 2004-06-11 16:28:13Z stefan $
*/
.globl asm_getclassvalues_atomic
.globl asm_criticalsections
+ .globl atomic_swap
+ .globl compare_and_swap
+
/*************************** imported functions *******************************/
.quad 0
+ .ent atomic_swap
+atomic_swap:
+1:
+ lld v0,0(a0)
+ move t0,a1
+ scd t0,0(a0)
+ beqz t0,1b
+ j ra
+ .end atomic_swap
+
+ .ent compare_and_swap
+compare_and_swap:
+ move v0,zero
+1:
+ lld t0,0(a0)
+ bne t0,a1,2f
+ move v0,a2
+ scd v0,0(a0)
+ beqz v0,1b
+2:
+ j ra
+ .end compare_and_swap
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
-/* If anyone wants to compile with gcc, use this file.
- * It is not usable with the MIPSPro compiler.
- */
-
#ifndef _MACHINE_INSTR_H
#define _MACHINE_INSTR_H
+#if 0
+
+/* If anyone wants to compile with gcc, use this section.
+ * It is not usable with the MIPSPro compiler.
+ */
+
static inline long
__attribute__ ((unused))
atomic_swap (volatile long *p, long val)
}
static inline int
__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+compare_and_swap (volatile long *p, long oldval, long newval)
{
- long int ret, temp;
+ long ret, temp;
__asm__ __volatile__
("1:\n\t"
return ret;
}
+#else
+
+long atomic_swap (long *, long val);
+int compare_and_swap (long *p, long oldval, long newval);
+
+#endif
#endif
Authors: Andreas Krall
- $Id: asmpart.S 1119 2004-06-02 11:12:03Z twisti $
+ $Id: asmpart.S 1160 2004-06-11 16:28:13Z stefan $
*/
.globl asm_getclassvalues_atomic
.globl asm_criticalsections
+ .globl atomic_swap
+ .globl compare_and_swap
+
/*************************** imported functions *******************************/
.quad 0
+ .ent atomic_swap
+atomic_swap:
+1:
+ lld v0,0(a0)
+ move t0,a1
+ scd t0,0(a0)
+ beqz t0,1b
+ j ra
+ .end atomic_swap
+
+ .ent compare_and_swap
+compare_and_swap:
+ move v0,zero
+1:
+ lld t0,0(a0)
+ bne t0,a1,2f
+ move v0,a2
+ scd v0,0(a0)
+ beqz v0,1b
+2:
+ j ra
+ .end compare_and_swap
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
-/* If anyone wants to compile with gcc, use this file.
- * It is not usable with the MIPSPro compiler.
- */
-
#ifndef _MACHINE_INSTR_H
#define _MACHINE_INSTR_H
+#if 0
+
+/* If anyone wants to compile with gcc, use this section.
+ * It is not usable with the MIPSPro compiler.
+ */
+
static inline long
__attribute__ ((unused))
atomic_swap (volatile long *p, long val)
}
static inline int
__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
+compare_and_swap (volatile long *p, long oldval, long newval)
{
- long int ret, temp;
+ long ret, temp;
__asm__ __volatile__
("1:\n\t"
return ret;
}
+#else
+
+long atomic_swap (long *, long val);
+int compare_and_swap (long *p, long oldval, long newval);
+
+#endif
#endif