Index: /branches/arm/compiler/ARM/arm-asm.lisp
===================================================================
--- /branches/arm/compiler/ARM/arm-asm.lisp	(revision 13891)
+++ /branches/arm/compiler/ARM/arm-asm.lisp	(revision 13892)
@@ -171,4 +171,9 @@
   (vector
 
+   (define-arm-instruction clrex ()
+     #xf57ff01f
+     #xffffffff
+     (:non-conditional))
+   
 ;;; UUOs.
 
@@ -748,8 +753,4 @@
      #x0ff00ff0
      ())
-   (define-arm-instruction clrex ()
-     #xf57ff01f
-     #xffffffff
-     (:non-conditional))
    (define-arm-instruction clz (:rd :rm)
      #x016f0f10
@@ -776,5 +777,8 @@
          (template (if ordinal (aref *arm-instruction-table* ordinal))))
     (if template
-      (values template (unless (logbitp (encode-arm-instruction-flag :non-conditional) (arm-instruction-template-flags template)) cond-value) nil)
+      (if (logtest (encode-arm-instruction-flag :non-conditional) (arm-instruction-template-flags template))
+        (let* ((cond (ldb (byte 4 28) (arm-instruction-template-val template))))
+          (values template cond cond))
+        (values template cond-value nil))
       (if (> len 2)
         (let* ((cond-name (make-string 2)))
Index: /branches/arm/compiler/ARM/arm-vinsns.lisp
===================================================================
--- /branches/arm/compiler/ARM/arm-vinsns.lisp	(revision 13891)
+++ /branches/arm/compiler/ARM/arm-vinsns.lisp	(revision 13892)
@@ -774,6 +774,6 @@
 (define-arm-vinsn extract-tag-fixnum (((tag :imm))
                                       ((object :lisp)))
-  (and tag object (:$ arm::tagmask))
-  (mov tag (:lsl tag (:$ arm::fixnumshift))))
+  (mov tag (:lsl object (:$ arm::fixnumshift)))
+  (and tag object (:$ (ash arm::tagmask arm::fixnumshift))))
 
 (define-arm-vinsn extract-fulltag (((tag :u8))
Index: /branches/arm/level-0/ARM/arm-utils.lisp
===================================================================
--- /branches/arm/level-0/ARM/arm-utils.lisp	(revision 13891)
+++ /branches/arm/level-0/ARM/arm-utils.lisp	(revision 13892)
@@ -195,4 +195,6 @@
     (b @test)
     @loop
+    (test-fixnum obj)
+    (uuo-debug-trap (:? ne))
     (ldr header (:@ obj (:$ 0)))
     (extract-fulltag tag header)
@@ -208,5 +210,5 @@
     (bl .SPFuncall)
     (ldmia (:! vsp) (obj fun sentinel))
-    (add obj obj (:$ arm::cons.size))
+    (add obj obj (:$ (- arm::cons.size arm::fulltag-cons)))
     (b @test)
     @misc
@@ -217,5 +219,5 @@
     (bl .SPFuncall)
     (ldmia (:! vsp) (obj fun sentinel))
-    (add obj obj (:$ arm::fulltag-misc))
+    (sub obj obj (:$ arm::fulltag-misc))
     (ldr header (:@ obj (:$ 0)))
     (extract-fulltag tag header)
@@ -240,4 +242,5 @@
     (mov header (:lsr header (:$ 3)))
     @bump
+    (mov imm2 obj)
     (add header header (:$ (+ 4 7)))
     (bic header header (:$ arm::fulltagmask))
Index: /branches/arm/level-0/l0-misc.lisp
===================================================================
--- /branches/arm/level-0/l0-misc.lisp	(revision 13891)
+++ /branches/arm/level-0/l0-misc.lisp	(revision 13892)
@@ -272,4 +272,7 @@
 	(multiple-value-bind (cf cu) (free-and-used (%fixnum-ref tcr target::tcr.cs-area))
 	  (multiple-value-bind (vf vu) (free-and-used (%fixnum-ref tcr target::tcr.vs-area))
+            #+arm-target
+            (values cf cu vf vu)
+            #-arm-target
 	    (multiple-value-bind (tf tu) (free-and-used (%fixnum-ref tcr target::tcr.ts-area ))
 	      (values cf cu vf vu tf tu))))))))
Index: /branches/arm/lisp-kernel/arm-exceptions.c
===================================================================
--- /branches/arm/lisp-kernel/arm-exceptions.c	(revision 13891)
+++ /branches/arm/lisp-kernel/arm-exceptions.c	(revision 13892)
@@ -983,4 +983,7 @@
   opcode instruction = 0;
 
+  if (old_valence != TCR_STATE_LISP) {
+    return false;
+  }
 
   program_counter = xpPC(xp);
@@ -1122,4 +1125,6 @@
       break;
     }
+    break;
+
 
   case uuo_format_error_lisptag:
@@ -1184,5 +1189,5 @@
                                                
 
-  TCR *tcr = TCR_FROM_TSD(xpGPR(xp, rcontext));
+  TCR *tcr = get_tcr(true);
 
   /* Put the active stack pointer where .SPcallback expects it */
Index: /branches/arm/lisp-kernel/arm-spentry.s
===================================================================
--- /branches/arm/lisp-kernel/arm-spentry.s	(revision 13891)
+++ /branches/arm/lisp-kernel/arm-spentry.s	(revision 13892)
@@ -1500,5 +1500,5 @@
         __(ldr temp0,[imm1,#-node_size]!)
         __(cmp imm1,vsp)
-        __(push1(temp2,imm0))
+        __(push1(temp0,imm0))
         __(bne 1b)
         __(mov vsp,imm0)
@@ -1816,6 +1816,6 @@
    support because of the locative */
 _spentry(atomic_incf_node)
-        __(unbox_fixnum(imm0,arg_z))
-0:      __(add imm2,arg_y,imm0)
+        __(unbox_fixnum(imm1,arg_z))
+0:      __(add imm2,arg_y,imm1)
         __(ldrex arg_z,[imm2])
         __(add arg_z,arg_z,arg_x)
