Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

1.0.4.54: x86-64/darwin preliminary threads support

 * add sb-lutex to features via make-config.sh
 * preserve_pointer context registers in gencgc.c
 * use lock/cmpxchg on darwin
 * GSYM/GNAME asm hacks
 * add -arch options when appropriate for building threads-foreign.so
  • Loading branch information...
commit 1cf1afff10cfc48a2f4a26fd4533531081602219 1 parent fb2d707
authored April 10, 2007
3  make-config.sh
@@ -221,6 +221,9 @@ case "$sbcl_os" in
221 221
         if [ $sbcl_arch = "x86" ]; then
222 222
             printf ' :sb-lutex :restore-fs-segment-register-from-tls' >> $ltf
223 223
         fi
  224
+        if [ $sbcl_arch = "x86-64" ]; then
  225
+            printf ' :sb-lutex' >> $ltf
  226
+        fi
224 227
         link_or_copy $sbcl_arch-darwin-os.h target-arch-os.h
225 228
         link_or_copy bsd-os.h target-os.h
226 229
         link_or_copy Config.$sbcl_arch-darwin Config
16  src/runtime/gencgc.c
@@ -3822,6 +3822,22 @@ preserve_context_registers (os_context_t *c)
3822 3822
     preserve_pointer((void*)*os_context_register_addr(c,reg_ESI));
3823 3823
     preserve_pointer((void*)*os_context_register_addr(c,reg_EDI));
3824 3824
     preserve_pointer((void*)*os_context_pc_addr(c));
  3825
+#elif defined LISP_FEATURE_X86_64
  3826
+    preserve_pointer((void*)*os_context_register_addr(c,reg_RAX));
  3827
+    preserve_pointer((void*)*os_context_register_addr(c,reg_RCX));
  3828
+    preserve_pointer((void*)*os_context_register_addr(c,reg_RDX));
  3829
+    preserve_pointer((void*)*os_context_register_addr(c,reg_RBX));
  3830
+    preserve_pointer((void*)*os_context_register_addr(c,reg_RSI));
  3831
+    preserve_pointer((void*)*os_context_register_addr(c,reg_RDI));
  3832
+    preserve_pointer((void*)*os_context_register_addr(c,reg_R8));
  3833
+    preserve_pointer((void*)*os_context_register_addr(c,reg_R9));
  3834
+    preserve_pointer((void*)*os_context_register_addr(c,reg_R10));
  3835
+    preserve_pointer((void*)*os_context_register_addr(c,reg_R11));
  3836
+    preserve_pointer((void*)*os_context_register_addr(c,reg_R12));
  3837
+    preserve_pointer((void*)*os_context_register_addr(c,reg_R13));
  3838
+    preserve_pointer((void*)*os_context_register_addr(c,reg_R14));
  3839
+    preserve_pointer((void*)*os_context_register_addr(c,reg_R15));
  3840
+    preserve_pointer((void*)*os_context_pc_addr(c));
3825 3841
 #else
3826 3842
     #error "preserve_context_registers needs to be tweaked for non-x86 Darwin"
3827 3843
 #endif
8  src/runtime/x86-64-arch.h
@@ -26,11 +26,19 @@ get_spinlock(volatile lispobj *word,long value)
26 26
     if(*word==value)
27 27
         lose("recursive get_spinlock: 0x%x,%ld\n",word,value);
28 28
     do {
  29
+#if defined(LISP_FEATURE_DARWIN)
  30
+        asm ("xor %0,%0\n\
  31
+              lock/cmpxchg %1,%2"
  32
+             : "=a" (rax)
  33
+             : "r" (value), "m" (*word)
  34
+             : "memory", "cc");
  35
+#else
29 36
         asm ("xor %0,%0\n\
30 37
               lock cmpxchg %1,%2"
31 38
              : "=a" (rax)
32 39
              : "r" (value), "m" (*word)
33 40
              : "memory", "cc");
  41
+#endif
34 42
     } while(rax!=0);
35 43
 #else
36 44
     *word=value;
6  src/runtime/x86-64-assem.S
@@ -182,8 +182,12 @@ Lstack:
182 182
 	push	%rsi	#
183 183
 	push	%rdx	#
184 184
 #ifdef LISP_FEATURE_SB_THREAD
  185
+#ifdef LISP_FEATURE_DARWIN
  186
+	mov	GSYM(GNAME(specials)),%rdi
  187
+#else
185 188
 	mov	specials,%rdi
186  
-	call    pthread_getspecific
  189
+#endif
  190
+	call    GNAME(pthread_getspecific)
187 191
 	mov	%rax,%r12
188 192
 #endif
189 193
 	pop	%rcx	# num args
3  tests/threads.impure.lisp
@@ -99,7 +99,8 @@
99 99
  #-sunos "cc" #+sunos "gcc"
100 100
  (or #+(or linux freebsd sunos) '(#+x86-64 "-fPIC"
101 101
                                   "-shared" "-o" "threads-foreign.so" "threads-foreign.c")
102  
-     #+darwin '("-dynamiclib" "-o" "threads-foreign.so" "threads-foreign.c")
  102
+     #+darwin '(#+x86-64 "-arch" #+x86-64 "x86_64"
  103
+                "-dynamiclib" "-o" "threads-foreign.so" "threads-foreign.c")
103 104
      (error "Missing shared library compilation options for this platform"))
104 105
  :search t)
105 106
 (sb-alien:load-shared-object "threads-foreign.so")
2  version.lisp-expr
@@ -17,4 +17,4 @@
17 17
 ;;; checkins which aren't released. (And occasionally for internal
18 18
 ;;; versions, especially for internal versions off the main CVS
19 19
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
20  
-"1.0.4.53"
  20
+"1.0.4.54"

0 notes on commit 1cf1aff

Please sign in to comment.
Something went wrong with that request. Please try again.