3 (define-alien-type os-context-t
(struct os-context-t-struct
))
5 ;;;; MACHINE-TYPE and MACHINE-VERSION
8 "Returns a string describing the type of the local machine."
11 ;;; support for CL:MACHINE-VERSION defined OAOO elsewhere
12 (defun get-machine-version ()
15 ;;;; FIXUP-CODE-OBJECT
17 (defun fixup-code-object (code offset value kind
)
18 (unless (zerop (rem offset n-word-bytes
))
19 (error "Unaligned instruction? offset=#x~X." offset
))
21 (let* ((sap (truly-the system-area-pointer
22 (%primitive sb
!kernel
::code-instructions code
)))
23 (inst (sap-ref-32 sap offset
)))
24 (setf (sap-ref-32 sap offset
)
27 (logior (ash (ldb (byte 11 0) value
) 1)
28 (logand inst
#xffffc000
)))
30 (let ((low-bits (ldb (byte 11 0) value
)))
31 (aver (<= 0 low-bits
(1- (ash 1 4))))
32 (logior (ash low-bits
17)
33 (logand inst
#xffe0ffff
))))
35 (logior (ash (ldb (byte 5 13) value
) 16)
36 (ash (ldb (byte 2 18) value
) 14)
37 (ash (ldb (byte 2 11) value
) 12)
38 (ash (ldb (byte 11 20) value
) 1)
39 (ldb (byte 1 31) value
)
40 (logand inst
#xffe00000
)))
42 (let ((bits (ldb (byte 9 2) value
)))
43 (aver (zerop (ldb (byte 2 0) value
)))
45 (logand inst
#xffe0e002
)))))))))
47 (define-alien-routine ("os_context_pc_addr" context-pc-addr
) (* unsigned-int
)
48 (context (* os-context-t
)))
50 (defun context-pc (context)
51 (declare (type (alien (* os-context-t
)) context
))
52 (int-sap (logandc2 (deref (context-pc-addr context
)) 3)))
54 (define-alien-routine ("os_context_register_addr" context-register-addr
)
56 (context (* os-context-t
))
59 ;;; FIXME: Should this and CONTEXT-PC be INLINE to reduce consing?
60 ;;; (Are they used in anything time-critical, or just the debugger?)
61 (defun context-register (context index
)
62 (declare (type (alien (* os-context-t
)) context
))
63 (deref (context-register-addr context index
)))
65 (defun %set-context-register
(context index new
)
66 (declare (type (alien (* os-context-t
)) context
))
67 (setf (deref (context-register-addr context index
))
72 (defun context-floating-point-modes (context)
73 (warn "stub CONTEXT-FLOATING-POINT-MODES")
76 ;;;; Internal-error-arguments.
78 ;;; INTERNAL-ERROR-ARGUMENTS -- interface.
80 ;;; Given the sigcontext, extract the internal error arguments from the
81 ;;; instruction stream.
83 (defun internal-error-args (context)
84 (declare (type (alien (* os-context-t
)) context
))
85 (let ((pc (context-pc context
)))
86 (declare (type system-area-pointer pc
))
87 (let* ((length (sap-ref-8 pc
4))
88 (vector (make-array length
:element-type
'(unsigned-byte 8))))
89 (declare (type (unsigned-byte 8) length
)
90 (type (simple-array (unsigned-byte 8) (*)) vector
))
91 (copy-ub8-from-system-area pc
5 vector
0 length
)
93 (error-number (sb!c
:read-var-integer vector index
)))
94 (collect ((sc-offsets))
96 (when (>= index length
)
98 (sc-offsets (sb!c
:read-var-integer vector index
)))
99 (values error-number
(sc-offsets)))))))