Delete a ton of cruft from the globaldb initialization logic.
[sbcl.git] / src / runtime / x86-64-arch.h
blobb6dfe361c4aa834aa9584bc77d3ebffc8ebe840d
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_64_ARCH_H
6 #define _X86_64_ARCH_H
8 #ifndef SBCL_GENESIS_CONFIG
9 #error genesis/config.h (or sbcl.h) must be included before this file
10 #endif
12 #include "interr.h" /* for declaration of lose() */
14 #define ARCH_HAS_STACK_POINTER
15 #define ALIEN_STACK_GROWS_DOWNWARD
17 /* FIXME: Do we also want
18 * #define ARCH_HAS_FLOAT_REGISTERS
19 * here? (The answer wasn't obvious to me when merging the
20 * architecture-abstracting patches for CSR's SPARC port. -- WHN 2002-02-15) */
22 #define COMPILER_BARRIER \
23 do { __asm__ __volatile__ ( "" : : : "memory"); } while (0)
25 static inline void
26 get_spinlock(volatile lispobj *word, unsigned long value)
28 #ifdef LISP_FEATURE_SB_THREAD
29 u64 rax=0;
30 if(*word==value)
31 lose("recursive get_spinlock: 0x%x,%ld\n",word,value);
32 do {
33 #if defined(LISP_FEATURE_DARWIN)
34 asm volatile
35 ("xor %0,%0\n\
36 lock/cmpxchg %1,%2"
37 : "=a" (rax)
38 : "r" (value), "m" (*word)
39 : "memory", "cc");
40 #else
41 asm volatile
42 ("xor %0,%0\n\
43 lock cmpxchg %1,%2"
44 : "=a" (rax)
45 : "r" (value), "m" (*word)
46 : "memory", "cc");
47 #endif
48 } while(rax!=0);
49 #else
50 *word=value;
51 #endif
54 static inline void
55 release_spinlock(volatile lispobj *word)
57 /* See comment in RELEASE-SPINLOCK in target-thread.lisp. */
58 COMPILER_BARRIER;
59 *word=0;
60 COMPILER_BARRIER;
63 static inline lispobj
64 swap_lispobjs(volatile lispobj *dest, lispobj value)
66 lispobj old_value;
67 asm volatile
68 ("lock xchg %0,(%1)"
69 : "=r" (old_value)
70 : "r" (dest), "0" (value)
71 : "memory");
72 return old_value;
75 #endif /* _X86_64_ARCH_H */