Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/code/float-trap.lisp
    ... ... @@ -483,15 +483,20 @@
    483 483
     (defun sigfpe-handler (signal code scp)
    
    484 484
       (declare (ignore signal)
    
    485 485
     	   (type system-area-pointer scp))
    
    486
    +  (format t "***Enter Handler***~%")
    
    486 487
       (let* ((modes (sigcontext-floating-point-modes
    
    487
    -		 (alien:sap-alien scp (* unix:sigcontext)))))
    
    488
    +		 (alien:sap-alien scp (* unix:sigcontext))))
    
    489
    +	 (sigcontext-x87-modes (sigcontext-floating-point-modes-x87
    
    490
    +				(alien:sap-alien scp (* unix:sigcontext))))
    
    491
    +	 (sigcontext-sse2-modes (sigcontext-floating-point-modes-sse2
    
    492
    +				 (alien:sap-alien scp (* unix:sigcontext))))
    
    493
    +	 (current-x87-modes (vm::x87-floating-point-modes))
    
    494
    +	 (current-sse2-modes (vm::sse2-floating-point-modes)))
    
    488 495
         (format t "Current modes:         ~32,'0b~%" modes)
    
    489
    -    (format t "sigcontext x87:        ~32,'0b~%"
    
    490
    -	    (sigcontext-floating-point-modes-x87
    
    491
    -	     (alien:sap-alien scp (* unix:sigcontext))))
    
    492
    -    (format t "sigcontext sse2:       ~32,'0b~%"
    
    493
    -	    (sigcontext-floating-point-modes-sse2
    
    494
    -	     (alien:sap-alien scp (* unix:sigcontext))))
    
    496
    +    (format t "Current HW x87 modes:  ~32,'0b~%" current-x87-modes)
    
    497
    +    (format t "Current HW sse2 modes: ~32,'0b~%" current-sse2-modes)
    
    498
    +    (format t "sigcontext x87:        ~32,'0b~%" sigcontext-x87-modes)
    
    499
    +    (format t "sigcontext sse2:       ~32,'0b~%" sigcontext-sse2-modes)
    
    495 500
     
    
    496 501
         (multiple-value-bind (fop operands)
    
    497 502
     	(let ((sym (find-symbol "GET-FP-OPERANDS" "VM")))
    
    ... ... @@ -515,38 +520,47 @@
    515 520
     	;;
    
    516 521
     	;; Clear out the status for any enabled traps.  If we don't
    
    517 522
     	;; then when we return, the exception gets signaled again.
    
    518
    -	#+nil
    
    523
    +	;;#+nil
    
    519 524
     	(let* ((trap-bit (third (assoc code +fpe-code-info-alist+)))
    
    520
    -	       (current-x87-modes (vm::x87-floating-point-modes))
    
    521
    -	       (current-sse2-modes (vm::sse2-floating-point-modes))
    
    522 525
     	       (new-x87-modes
    
    523
    -		(dpb (logandc2 (ldb float-exceptions-byte current-sse2-modes)
    
    524
    -			       trap-bit)
    
    525
    -		     float-exceptions-byte current-sse2-modes))
    
    526
    +		(logandc2 current-x87-modes trap-bit))
    
    526 527
     	       (new-sse2-modes
    
    527
    -		(dpb (logandc2 (ldb float-exceptions-byte current-x87-modes)
    
    528
    -			       trap-bit)
    
    529
    -		     float-exceptions-byte current-x87-modes)))
    
    528
    +		(logandc2 current-sse2-modes trap-bit)))
    
    529
    +	  (format t "***Cleanup***~%")
    
    530 530
     	  (format t "Trap bit: ~D~%" trap-bit)
    
    531 531
     	  (format t "Current modes:         ~32,'0b~%" (vm::floating-point-modes))
    
    532
    -	  (format t "Current x87 modes:     ~32,'0b~%" current-x87-modes)
    
    533
    -	  (format t "Current sse2 modes:    ~32,'0b~%" current-sse2-modes)
    
    534
    -	  (format t "Setting sse2 modes to: ~32,'0b~%" new-x87-modes)
    
    535
    -	  (format t "Setting x87 modes to:  ~32,'0b~%" new-sse2-modes)
    
    532
    +	  (format t "Current HW x87 modes:  ~32,'0b~%" current-x87-modes)
    
    533
    +	  (format t "Current HW sse2 modes: ~32,'0b~%" current-sse2-modes)
    
    534
    +	  (format t "New x87 modes:         ~32,'0b~%" new-x87-modes)
    
    535
    +	  (format t "New sse2 modes:        ~32,'0b~%" new-sse2-modes)
    
    536 536
     	  (ignore-errors
    
    537
    -	    (setf (vm::sse2-floating-point-modes) new-sse2-modes)
    
    538
    -	    (setf (vm::x87-floating-point-modes) new-x87-modes))
    
    537
    +	   (format t "Setting new sse2 modes~%")
    
    538
    +	   (let ((new-context (logandc2 sigcontext-sse2-modes trap-bit)))
    
    539
    +	     (format t "New sse2 sigcontext:   ~32,'0b~%" new-context)
    
    540
    +	     (setf (vm::sse2-floating-point-modes) new-sse2-modes)
    
    541
    +	     (%set-sigcontext-floating-point-modes-sse2
    
    542
    +	      (alien:sap-alien scp (* unix:sigcontext))
    
    543
    +	      new-context)))
    
    544
    +	  (ignore-errors
    
    545
    +	    (format t "Setting new x87 modes~%")
    
    546
    +	    (let ((new-context (logandc2 sigcontext-x87-modes trap-bit)))
    
    547
    +	      (format t "New x87 sigcontext:    ~32,'0b~%" new-context)
    
    548
    +	      (setf (vm::x87-floating-point-modes) new-x87-modes)
    
    549
    +	      (%set-sigcontext-floating-point-modes-x87
    
    550
    +	       (alien:sap-alien scp (* unix:sigcontext))
    
    551
    +	       new-context)))
    
    539 552
     
    
    540 553
     	  (format t "new x87 modes:         ~32,'0b~%" (vm::x87-floating-point-modes))
    
    541 554
     	  (format t "new sse2 modes:        ~32,'0b~%" (vm::sse2-floating-point-modes)))
    
    555
    +	#+nil
    
    542 556
     	(let* ((trap-bit (third (assoc code +fpe-code-info-alist+)))
    
    543 557
     	       (x87-modes (sigcontext-floating-point-modes-x87
    
    544 558
     			   (alien:sap-alien scp (* unix:sigcontext))))
    
    545 559
     	       (sse2-modes (sigcontext-floating-point-modes-sse2
    
    546 560
     			    (alien:sap-alien scp (* unix:sigcontext)))))
    
    547 561
     	  (format t "Trap bit: ~D~%" trap-bit)
    
    548
    -	  (format t "New sigcontext x87:    ~32,'0b~%" (logandc2 x87-modes trap-bit))
    
    549
    -	  (format t "New sigcontext sse2:   ~32,'0b~%" (logandc2 sse2-modes trap-bit))
    
    562
    +	  (format t "New sigcontext x87:     ~32,'0b~%" (logandc2 x87-modes trap-bit))
    
    563
    +	  (format t "New sigcontext sse2:    ~32,'0b~%" (logandc2 sse2-modes trap-bit))
    
    550 564
     	  (%set-sigcontext-floating-point-modes-x87
    
    551 565
     	   (alien:sap-alien scp (* unix:sigcontext))
    
    552 566
     	   (logandc2 x87-modes trap-bit))
    

  • src/lisp/elf.c
    ... ... @@ -18,6 +18,7 @@
    18 18
     #include <fcntl.h>
    
    19 19
     #include <sys/types.h>
    
    20 20
     #include <unistd.h>
    
    21
    +#include <limits.h>
    
    21 22
     
    
    22 23
     #include "os.h"
    
    23 24
     #include "core.h"