diff -Nur -x '*.trace' -x '*.rej' -x '*.orig' -x sbcl.h -x ldso-stubs.S -x Config -x target -x CVS -x 'target-*.h' -x output -x genesis -x '*.o' -x '*.nm' -x '*.core' -x '*.map' -x '*.d' -x '*~' -x '*.lisp-obj' -x '*.fasl' -x '*.lisp-temp' -x systems -x '*.tmp' -x local-target-features.lisp-expr -x a.out -x '*.so' -x foo.c -x sbcl -x grovel-headers -x customize-target-features.lisp -x external-format-test.txt -x test-status.lisp-expr sbcl-1.0.18-reserve-ebx-5/src/compiler/x86/c-call.lisp sbcl-1.0.18-ebx-threads/src/compiler/x86/c-call.lisp
--- sbcl-1.0.18-reserve-ebx-5/src/compiler/x86/c-call.lisp	2008-04-26 11:29:10.000000000 -0400
+++ sbcl-1.0.18-ebx-threads/src/compiler/x86/c-call.lisp	2008-07-02 00:20:22.618643360 -0400
@@ -300,8 +300,12 @@
       (let ((delta (logandc2 (+ amount 3) 3)))
         (inst mov temp
               (make-ea-for-symbol-tls-index *alien-stack*))
-        (inst fs-segment-prefix)
-        (inst sub (make-ea :dword :base temp) delta)))
+        #!-x86-ebx-threads
+        (progn
+          (inst fs-segment-prefix)
+          (inst sub (make-ea :dword :base temp) delta))
+        #!+x86-ebx-threads
+        (inst sub (make-ea :dword :base ebx-tn :index temp) delta)))
     (load-tl-symbol-value result *alien-stack*))
   #!-sb-thread
   (:generator 0
@@ -321,8 +325,12 @@
       (let ((delta (logandc2 (+ amount 3) 3)))
         (inst mov temp
               (make-ea-for-symbol-tls-index *alien-stack*))
-        (inst fs-segment-prefix)
-        (inst add (make-ea :dword :base temp) delta))))
+        #!-x86-ebx-threads
+        (progn
+          (inst fs-segment-prefix)
+          (inst add (make-ea :dword :base temp) delta))
+        #!+x86-ebx-threads
+        (inst add (make-ea :dword :base ebx-tn :index temp) delta))))
   #!-sb-thread
   (:generator 0
     (unless (zerop amount)
diff -Nur -x '*.trace' -x '*.rej' -x '*.orig' -x sbcl.h -x ldso-stubs.S -x Config -x target -x CVS -x 'target-*.h' -x output -x genesis -x '*.o' -x '*.nm' -x '*.core' -x '*.map' -x '*.d' -x '*~' -x '*.lisp-obj' -x '*.fasl' -x '*.lisp-temp' -x systems -x '*.tmp' -x local-target-features.lisp-expr -x a.out -x '*.so' -x foo.c -x sbcl -x grovel-headers -x customize-target-features.lisp -x external-format-test.txt -x test-status.lisp-expr sbcl-1.0.18-reserve-ebx-5/src/compiler/x86/cell.lisp sbcl-1.0.18-ebx-threads/src/compiler/x86/cell.lisp
--- sbcl-1.0.18-reserve-ebx-5/src/compiler/x86/cell.lisp	2008-06-29 20:23:14.000000000 -0400
+++ sbcl-1.0.18-ebx-threads/src/compiler/x86/cell.lisp	2008-07-02 13:44:21.001033400 -0400
@@ -93,7 +93,7 @@
 
 
 ;;; The compiler likes to be able to directly SET symbols.
-#!+sb-thread
+#!+(and sb-thread (not x86-ebx-threads))
 (define-vop (set)
   (:args (symbol :scs (descriptor-reg))
          (value :scs (descriptor-reg any-reg)))
@@ -113,6 +113,22 @@
       (storew value symbol symbol-value-slot other-pointer-lowtag)
       (emit-label done))))
 
+#!+x86-ebx-threads
+(define-vop (set)
+  (:args (symbol :scs (descriptor-reg))
+         (value :scs (descriptor-reg any-reg)))
+  (:temporary (:sc descriptor-reg) tls)
+  (:generator 4
+    (loadw tls symbol symbol-tls-index-slot other-pointer-lowtag)
+    (inst cmp (make-ea :dword :base ebx-tn :index tls)
+          no-tls-value-marker-widetag)
+    (inst jmp :z global-val)
+    (inst mov (make-ea :dword :base ebx-tn :index tls) value)
+    (inst jmp done)
+    GLOBAL-VAL
+    (storew value symbol symbol-value-slot other-pointer-lowtag)
+    DONE))
+
 ;; unithreaded it's a lot simpler ...
 #!-sb-thread
 (define-vop (set cell-set)
@@ -133,8 +149,10 @@
            (err-lab (generate-error-code vop 'unbound-symbol-error object))
            (ret-lab (gen-label)))
       (loadw value object symbol-tls-index-slot other-pointer-lowtag)
+      #!-x86-ebx-threads
       (inst fs-segment-prefix)
-      (inst mov value (make-ea :dword :base value))
+      (inst mov value (make-ea :dword :base #!+x86-ebx-threads ebx-tn
+                               #!+x86-ebx-threads :index value))
       (inst cmp value no-tls-value-marker-widetag)
       (inst jmp :ne check-unbound-label)
       (loadw value object symbol-value-slot other-pointer-lowtag)
@@ -155,8 +173,10 @@
   (:generator 8
     (let ((ret-lab (gen-label)))
       (loadw value object symbol-tls-index-slot other-pointer-lowtag)
+      #!-x86-ebx-threads
       (inst fs-segment-prefix)
-      (inst mov value (make-ea :dword :base value))
+      (inst mov value (make-ea :dword :base #!+x86-ebx-threads ebx-tn
+                               #!+x86-ebx-threads :index value))
       (inst cmp value no-tls-value-marker-widetag)
       (inst jmp :ne ret-lab)
       (loadw value object symbol-value-slot other-pointer-lowtag)
@@ -211,8 +231,10 @@
   (:generator 9
     (let ((check-unbound-label (gen-label)))
       (loadw value object symbol-tls-index-slot other-pointer-lowtag)
+      #!-x86-ebx-threads
       (inst fs-segment-prefix)
-      (inst mov value (make-ea :dword :base value))
+      (inst mov value (make-ea :dword :base #!+x86-ebx-threads ebx-tn
+                               #!+x86-ebx-threads :index value))
       (inst cmp value no-tls-value-marker-widetag)
       (inst jmp :ne check-unbound-label)
       (loadw value object symbol-value-slot other-pointer-lowtag)
@@ -332,18 +354,23 @@
                     (#.esi-offset 'alloc-tls-index-in-esi))
                   :assembly-routine))
       (emit-label tls-index-valid)
-      (inst fs-segment-prefix)
-      (inst push (make-ea :dword :base tls-index))
-      (popw bsp (- binding-value-slot binding-size))
-      (storew symbol bsp (- binding-symbol-slot binding-size))
-      (if (sc-is val control-stack)
-          (progn
-            (inst push val)
-            (inst fs-segment-prefix)
-            (inst pop (make-ea :dword :base tls-index)))
-          (progn
-            (inst fs-segment-prefix)
-            (inst mov (make-ea :dword :base tls-index) val))))))
+      (let ((tls-ea (make-ea :dword :base #!+x86-ebx-threads ebx-tn
+                             #!+x86-ebx-threads :index tls-index)))
+        #!-x86-ebx-threads
+        (inst fs-segment-prefix)
+        (inst push tls-ea)
+        (popw bsp (- binding-value-slot binding-size))
+        (storew symbol bsp (- binding-symbol-slot binding-size))
+        (if (sc-is val control-stack)
+            (progn
+              (inst push val)
+              #!-x86-ebx-threads
+              (inst fs-segment-prefix)
+              (inst pop tls-ea))
+            (progn
+              #!-x86-ebx-threads
+              (inst fs-segment-prefix)
+              (inst mov tls-ea val)))))))
 
 #!-sb-thread
 (define-vop (bind)
@@ -369,8 +396,12 @@
     (loadw tls-index temp symbol-tls-index-slot other-pointer-lowtag)
     ;; Load VALUE from stack, then restore it to the TLS area.
     (loadw temp bsp (- binding-value-slot binding-size))
-    (inst fs-segment-prefix)
-    (inst mov (make-ea :dword :base tls-index) temp)
+    #!-x86-ebx-threads
+    (progn
+      (inst fs-segment-prefix)
+      (inst mov (make-ea :dword :base tls-index) temp))
+    #!+x86-ebx-threads
+    (inst mov (make-ea :dword :base ebx-tn :index tls-index) temp)
     ;; Zero out the stack.
     (storew 0 bsp (- binding-symbol-slot binding-size))
     (storew 0 bsp (- binding-value-slot binding-size))
@@ -409,10 +440,14 @@
     (loadw value bsp (- binding-value-slot binding-size))
     #!-sb-thread (storew value symbol symbol-value-slot other-pointer-lowtag)
 
-    #!+sb-thread (loadw
-                  tls-index symbol symbol-tls-index-slot other-pointer-lowtag)
-    #!+sb-thread (inst fs-segment-prefix)
-    #!+sb-thread (inst mov (make-ea :dword :base tls-index) value)
+    #!+sb-thread
+    (loadw tls-index symbol symbol-tls-index-slot other-pointer-lowtag)
+    #!+(and sb-thread (not x86-ebx-threads))
+    (progn
+      (inst fs-segment-prefix)
+      (inst mov (make-ea :dword :base tls-index) value))
+    #!+x86-ebx-threads
+    (inst mov (make-ea :dword :base ebx-tn :index tls-index) value)
     (storew 0 bsp (- binding-symbol-slot binding-size))
 
     SKIP
diff -Nur -x '*.trace' -x '*.rej' -x '*.orig' -x sbcl.h -x ldso-stubs.S -x Config -x target -x CVS -x 'target-*.h' -x output -x genesis -x '*.o' -x '*.nm' -x '*.core' -x '*.map' -x '*.d' -x '*~' -x '*.lisp-obj' -x '*.fasl' -x '*.lisp-temp' -x systems -x '*.tmp' -x local-target-features.lisp-expr -x a.out -x '*.so' -x foo.c -x sbcl -x grovel-headers -x customize-target-features.lisp -x external-format-test.txt -x test-status.lisp-expr sbcl-1.0.18-reserve-ebx-5/src/compiler/x86/macros.lisp sbcl-1.0.18-ebx-threads/src/compiler/x86/macros.lisp
--- sbcl-1.0.18-reserve-ebx-5/src/compiler/x86/macros.lisp	2008-06-26 22:14:56.000000000 -0400
+++ sbcl-1.0.18-ebx-threads/src/compiler/x86/macros.lisp	2008-07-02 11:47:32.846368760 -0400
@@ -108,21 +108,31 @@
            (ash symbol-tls-index-slot word-shift)
            (- other-pointer-lowtag))))
 
-#!+sb-thread
+#!+(and sb-thread (not x86-ebx-threads))
 (defmacro load-tl-symbol-value (reg symbol)
   `(progn
     (inst mov ,reg (make-ea-for-symbol-tls-index ,symbol))
     (inst fs-segment-prefix)
     (inst mov ,reg (make-ea :dword :base ,reg))))
+#!+x86-ebx-threads
+(defmacro load-tl-symbol-value (reg symbol)
+  `(progn
+    (inst mov ,reg (make-ea-for-symbol-tls-index ,symbol))
+    (inst mov ,reg (make-ea :dword :base ebx-tn :index ,reg))))
 #!-sb-thread
 (defmacro load-tl-symbol-value (reg symbol) `(load-symbol-value ,reg ,symbol))
 
-#!+sb-thread
+#!+(and sb-thread (not x86-ebx-threads))
 (defmacro store-tl-symbol-value (reg symbol temp)
   `(progn
     (inst mov ,temp (make-ea-for-symbol-tls-index ,symbol))
     (inst fs-segment-prefix)
     (inst mov (make-ea :dword :base ,temp) ,reg)))
+#!+x86-ebx-threads
+(defmacro store-tl-symbol-value (reg symbol temp)
+  `(progn
+    (inst mov ,temp (make-ea-for-symbol-tls-index ,symbol))
+    (inst mov (make-ea :dword :base ebx-tn :index ,temp) ,reg)))
 #!-sb-thread
 (defmacro store-tl-symbol-value (reg symbol temp)
   (declare (ignore temp))
@@ -131,19 +141,23 @@
 (defmacro load-binding-stack-pointer (reg)
   #!+sb-thread
   `(progn
-     (inst fs-segment-prefix)
-     (inst mov ,reg (make-ea :dword
-                             :disp (* 4 thread-binding-stack-pointer-slot))))
+    #!-x86-ebx-threads
+    (inst fs-segment-prefix)
+    (inst mov ,reg (make-ea :dword
+                    #!+x86-ebx-threads ,@'(:base ebx-tn)
+                    :disp (* 4 thread-binding-stack-pointer-slot))))
   #!-sb-thread
   `(load-symbol-value ,reg *binding-stack-pointer*))
 
 (defmacro store-binding-stack-pointer (reg)
   #!+sb-thread
   `(progn
-     (inst fs-segment-prefix)
-     (inst mov (make-ea :dword
-                        :disp (* 4 thread-binding-stack-pointer-slot))
-           ,reg))
+    #!-x86-ebx-threads
+    (inst fs-segment-prefix)
+    (inst mov (make-ea :dword
+               #!+x86-ebx-threads ,@'(:base ebx-tn)
+               :disp (* 4 thread-binding-stack-pointer-slot))
+     ,reg))
   #!-sb-thread
   `(store-symbol-value ,reg *binding-stack-pointer*))
 
@@ -217,18 +231,20 @@
         (free-pointer
          (make-ea :dword :disp
                   #!+sb-thread (* n-word-bytes thread-alloc-region-slot)
+                  #!+x86-ebx-threads :base #!+x86-ebx-threads ebx-tn
                   #!-sb-thread (make-fixup "boxed_region" :foreign)
                   :scale 1)) ; thread->alloc_region.free_pointer
         (end-addr
          (make-ea :dword :disp
                   #!+sb-thread (* n-word-bytes (1+ thread-alloc-region-slot))
+                  #!+x86-ebx-threads :base #!+x86-ebx-threads ebx-tn
                   #!-sb-thread (make-fixup "boxed_region" :foreign 4)
                   :scale 1)))   ; thread->alloc_region.end_addr
     (unless (and (tn-p size) (location= alloc-tn size))
       (inst mov alloc-tn size))
-    #!+sb-thread (inst fs-segment-prefix)
+    #!+(and sb-thread (not x86-ebx-threads)) (inst fs-segment-prefix)
     (inst add alloc-tn free-pointer)
-    #!+sb-thread (inst fs-segment-prefix)
+    #!+(and sb-thread (not x86-ebx-threads)) (inst fs-segment-prefix)
     (inst cmp alloc-tn end-addr)
     (inst jmp :be ok)
     (let ((dst (ecase (tn-offset alloc-tn)
@@ -244,15 +260,15 @@
     ;; Swap ALLOC-TN and FREE-POINTER
     (cond ((and (tn-p size) (location= alloc-tn size))
            ;; XCHG is extremely slow, use the xor swap trick
-           #!+sb-thread (inst fs-segment-prefix)
+           #!+(and sb-thread (not x86-ebx-threads)) (inst fs-segment-prefix)
            (inst xor alloc-tn free-pointer)
-           #!+sb-thread (inst fs-segment-prefix)
+           #!+(and sb-thread (not x86-ebx-threads)) (inst fs-segment-prefix)
            (inst xor free-pointer alloc-tn)
-           #!+sb-thread (inst fs-segment-prefix)
+           #!+(and sb-thread (not x86-ebx-threads)) (inst fs-segment-prefix)
            (inst xor alloc-tn free-pointer))
           (t
            ;; It's easier if SIZE is still available.
-           #!+sb-thread (inst fs-segment-prefix)
+           #!+(and sb-thread (not x86-ebx-threads)) (inst fs-segment-prefix)
            (inst mov free-pointer alloc-tn)
            (inst sub alloc-tn size)))
     (emit-label done))
@@ -358,15 +374,18 @@
 
 #!+sb-thread
 (defmacro pseudo-atomic (&rest forms)
-  (with-unique-names (label)
-    `(let ((,label (gen-label)))
+  (with-unique-names (label tls-ea)
+    `(let ((,label (gen-label))
+           (,tls-ea (make-ea :byte
+                             #!+x86-ebx-threads :base #!+x86-ebx-threads ebx-tn
+                             :disp (* 4 thread-pseudo-atomic-bits-slot))))
+       #!-x86-ebx-threads
        (inst fs-segment-prefix)
-       (inst or (make-ea :byte :disp (* 4 thread-pseudo-atomic-bits-slot))
-            (fixnumize 1))
+       (inst or ,tls-ea (fixnumize 1))
        ,@forms
+       #!-x86-ebx-threads
        (inst fs-segment-prefix)
-       (inst xor (make-ea :byte :disp (* 4 thread-pseudo-atomic-bits-slot))
-             (fixnumize 1))
+       (inst xor ,tls-ea (fixnumize 1))
        (inst jmp :z ,label)
        ;; if PAI was set, interrupts were disabled at the same
        ;; time using the process signal mask.
diff -Nur -x '*.trace' -x '*.rej' -x '*.orig' -x sbcl.h -x ldso-stubs.S -x Config -x target -x CVS -x 'target-*.h' -x output -x genesis -x '*.o' -x '*.nm' -x '*.core' -x '*.map' -x '*.d' -x '*~' -x '*.lisp-obj' -x '*.fasl' -x '*.lisp-temp' -x systems -x '*.tmp' -x local-target-features.lisp-expr -x a.out -x '*.so' -x foo.c -x sbcl -x grovel-headers -x customize-target-features.lisp -x external-format-test.txt -x test-status.lisp-expr sbcl-1.0.18-reserve-ebx-5/src/compiler/x86/system.lisp sbcl-1.0.18-ebx-threads/src/compiler/x86/system.lisp
--- sbcl-1.0.18-reserve-ebx-5/src/compiler/x86/system.lisp	2008-06-26 22:14:56.000000000 -0400
+++ sbcl-1.0.18-ebx-threads/src/compiler/x86/system.lisp	2008-07-01 23:53:11.012911800 -0400
@@ -266,9 +266,13 @@
   (:args (n :scs (unsigned-reg) :target sap))
   (:arg-types unsigned-num)
   (:policy :fast-safe)
+  #!-x86-ebx-threads
   (:generator 2
     (inst fs-segment-prefix)
-    (inst mov sap (make-ea :dword :disp 0 :index n :scale 4))))
+    (inst mov sap (make-ea :dword :disp 0 :index n :scale 4)))
+  #!+x86-ebx-threads
+  (:generator 2
+    (inst mov sap (make-ea :dword :base ebx-tn :disp 0 :index n :scale 4))))
 
 (define-vop (halt)
   (:generator 1
diff -Nur -x '*.trace' -x '*.rej' -x '*.orig' -x sbcl.h -x ldso-stubs.S -x Config -x target -x CVS -x 'target-*.h' -x output -x genesis -x '*.o' -x '*.nm' -x '*.core' -x '*.map' -x '*.d' -x '*~' -x '*.lisp-obj' -x '*.fasl' -x '*.lisp-temp' -x systems -x '*.tmp' -x local-target-features.lisp-expr -x a.out -x '*.so' -x foo.c -x sbcl -x grovel-headers -x customize-target-features.lisp -x external-format-test.txt -x test-status.lisp-expr sbcl-1.0.18-reserve-ebx-5/src/runtime/thread.h sbcl-1.0.18-ebx-threads/src/runtime/thread.h
--- sbcl-1.0.18-reserve-ebx-5/src/runtime/thread.h	2008-06-26 22:15:02.000000000 -0400
+++ sbcl-1.0.18-ebx-threads/src/runtime/thread.h	2008-07-01 23:53:11.013911120 -0400
@@ -138,7 +138,7 @@
 static inline struct thread *arch_os_get_current_thread(void)
 {
 #if defined(LISP_FEATURE_SB_THREAD)
-#if defined(LISP_FEATURE_X86)
+#if defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_EBX_THREADS)
     register struct thread *me=0;
     if(all_threads) {
 #if defined(LISP_FEATURE_DARWIN) && defined(LISP_FEATURE_RESTORE_FS_SEGMENT_REGISTER_FROM_TLS)
diff -Nur -x '*.trace' -x '*.rej' -x '*.orig' -x sbcl.h -x ldso-stubs.S -x Config -x target -x CVS -x 'target-*.h' -x output -x genesis -x '*.o' -x '*.nm' -x '*.core' -x '*.map' -x '*.d' -x '*~' -x '*.lisp-obj' -x '*.fasl' -x '*.lisp-temp' -x systems -x '*.tmp' -x local-target-features.lisp-expr -x a.out -x '*.so' -x foo.c -x sbcl -x grovel-headers -x customize-target-features.lisp -x external-format-test.txt -x test-status.lisp-expr sbcl-1.0.18-reserve-ebx-5/src/runtime/x86-assem.S sbcl-1.0.18-ebx-threads/src/runtime/x86-assem.S
--- sbcl-1.0.18-reserve-ebx-5/src/runtime/x86-assem.S	2008-07-01 09:48:50.541415000 -0400
+++ sbcl-1.0.18-ebx-threads/src/runtime/x86-assem.S	2008-07-05 09:14:47.863568760 -0400
@@ -185,6 +185,11 @@
 #ifndef LISP_FEATURE_WIN32
 	movl    %esp,ALIEN_STACK + SYMBOL_VALUE_OFFSET
 	movl    GNAME(all_threads),%eax
+#ifdef	LISP_FEATURE_X86_EBX_THREADS
+	/* Save the thread context pointer on the old stack, as it's
+	 * loaded via %ebp later. */
+	pushl	%eax
+#endif
 	/* pthread machinery takes care of this for other threads */
 	movl    THREAD_CONTROL_STACK_END_OFFSET(%eax) ,%esp
 #else
@@ -204,6 +209,12 @@
 GNAME(call_into_lisp):
 	pushl	%ebp		# Save old frame pointer.
 	movl	%esp,%ebp	# Establish new frame.
+#ifdef LISP_FEATURE_X86_EBX_THREADS
+	pushl	specials
+	call	pthread_getspecific
+	popl	%ecx		# Garbage	
+	pushl	%eax
+#endif
 Lstack:
 /* Save the NPX state */
 	fwait			# Catch any pending NPX exceptions.
@@ -273,15 +284,28 @@
 	movl	%esp, %fs:0
 #endif
 
+#ifdef LISP_FEATURE_X86_EBX_THREADS
+	mov	-4(%ebp),%ebx	# Load thread context pointer.
+	/* Alloc new frame. */
+	push	%ebp		# fp in save location S0
+	sub	$8,%esp		# Ensure 3 slots are allocated, one above.
+	lea	12(%esp),%ebp	# Switch to new frame.
+#else
 	/* Alloc new frame. */
 	mov	%esp,%ebx	# The current sp marks start of new frame.
 	push	%ebp		# fp in save location S0
 	sub	$8,%esp		# Ensure 3 slots are allocated, one above.
 	mov	%ebx,%ebp	# Switch to new frame.
+#endif
 
 #ifdef LISP_FEATURE_X86_TWO_ARG_PASSING_REGS
 	mov	%esi,-12(%ebp)	# Write third arg back down.
 #endif
+/*
+ * #ifdef LISP_FEATURE_X86_EBX_THREADS
+ * 	mov	%fs:THREAD_THIS_OFFSET,%ebx
+ * #endif
+ */
 
 	call	*CLOSURE_FUN_OFFSET(%eax)
 	
@@ -313,6 +337,10 @@
 /* Restore the NPX state. */
 	frstor  (%esp)
 	addl	$108, %esp
+
+#ifdef LISP_FEATURE_X86_EBX_THREADS
+	popl	%ebp		# Lose the thread pointer
+#endif
 	
 	popl	%ebp		# c-sp
 	movl	%edx,%eax	# c-val
@@ -547,8 +575,12 @@
  * But where necessary must save eax, ecx, edx. */
 
 #ifdef LISP_FEATURE_SB_THREAD
+#ifndef LISP_FEATURE_X86_EBX_THREADS
 #define START_REGION %fs:THREAD_ALLOC_REGION_OFFSET
 #else
+#define START_REGION THREAD_ALLOC_REGION_OFFSET(%ebx)
+#endif
+#else
 #define START_REGION GNAME(boxed_region)
 #endif
 
diff -Nur -x '*.trace' -x '*.rej' -x '*.orig' -x sbcl.h -x ldso-stubs.S -x Config -x target -x CVS -x 'target-*.h' -x output -x genesis -x '*.o' -x '*.nm' -x '*.core' -x '*.map' -x '*.d' -x '*~' -x '*.lisp-obj' -x '*.fasl' -x '*.lisp-temp' -x systems -x '*.tmp' -x local-target-features.lisp-expr -x a.out -x '*.so' -x foo.c -x sbcl -x grovel-headers -x customize-target-features.lisp -x external-format-test.txt -x test-status.lisp-expr sbcl-1.0.18-reserve-ebx-5/src/runtime/x86-linux-os.c sbcl-1.0.18-ebx-threads/src/runtime/x86-linux-os.c
--- sbcl-1.0.18-reserve-ebx-5/src/runtime/x86-linux-os.c	2007-10-07 09:46:13.000000000 -0400
+++ sbcl-1.0.18-ebx-threads/src/runtime/x86-linux-os.c	2008-07-02 00:20:03.571408640 -0400
@@ -76,6 +76,7 @@
 int arch_os_thread_init(struct thread *thread) {
     stack_t sigstack;
 #ifdef LISP_FEATURE_SB_THREAD
+#ifndef LISP_FEATURE_X86_EBX_THREADS
     struct user_desc ldt_entry = {
         1, 0, 0, /* index, address, length filled in later */
         1, MODIFY_LDT_CONTENTS_DATA, 0, 0, 0, 1
@@ -107,6 +108,7 @@
     pthread_mutex_unlock(&modify_ldt_lock);
 
     if(n<0) return 0;
+#endif
 #ifdef LISP_FEATURE_GCC_TLS
     current_thread = thread;
 #else
@@ -137,6 +139,7 @@
  */
 
 int arch_os_thread_cleanup(struct thread *thread) {
+#ifndef LISP_FEATURE_X86_EBX_THREADS
     struct user_desc ldt_entry = {
         0, 0, 0,
         0, MODIFY_LDT_CONTENTS_DATA, 0, 0, 0, 0
@@ -148,6 +151,7 @@
     result = modify_ldt(1, &ldt_entry, sizeof (ldt_entry));
     thread_mutex_unlock(&modify_ldt_lock);
     return result;
+#endif
 }
 
 
