1 ;;; This file contains the ARM specific runtime stuff.
7 "Return a string describing the type of the local machine."
10 ;;;; FIXUP-CODE-OBJECT
13 (defun fixup-code-object (code offset fixup kind
)
14 (declare (type index offset
))
15 (unless (zerop (rem offset
4))
16 (error "Unaligned instruction? offset=#x~X." offset
))
18 (let ((sap (code-instructions code
)))
21 (setf (sap-ref-word sap offset
) fixup
))
23 (setf (ldb (byte 19 5) (sap-ref-32 sap offset
))
24 (ash (- fixup
(+ (sap-int sap
) offset
)) -
2)))
26 (setf (ldb (byte 26 0) (sap-ref-32 sap offset
))
27 (ash (- fixup
(+ (sap-int sap
) offset
)) -
2))))))))
29 ;;;; "Sigcontext" access functions, cut & pasted from sparc-vm.lisp,
30 ;;;; then modified for ARM.
32 ;;;; See also x86-vm for commentary on signed vs unsigned.
35 (define-alien-routine ("os_context_float_register_addr" context-float-register-addr
)
36 (* unsigned
) (context (* os-context-t
)) (index int
))
38 (defun context-float-register (context index format
)
39 (let ((sap (alien-sap (context-float-register-addr context index
))))
42 (sap-ref-single sap
0))
44 (sap-ref-double sap
0))
46 (complex (sap-ref-single sap
0)
47 (sap-ref-single sap
4)))
49 (complex (sap-ref-double sap
0)
50 (sap-ref-double sap
8))))))
52 (defun %set-context-float-register
(context index format value
)
53 (let ((sap (alien-sap (context-float-register-addr context index
))))
56 (setf (sap-ref-single sap
0) value
))
58 (setf (sap-ref-double sap
0) value
))
61 (declare (type (complex single-float
) value
))
62 (setf (sap-ref-single sap
0) (realpart value
)
63 (sap-ref-single sap
4) (imagpart value
))))
66 (declare (type (complex double-float
) value
))
67 (setf (sap-ref-double sap
0) (realpart value
)
68 (sap-ref-double sap
8) (imagpart value
)))))))
70 ;;;; INTERNAL-ERROR-ARGS.
72 ;;; Given a (POSIX) signal context, extract the internal error
73 ;;; arguments from the instruction stream.
74 (defun internal-error-args (context)
75 (declare (type (alien (* os-context-t
)) context
))
76 (let* ((pc (context-pc context
))
77 (instruction (sap-ref-32 pc
0))
78 (error-number (ldb (byte 8 13) instruction
))
79 (trap-number (ldb (byte 8 5) instruction
)))
80 (declare (type system-area-pointer pc
))
82 (if (= trap-number invalid-arg-count-trap
)
84 (sb!kernel
::decode-internal-error-args
(sap+ pc
4) error-number
))