Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits:
-
6e8d4939
by Raymond Toy at 2024-08-28T07:32:02-07:00
-
72af1c16
by Raymond Toy at 2024-08-28T08:38:53-07:00
-
90b41bd3
by Raymond Toy at 2024-08-28T08:44:46-07:00
1 changed file:
Changes:
... | ... | @@ -92,7 +92,7 @@ |
92 | 92 | (setf (x87-floating-point-modes) x87-modes)))
|
93 | 93 | )
|
94 | 94 | |
95 | -#+(and sse2 (not darwin))
|
|
95 | +#+(and sse2 (not (or solaris darwin)))
|
|
96 | 96 | (progn
|
97 | 97 | (defun floating-point-modes ()
|
98 | 98 | ;; Combine the modes from the FPU and SSE2 units. Since the sse
|
... | ... | @@ -126,7 +126,10 @@ |
126 | 126 | new-mode)
|
127 | 127 | )
|
128 | 128 | |
129 | -#+(and sse2 darwin)
|
|
129 | +;; For Darwin and Solaris/x86, only diddle the SSE2 mode bits. Darwin
|
|
130 | +;; doesn't use x87. Not sure about Solaris/x86, but this works better
|
|
131 | +;; than mixing the x87 and sse2 mode bits.
|
|
132 | +#+(and sse2 (or solaris darwin))
|
|
130 | 133 | (progn
|
131 | 134 | (defun floating-point-modes ()
|
132 | 135 | ;; Get just the SSE2 mode bits.
|
... | ... | @@ -456,6 +459,9 @@ |
456 | 459 | (defconstant +fpe-fltden+ 9
|
457 | 460 | "Signal code for FP denormalize"))
|
458 | 461 | |
462 | +;; SIGFPE handler for Solaris/x86. For this OS, the CODE contains the
|
|
463 | +;; information about what caused the SIGFPE signal, so use that to
|
|
464 | +;; determine the reason for the SIGFPE.
|
|
459 | 465 | #+(and solaris x86)
|
460 | 466 | (defun sigfpe-handler (signal code scp)
|
461 | 467 | (declare (ignore signal)
|
... | ... | @@ -477,28 +483,28 @@ |
477 | 483 | ;; from the signal handler so the sigcontext is never restored.
|
478 | 484 | ;; This means we need to restore the fpu state ourselves.
|
479 | 485 | (unwind-protect
|
480 | - (case code
|
|
481 | - (+fpe-fltdiv+
|
|
486 | + (cond
|
|
487 | + ((= code +fpe-fltdiv+)
|
|
482 | 488 | (error 'division-by-zero
|
483 | 489 | :operation fop
|
484 | 490 | :operands operands))
|
485 | - (+fpe-fltovf+
|
|
491 | + ((= code +fpe-fltovf+)
|
|
486 | 492 | (error 'floating-point-overflow
|
487 | 493 | :operation fop
|
488 | 494 | :operands operands))
|
489 | - (+fpe-fltund+
|
|
495 | + ((= code +fpe-fltund+)
|
|
490 | 496 | (error 'floating-point-underflow
|
491 | 497 | :operation fop
|
492 | 498 | :operands operands))
|
493 | - (+fpe-fltres+
|
|
499 | + ((= code +fpe-fltres+)
|
|
494 | 500 | (error 'floating-point-inexact
|
495 | 501 | :operation fop
|
496 | 502 | :operands operands))
|
497 | - (+fpe-fltinv+
|
|
503 | + ((= code +fpe-fltinv+)
|
|
498 | 504 | (error 'floating-point-invalid-operation
|
499 | 505 | :operation fop
|
500 | 506 | :operands operands))
|
501 | - (+fpe-fltden+
|
|
507 | + ((= code +fpe-fltden+)
|
|
502 | 508 | (error 'floating-point-denormal-operand
|
503 | 509 | :operation fop
|
504 | 510 | :operands operands))
|