[Pkg-phototools-devel] Bug#788102: The code doesn't compile on kfreebsd

Steven Chamberlain steven at pyro.eu.org
Tue Feb 23 04:17:26 UTC 2016


Hi,

Mathieu Malaterre wrote:
> Steven Chamberlain <steven at pyro.eu.org> wrote:
> > Gianfranco Costamagna wrote:
> >> file.c:5:38: error: ‘mcontext_t’ has no member named ‘fpregs’
> >> uint32_t mxcsr = ucon.uc_mcontext.fpregs->mxcsr;
> >
> > FreeBSD doesn't seem to have fpregs in mcontext_t or sigcontext.
> > But I think mc_fpstate might be the same thing;  but that isn't
> > implemented as a struct...
> 
> Correct. Looks like other are handling it this way also
> https://github.com/fukamachi/clozure-cl/blob/master/level-1/x86-trap-support.lisp

For future reference, I came up with this alternate implementation of
restoreControlRegs() for kFreeBSD (untested, except it builds and passes
the testsuite):

#include <machine/npx.h>

inline void
restoreControlRegs (const ucontext_t & ucon, bool clearExceptions)
{
    struct envxmm *ex = (struct envxmm *)(ucon.uc_mcontext.mc_fpstate);
    setCw ((ex->en_cw & cwRestoreMask) | cwRestoreVal);
    setMxcsr (ex->en_mxcsr, clearExceptions);
}

Regards,
-- 
Steven Chamberlain
steven at pyro.eu.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-phototools-devel/attachments/20160223/96c3df3b/attachment.sig>


More information about the Pkg-phototools-devel mailing list