- (setf (deref (context-register-addr context index)
- #!-little-endian 1
- #!+little-endian 0)
- new))
-
-#!+linux
-;;; For now.
-(defun context-floating-point-modes (context)
- (declare (ignore context))
- (warn "stub CONTEXT-FLOATING-POINT-MODES")
- 0)
+ (let ((addr (context-register-addr context index)))
+ (declare (type (alien (* os-context-register-t)) addr))
+ (setf (deref addr) 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.
+(define-alien-routine ("os_context_fpregister_addr" context-float-register-addr)
+ (* os-context-register-t)
+ (context (* os-context-t))
+ (index int))
+
+(defun context-float-register (context index format)
+ (declare (type (alien (* os-context-t)) context))
+ (let ((addr (context-float-register-addr context index)))
+ (declare (type (alien (* os-context-register-t)) addr))
+ (coerce (deref addr) format)))
+
+(defun %set-context-float-register (context index format new)
+ (declare (type (alien (* os-context-t)) context))
+ (let ((addr (context-float-register-addr context index)))
+ (declare (type (alien (* os-context-register-t)) addr))
+ (setf (deref addr) (coerce new format))))
+
+;;; Given a signal context, return the floating point modes word in
+;;; the same format as returned by FLOATING-POINT-MODES.
+(define-alien-routine ("os_context_fp_control" context-floating-point-modes)
+ unsigned-int
+ (context (* os-context-t)))