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 sbcl-0.9.12-x86-reserve-ebx-5/src/compiler/x86/c-call.lisp sbcl-0.9.12-x86-ebx-threads/src/compiler/x86/c-call.lisp
--- sbcl-0.9.12-x86-reserve-ebx-5/src/compiler/x86/c-call.lisp	2006-03-20 11:37:52.000000000 -0500
+++ sbcl-0.9.12-x86-ebx-threads/src/compiler/x86/c-call.lisp	2006-05-08 13:31:04.000000000 -0400
@@ -305,8 +305,12 @@
                                 (static-symbol-offset '*alien-stack*)
                                 (ash symbol-tls-index-slot word-shift)
                                 (- other-pointer-lowtag))))
+        #!-x86-ebx-threads
         (inst fs-segment-prefix)
-        (inst sub (make-ea :dword :base temp) delta)))
+        #!-x86-ebx-threads
+        (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
@@ -334,8 +338,12 @@
                                 (static-symbol-offset '*alien-stack*)
                                 (ash symbol-tls-index-slot word-shift)
                                 (- other-pointer-lowtag))))
+        #!-x86-ebx-threads
         (inst fs-segment-prefix)
-        (inst add (make-ea :dword :base temp) delta))))
+        #!-x86-ebx-threads
+        (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 sbcl-0.9.12-x86-reserve-ebx-5/src/compiler/x86/cell.lisp sbcl-0.9.12-x86-ebx-threads/src/compiler/x86/cell.lisp
--- sbcl-0.9.12-x86-reserve-ebx-5/src/compiler/x86/cell.lisp	2006-04-30 10:22:08.000000000 -0400
+++ sbcl-0.9.12-x86-ebx-threads/src/compiler/x86/cell.lisp	2006-05-08 16:01:13.000000000 -0400
@@ -59,7 +59,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)))
@@ -81,6 +81,24 @@
       (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 or tls tls)
+    (inst jmp :z global-val)
+    (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)
@@ -111,8 +129,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)
@@ -133,8 +153,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)
@@ -190,8 +212,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)
@@ -322,18 +346,23 @@
        (store-symbol-value 0 *tls-index-lock*))
 
       (emit-label tls-index-valid)
-      (inst fs-segment-prefix)
-      (inst mov temp (make-ea :dword :base tls-index))
-      (storew temp 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 mov temp tls-ea)
+        (storew temp 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)
@@ -360,8 +389,10 @@
     (loadw value bsp (- binding-value-slot binding-size))
 
     (loadw tls-index symbol symbol-tls-index-slot other-pointer-lowtag)
+    #!-x86-ebx-threads
     (inst fs-segment-prefix)
-    (inst mov (make-ea :dword :base tls-index) value)
+    (inst mov (make-ea :dword :base #!+x86-ebx-threads ebx-tn
+                       #!+x86-ebx-threads :index tls-index) value)
 
     (storew 0 bsp (- binding-value-slot binding-size))
     (storew 0 bsp (- binding-symbol-slot binding-size))
@@ -397,10 +428,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-value-slot binding-size))
     (storew 0 bsp (- binding-symbol-slot binding-size))
 
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 sbcl-0.9.12-x86-reserve-ebx-5/src/compiler/x86/macros.lisp sbcl-0.9.12-x86-ebx-threads/src/compiler/x86/macros.lisp
--- sbcl-0.9.12-x86-reserve-ebx-5/src/compiler/x86/macros.lisp	2006-03-20 11:37:52.000000000 -0500
+++ sbcl-0.9.12-x86-ebx-threads/src/compiler/x86/macros.lisp	2006-05-08 14:05:33.000000000 -0400
@@ -88,21 +88,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))
@@ -111,19 +121,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*))
 
@@ -196,18 +210,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)
@@ -223,15 +239,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))
@@ -348,22 +364,23 @@
 
 #!+sb-thread
 (defmacro pseudo-atomic (&rest forms)
-  (with-unique-names (label)
-    `(let ((,label (gen-label)))
-       (inst fs-segment-prefix)
-       (inst mov (make-ea :byte :disp (* 4 thread-pseudo-atomic-atomic-slot))
-            (fixnumize 1))
-       ,@forms
-       (inst fs-segment-prefix)
-       (inst mov (make-ea :byte :disp (* 4 thread-pseudo-atomic-atomic-slot)) 0)
-       (inst fs-segment-prefix)
-       (inst cmp (make-ea :byte
-                          :disp (* 4 thread-pseudo-atomic-interrupted-slot)) 0)
-       (inst jmp :eq ,label)
-       ;; if PAI was set, interrupts were disabled at the same
-       ;; time using the process signal mask.
-       (inst break pending-interrupt-trap)
-       (emit-label ,label))))
+  (flet ((tls-ea (slot)
+           `(make-ea :byte :disp (* 4 ,slot)
+             #!+x86-ebx-threads ,@'(:base ebx-tn))))
+    (with-unique-names (label)
+      `(let ((,label (gen-label)))
+        #!-x86-ebx-threads (inst fs-segment-prefix)
+        (inst mov ,(tls-ea thread-pseudo-atomic-atomic-slot) (fixnumize 1))
+        ,@forms
+        #!-x86-ebx-threads (inst fs-segment-prefix)
+        (inst mov ,(tls-ea thread-pseudo-atomic-atomic-slot) 0)
+        #!-x86-ebx-threads (inst fs-segment-prefix)
+        (inst cmp ,(tls-ea thread-pseudo-atomic-interrupted-slot) 0)
+        (inst jmp :eq ,label)
+        ;; if PAI was set, interrupts were disabled at the same
+        ;; time using the process signal mask.
+        (inst break pending-interrupt-trap)
+        (emit-label ,label)))))
 
 #!-sb-thread
 (defmacro pseudo-atomic (&rest forms)
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 sbcl-0.9.12-x86-reserve-ebx-5/src/compiler/x86/system.lisp sbcl-0.9.12-x86-ebx-threads/src/compiler/x86/system.lisp
--- sbcl-0.9.12-x86-reserve-ebx-5/src/compiler/x86/system.lisp	2005-11-20 22:53:22.000000000 -0500
+++ sbcl-0.9.12-x86-ebx-threads/src/compiler/x86/system.lisp	2006-05-08 13:02:35.000000000 -0400
@@ -285,9 +285,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 sbcl-0.9.12-x86-reserve-ebx-5/src/runtime/thread.h sbcl-0.9.12-x86-ebx-threads/src/runtime/thread.h
--- sbcl-0.9.12-x86-reserve-ebx-5/src/runtime/thread.h	2005-10-20 15:31:43.000000000 -0400
+++ sbcl-0.9.12-x86-ebx-threads/src/runtime/thread.h	2006-05-08 17:17:25.000000000 -0400
@@ -111,7 +111,7 @@
 
 static inline struct thread *arch_os_get_current_thread() {
 #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)
         __asm__ __volatile__ ("movl %%fs:%c1,%0" : "=r" (me)
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 sbcl-0.9.12-x86-reserve-ebx-5/src/runtime/x86-assem.S sbcl-0.9.12-x86-ebx-threads/src/runtime/x86-assem.S
--- sbcl-0.9.12-x86-reserve-ebx-5/src/runtime/x86-assem.S	2006-05-01 16:51:19.000000000 -0400
+++ sbcl-0.9.12-x86-ebx-threads/src/runtime/x86-assem.S	2006-05-08 19:21:48.000000000 -0400
@@ -194,6 +194,9 @@
 #ifndef LISP_FEATURE_WIN32
 	movl    %esp,ALIEN_STACK + SYMBOL_VALUE_OFFSET
 	movl    GNAME(all_threads),%eax
+#ifdef	LISP_FEATURE_X86_EBX_THREADS
+	pushl	%eax
+#endif
 	movl    THREAD_CONTROL_STACK_START_OFFSET(%eax) ,%esp
 	/* don't think too hard about what happens if we get interrupted
 	* here */
@@ -215,6 +218,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 +282,28 @@
 Ldone:	
 	/* Registers eax, ecx, edx, edi, and esi are now live. */
 
+#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)
 	
@@ -307,6 +329,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
@@ -726,8 +752,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 sbcl-0.9.12-x86-reserve-ebx-5/src/runtime/x86-linux-os.c sbcl-0.9.12-x86-ebx-threads/src/runtime/x86-linux-os.c
--- sbcl-0.9.12-x86-reserve-ebx-5/src/runtime/x86-linux-os.c	2005-10-20 15:31:43.000000000 -0400
+++ sbcl-0.9.12-x86-ebx-threads/src/runtime/x86-linux-os.c	2006-05-08 18:29:17.000000000 -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
     pthread_setspecific(specials,thread);
 #endif
 #ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
@@ -133,6 +135,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
@@ -144,6 +147,7 @@
     result = modify_ldt(1, &ldt_entry, sizeof (ldt_entry));
     thread_mutex_unlock(&modify_ldt_lock);
     return result;
+#endif
 }
 
 
