1.0.8.11: Fix typo in comment.
[sbcl.git] / src / runtime / mips-arch.h
1 #ifndef _MIPS_ARCH_H
2 #define _MIPS_ARCH_H
3
4
5 static inline void
6 get_spinlock(volatile lispobj *word, long value)
7 {
8 #ifdef LISP_FEATURE_SB_THREAD
9     unsigned long __old = (volatile lispobj)*word;
10     unsigned long __prev;
11     int __cmp;
12
13     __asm__ __volatile__ (
14         "       .set push\n"
15         "       .set mips2\n"
16         "       .set noreorder\n"
17         "1:     ll      %[__prev],%[__mem]\n"
18         "       bne     %[__prev],%[__old],2f\n"
19         "        li     %[__cmp],0\n"
20         "       move    %[__cmp],%[__new]\n"
21         "       sc      %[__cmp],%[__mem]\n"
22         "       beqz    %[__cmp],1b\n"
23         "        nop\n"
24         "       sync\n"
25         "2:\n"
26         "       .set pop"
27         : [__prev] "=&r" (__prev),
28           [__cmp] "=&r" (__cmp)
29         : [__mem] "R" (*word),
30           [__old] "r" (__old),
31           [__new] "r" (value)
32         : "memory");
33
34     if (!cmp)
35         lose("recursive get_spinlock: 0x%x,%d\n", word, value);
36 #else /* LISP_FEATURE_SB_THREAD */
37     *word=value;
38 #endif
39 }
40
41 static inline void
42 release_spinlock(volatile lispobj *word)
43 {
44     *word=0;
45 }
46
47 #endif /* _MIPS_ARCH_H */