[Top][All Lists]

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

Re: [Gcl-devel] [Maxima] Out of range floating point number determinatio

From: Raymond Toy
Subject: Re: [Gcl-devel] [Maxima] Out of range floating point number determination
Date: Thu, 25 Oct 2012 10:24:22 -0700
User-agent: Gnus/5.101 (Gnus v5.10.10) XEmacs/21.5-b32 (linux)

>>>>> "Camm" == Camm Maguire <address@hidden> writes:

    Camm> I've got something working for the x87, but as far as I can see, there
    Camm> is no pertinent sse information passed in ucontext_t to the sighandler
    Camm> (e.g. like the fpregs for the x87).  Furthermore, the chip does not 
    Camm> the fop or fooff regs at point of sse exception.  Yet the sigaction
    Camm> wipes the xmm registers before proceeding to the handler.  All that
    Camm> appears left in the handler is the fault address, from which one might
    Camm> decode the faulting instruction.  Even the si_code field does not 
    Camm> set consistently with the x87 FPU case.

Did I ever answer this?  If not, sorry for the delay!

Anyway, it seems that on my Ubuntu system, the ucontext must contain
the xmm registers because that's how cmucl grabs the values to print
when handling an arithmetic-error, and the values are correctly
printed, as far as I know.

Don't know about the value fop or foff regs.  But as I understand it,
the sse instructions signal exceptions at the offending instruction,
unlike x87 where the exception is signaled at the *next* x87
instruction.  Hence, you need the fop and fooff regs to tell you what
the offending instruction actually is.  I think; I haven't looked at
that stuff in decades, probably.

In any case, here is how cmucl grabs the sse values:

unsigned char *
os_sigcontext_fpu_reg(ucontext_t *scp, int offset)
    fpregset_t fpregs = scp->uc_mcontext.fpregs;
    unsigned char *reg = NULL;
    if (fpregs) {
        if (offset < 8) {
            reg = (unsigned char *) &fpregs->_st[offset];
        else {
            struct _fpstate *fpstate;
            fpstate = (struct _fpstate*) scp->uc_mcontext.fpregs;
            if (fpstate->magic != 0xffff) {
                reg = (unsigned char *) &fpstate->_xmm[offset - 8];
    return reg;

Note that on cmucl, the offset arg above is 0-7 for the x87 registers
and 8+ for the xmm registers.  8 corresponds to xmm0.

Hope this helps a little,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]