1.0.46.27: fix mach port leakage
[sbcl.git] / src / compiler / ppc / system.lisp
index 678b682..684bf3c 100644 (file)
   (:generator 1
     (inst unimp pending-interrupt-trap)))
 
+#!+sb-thread
+(defknown current-thread-offset-sap ((unsigned-byte 64))
+  system-area-pointer (flushable))
+
+#!+sb-thread
+(define-vop (current-thread-offset-sap)
+  (:results (sap :scs (sap-reg)))
+  (:result-types system-area-pointer)
+  (:translate current-thread-offset-sap)
+  (:args (n :scs (unsigned-reg) :target sap))
+  (:arg-types unsigned-num)
+  (:policy :fast-safe)
+  (:generator 2
+    (inst slwi n n word-shift)
+    (inst lwzx sap thread-base-tn n)))
+
 (define-vop (halt)
   (:generator 1
     (inst unimp halt-trap)))