1.0.45.22: non-racy RUN-PROGRAM :PTY on OpenBSD
[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 #ifdef LISP_FEATURE_SB_THREAD
45     __asm__ __volatile__ (
46         "       .set push\n"
47         "       .set mips2\n"
48         "       .set noreorder\n"
49         "       sw      $0,%[__mem]\n"
50         "       sync\n"
51         "       .set pop"
52         :
53         : [__mem] "R" (*word)
54         : "memory");
55 #else /* LISP_FEATURE_SB_THREAD */
56     *word=0;
57 #endif
58 }
59
60 unsigned int arch_get_fp_control(void);
61 void arch_set_fp_control(unsigned int fp);
62
63 #endif /* _MIPS_ARCH_H */