(in-package "SB!THREAD")
+#-sb-fluid (declaim (inline sb!vm::current-thread-offset-sap))
+(defun sb!vm::current-thread-offset-sap (n)
+ (declare (type (unsigned-byte 27) n))
+ (sb!sys:sap-ref-sap (alien-sap (extern-alien "all_threads" (* t)))
+ (* n 4)))
+
(defun current-thread-id ()
(sb!sys:sap-int
(sb!vm::current-thread-offset-sap sb!vm::thread-pid-slot)))
(:generator 1
(inst unimp pending-interrupt-trap)))
-(defknown current-thread-offset-sap ((unsigned-byte 32))
- system-area-pointer (flushable))
-
-(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) ))
- (:temporary (:sc unsigned-reg :target sap) temp1)
- (:temporary (:sc unsigned-reg) temp2)
- (:arg-types unsigned-num)
- (:policy :fast-safe)
- (:generator 3
- (inst slwi n temp1 2)
- (inst lr temp2 (make-fixup (extern-alien-name "all_threads") :foreign))
- (inst lwzx sap temp1 temp2)))
-
(define-vop (halt)
(:generator 1
(inst unimp halt-trap)))
(:generator 1
(inst break pending-interrupt-trap)))
+#!+sb-thread
(defknown current-thread-offset-sap ((unsigned-byte 32))
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) #!+sb-thread :target #!+sb-thread sap))
- #!-sb-thread (:temporary (:sc unsigned-reg :target sap) temp)
+ (:args (n :scs (unsigned-reg) :target sap))
(:arg-types unsigned-num)
(:policy :fast-safe)
- #!+sb-thread
(:generator 2
(inst fs-segment-prefix)
- (inst mov sap (make-ea :dword :disp 0 :index n :scale 4)))
- #!-sb-thread
- (:generator 2
- (inst mov temp (make-fixup (extern-alien-name "all_threads") :foreign))
- (inst mov sap (make-ea :dword :base temp :index n :scale 4))))
+ (inst mov sap (make-ea :dword :disp 0 :index n :scale 4))))
(define-vop (halt)
(:generator 1
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.pre8.37"
+"0.pre8.38"