0.8.9.37:
[sbcl.git] / src / runtime / x86-arch.h
1 /* FIXME: Aren't preprocessor symbols with underscore prefixes
2  * reserved for the system libraries? If so, it would be tidy to
3  * rename flags like _X86_ARCH_H so their names are in a part of the
4  * namespace that we control. */
5 #ifndef _X86_ARCH_H
6 #define _X86_ARCH_H
7
8 #define ARCH_HAS_STACK_POINTER
9
10 /* FIXME: Do we also want
11  *   #define ARCH_HAS_FLOAT_REGISTERS
12  * here? (The answer wasn't obvious to me when merging the
13  * architecture-abstracting patches for CSR's SPARC port. -- WHN
14  * 2002-02-15) */
15
16 #ifdef LISP_FEATURE_SB_THREAD
17 static inline void 
18 get_spinlock(lispobj *word,int value)
19 {
20     u32 eax=0;
21     do {
22         asm ("xor %0,%0\n\
23               lock cmpxchg %1,%2" 
24              : "=a" (eax)
25              : "r" (value), "m" (*word)
26              : "memory", "cc");
27     } while(eax!=0);
28 }
29
30 static inline void
31 release_spinlock(lispobj *word)
32 {
33     *word=0;
34 }
35
36 #else
37
38 static inline void 
39 get_spinlock(lispobj *word, int value)
40 {
41     *word = value;
42 }
43
44 static inline void
45 release_spinlock(lispobj *word) {
46     *word = 0;
47 }
48
49 #endif /* LISP_FEATURE_SB_THREAD */
50 #endif /* _X86_ARCH_H */