NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-i386/43655 (integer division by zero delivers SIGFPE with wrong siginfo code on i386)

   Date: Fri, 23 Jul 2010 07:44:39 +0000 (UTC)

   arch specific problem

I'm cc'ing port-i386-maintainer because it looks like amd64 has the
same problem, from this snippet in amd64/amd64/trap.c:

                case T_DIVIDE|T_USER:
                        ksi.ksi_code = FPE_FLTDIV;

T_DIVIDE is the code delivered by trap 0 in amd64/amd64/vector.S,
which is the trap for integer division by zero.  I think changing that
and the analogous line in i386/i386/trap.c to use FPE_INTDIV should
fix the problem, but I haven't tested to confirm this.  FPE_FLTDIV is
delivered for floating-point division by zero separately, in
i386/isa/npx.c for i386 and in amd64/amd64/fpu.c for amd64.

Nearby in both trap.c files is FPE_FLTOVF for integer overflow (traps
4 and 5), and, in i386/i386/trap.c, FPE_INTOVF for FPU exceptions
(trap #x10, in what seems to be an unusual case, when NNPX = 0).  This
code needs to exchange some INTs and FLTs, methinks.

Home | Main Index | Thread Index | Old Index