X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Falpha-vm.lisp;h=1d7cf1153cbe4278545da43d6816aee01379907c;hb=80304981972c91c1b3f3fca75f36dacf1fecf307;hp=b309cf82fa34cce50a3e2fe2e94aff11e98ee5b3;hpb=63fcb94b875a97e468d9add229e220ecceec2352;p=sbcl.git diff --git a/src/code/alpha-vm.lisp b/src/code/alpha-vm.lisp index b309cf8..1d7cf11 100644 --- a/src/code/alpha-vm.lisp +++ b/src/code/alpha-vm.lisp @@ -15,7 +15,7 @@ (defvar *bits-per-word* 64) ;;; See x86-vm.lisp for a description of this. -(def-alien-type os-context-t (struct os-context-t-struct)) +(define-alien-type os-context-t (struct os-context-t-struct)) ;;;; MACHINE-TYPE and MACHINE-VERSION @@ -27,7 +27,7 @@ "Alpha") (defun fixup-code-object (code offset value kind) - (unless (zerop (rem offset word-bytes)) + (unless (zerop (rem offset n-word-bytes)) (error "Unaligned instruction? offset=#x~X." offset)) (sb!sys:without-gcing (let ((sap (truly-the system-area-pointer @@ -37,7 +37,8 @@ (assert (zerop (ldb (byte 2 0) value))) #+nil (setf (sap-ref-16 sap offset) - (logior (sap-ref-16 sap offset) (ldb (byte 14 0) (ash value -2))))) + (logior (sap-ref-16 sap offset) + (ldb (byte 14 0) (ash value -2))))) (:bits-63-48 (let* ((value (if (logbitp 15 value) (+ value (ash 1 16)) value)) (value (if (logbitp 31 value) (+ value (ash 1 32)) value)) @@ -57,7 +58,7 @@ (setf (sap-ref-8 sap offset) (ldb (byte 8 0) value)) (setf (sap-ref-8 sap (1+ offset)) (ldb (byte 8 8) value))))))) -;;;; "Sigcontext" access functions, cut & pasted from x86-vm.lisp then +;;;; "sigcontext" access functions, cut & pasted from x86-vm.lisp then ;;;; hacked for types. ;;;; ;;;; KLUDGE: The alpha has 64-bit registers, so these potentially @@ -71,14 +72,14 @@ ;;;; ;;;; See also x86-vm for commentary on signed vs unsigned. -(def-alien-routine ("os_context_pc_addr" context-pc-addr) (* unsigned-long) +(define-alien-routine ("os_context_pc_addr" context-pc-addr) (* unsigned-long) (context (* os-context-t))) (defun context-pc (context) (declare (type (alien (* os-context-t)) context)) (int-sap (deref (context-pc-addr context)))) -(def-alien-routine ("os_context_register_addr" context-register-addr) +(define-alien-routine ("os_context_register_addr" context-register-addr) (* unsigned-long) (context (* os-context-t)) (index int)) @@ -87,19 +88,22 @@ ;;; (Are they used in anything time-critical, or just the debugger?) (defun context-register (context index) (declare (type (alien (* os-context-t)) context)) - (deref (context-register-addr context index))) + (deref (the (alien (* unsigned-long)) + (context-register-addr context index)))) (defun %set-context-register (context index new) -(declare (type (alien (* os-context-t)) context)) -(setf (deref (context-register-addr context index)) - new)) + (declare (type (alien (* os-context-t)) context)) + (setf (deref (the (alien (* unsigned-long)) + (context-register-addr context index))) + new)) ;;; This is like CONTEXT-REGISTER, but returns the value of a float ;;; register. FORMAT is the type of float to return. ;;; FIXME: Whether COERCE actually knows how to make a float out of a ;;; long is another question. This stuff still needs testing. -(def-alien-routine ("os_context_fpregister_addr" context-float-register-addr) +(define-alien-routine ("os_context_fpregister_addr" + context-float-register-addr) (* long) (context (* os-context-t)) (index int)) @@ -133,7 +137,7 @@ 0) -;;;; INTERNAL-ERROR-ARGUMENTS +;;;; INTERNAL-ERROR-ARGS ;;; Given a (POSIX) signal context, extract the internal error ;;; arguments from the instruction stream. This is e.g. @@ -143,9 +147,8 @@ ;;; (pc) ;;; (example from undefined_tramp: "(gdb) x/40ub 0x10148" for yourself ;;; to replicate) -(defun internal-error-arguments (context) +(defun internal-error-args (context) (declare (type (alien (* os-context-t)) context)) - (sb!int::/show0 "entering INTERNAL-ERROR-ARGUMENTS") (let ((pc (context-pc context))) (declare (type system-area-pointer pc)) ;; pc is a SAP pointing at - or actually, shortly after - @@ -154,10 +157,9 @@ (vector (make-array length :element-type '(unsigned-byte 8)))) (declare (type (unsigned-byte 8) length) (type (simple-array (unsigned-byte 8) (*)) vector)) - (copy-from-system-area pc (* sb!vm:byte-bits 5) - vector (* sb!vm:word-bits - sb!vm:vector-data-offset) - (* length sb!vm:byte-bits)) + (copy-from-system-area pc (* n-byte-bits 5) + vector (* n-word-bits vector-data-offset) + (* length n-byte-bits)) (let* ((index 0) (error-number (sb!c::read-var-integer vector index))) (collect ((sc-offsets)) @@ -169,9 +171,10 @@ ;;; The loader uses this to convert alien names to the form they ;;; occure in the symbol table (for example, prepending an -;;; underscore). On the Alpha we don't do anything. +;;; underscore). (defun extern-alien-name (name) (declare (type simple-base-string name)) + ;; On the Alpha we don't do anything. name) ;;;; Do whatever is necessary to make the given code component