Closed Bug 538339 Opened 10 years ago Closed 10 years ago

In fpehandler() mask cw and back to the faulting x87 instruction on Solaris

Categories

(Core :: General, defect)

x86
Solaris
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: ginnchen+exoracle, Assigned: ginnchen+exoracle)

References

Details

Attachments

(1 file, 1 obsolete file)

See "Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 1":
8.7.3    Handling x87 FPU Exceptions in Software

If the faulting floating-point instruction is followed by one or more
non-floating-point instructions, it may not be useful to re-execute the
faulting instruction. See Section 8.6, “x87 FPU Exception Synchronization,” for
more information on synchronizing floating-point exceptions.

In cases where the handler needs to restart program execution with the faulting
instruction, the IRET instruction cannot be used directly. The reason for this
is that because the exception is not generated until the next floating-point or
WAIT/FWAIT instruction following the faulting floating-point instruction, the
return instruction pointer on the stack may not point to the faulting
instruction. To restart program execution at the faulting instruction, the
exception handler must obtain a pointer to the instruction from the saved x87
FPU state information, load it into the return instruction pointer location on
the stack, and then execute the IRET instruction.

--------
We need to go back the faulting instruction, otherwise the instruction is not executed.
e.g.
0.0 * HUGE_VAL will return 0.0 if FPE is on, it will return NAN if FPE is off.
HUGE_VAL * 0.0 will return Inf is FPE is on, it will return NAN if FPE is off.

It is important for Solaris because Solaris math libraries uses 0.0 * HUGE_VAL to get IEEE compliant values.
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → ginn.chen
Status: NEW → ASSIGNED
Attachment #420508 - Flags: review?(gal)
Comment on attachment 420508 [details] [diff] [review]
patch

There is a typo in the last hunk (dfined).
Attached patch patchSplinter Review
fix the typo

BTW: the patch contains the fix for Bug 538338, because fpchip_state.state[3] is nothing if it is an integer exception.
Attachment #420508 - Attachment is obsolete: true
Attachment #420516 - Flags: review?(gal)
Attachment #420508 - Flags: review?(gal)
Attachment #420516 - Flags: review?(gal) → review+
Attachment #420516 - Flags: review?(benjamin)
Attachment #420516 - Flags: review?(benjamin) → review+
http://hg.mozilla.org/mozilla-central/rev/8f38c5ae4aab
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.