0.8.12.42
[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 #ifndef SBCL_GENESIS_CONFIG
8 #error genesis/config.h (or sbcl.h) must be incuded before this file
9 #endif
10
11 #define ARCH_HAS_STACK_POINTER
12
13 /* FIXME: Do we also want
14  *   #define ARCH_HAS_FLOAT_REGISTERS
15  * here? (The answer wasn't obvious to me when merging the
16  * architecture-abstracting patches for CSR's SPARC port. -- WHN
17  * 2002-02-15) */
18
19 #ifdef LISP_FEATURE_SB_THREAD
20
21 extern never_returns lose(char *fmt, ...);
22
23 static inline void 
24 get_spinlock(volatile lispobj *word,int value)
25 {
26     u32 eax=0;
27     if(*word==value) 
28         lose("recursive get_spinlock: 0x%x,%d\n",word,value);
29     do {
30         asm ("xor %0,%0\n\
31               lock cmpxchg %1,%2" 
32              : "=a" (eax)
33              : "r" (value), "m" (*word)
34              : "memory", "cc");
35     } while(eax!=0);
36 }
37
38 static inline void
39 release_spinlock(volatile lispobj *word)
40 {
41     *word=0;
42 }
43
44 #else
45
46 static inline void 
47 get_spinlock(lispobj *word, int value)
48 {
49     *word = value;
50 }
51
52 static inline void
53 release_spinlock(lispobj *word) {
54     *word = 0;
55 }
56
57 #endif /* LISP_FEATURE_SB_THREAD */
58 #endif /* _X86_ARCH_H */