1.0.5.35: stack alignment on x86/Darwin, once more
[sbcl.git] / src / runtime / x86-arch.h
blob82daa1939974b6591964f739a8c741cb6859b2f4
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
8 #ifndef SBCL_GENESIS_CONFIG
9 #error genesis/config.h (or sbcl.h) must be included before this file
10 #endif
12 #define ARCH_HAS_STACK_POINTER
14 /* FIXME: Do we also want
15 * #define ARCH_HAS_FLOAT_REGISTERS
16 * here? (The answer wasn't obvious to me when merging the
17 * architecture-abstracting patches for CSR's SPARC port. -- WHN 2002-02-15) */
19 #include "interr.h"
21 static inline void
22 get_spinlock(volatile lispobj *word,long value)
24 #ifdef LISP_FEATURE_SB_THREAD
25 u32 eax=0;
26 if(*word==value)
27 lose("recursive get_spinlock: 0x%x,%ld\n",word,value);
28 do {
29 #if defined(LISP_FEATURE_DARWIN)
30 asm ("xor %0,%0;\n\
31 lock/cmpxchg %1,%2"
32 : "=a" (eax)
33 : "r" (value), "m" (*word)
34 : "memory", "cc");
35 #else
36 asm ("xor %0,%0\n\
37 lock cmpxchg %1,%2"
38 : "=a" (eax)
39 : "r" (value), "m" (*word)
40 : "memory", "cc");
41 #endif
43 } while(eax!=0);
44 #else
45 *word=value;
46 #endif
49 static inline void
50 release_spinlock(volatile lispobj *word)
52 *word=0;
55 #include <stdio.h>
57 static inline lispobj
58 swap_lispobjs(volatile lispobj *dest, lispobj value)
60 lispobj old_value;
61 #if defined(LISP_FEATURE_DARWIN)
62 asm ("lock/xchg %0,(%1)"
63 : "=r" (old_value)
64 : "r" (dest), "0" (value)
65 : "memory");
66 #else
67 asm ("lock xchg %0,(%1)"
68 : "=r" (old_value)
69 : "r" (dest), "0" (value)
70 : "memory");
71 #endif
72 return old_value;
75 extern void fast_bzero_detect(void *, size_t);
76 extern void (*fast_bzero_pointer)(void *, size_t);
78 #endif /* _X86_ARCH_H */