https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289232

--- Comment #3 from Dave Rivers <[email protected]> ---
Tracked this down to the 'npx.c' driver in i386 sys/i386/isa.  It uses
an fpetable[] to provide 128 combinations of floating pt bits from
the x87 status register.  The combination of bits provides an integer
from 0-127 to index the table.

The combination for underflow+imprecise is at offset 0x30 in the table,
which correctly indicates that FPE_FLTUND is returned to store into si_code,
but that clearly isn't happening.   A combination of bit #6 (the FP_X_IMP
bit) and bit #5 (the FP_X_OFL, FP_X_UFL) bit) does result in a value of
0x30.

The indexing of fpetable[] is this line in the npxtrap() function:

   fpetable[status & ((~control & 0x3f) | 0x40)])

(control contains the bits from the control register, and we can't ignore the
stack underflow/overflow flag which is where the 0x40 comes from.)

This same code appears in amd64/amd64/fpu.c.

So - I'm not sure what is happening?  The code -appears- correct?  The x87
status register must have a different value than 0x30?

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to