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

Re: FreeBSD C lib : FPU usage




Yves Martin <ymartin@ensisun.imag.fr> writes:
>         I'm using i386 task switching features
>   with OSKit network devices, which need freebsd_c
>   library.
>   
>   But something calls 'setjmp' and the freebsd_c
>   'setjmp' uses this FPU instruction :
> [snip]

I guess the freebsd c library is intended to be used by user-level
code where this isn't an issue.

We do have setjmp/longjmp in the minimal C library.  I don't know if
you can just drop it in as a replacement for the freebsd version but
it's worth taking a look and/or trying.

The files to look at seem to be:

  oskit/libc/x86/setjmp.S
and
  oskit/freebsd/3.x/src/lib/libc/i386/gen/_setjmp.S
  oskit/freebsd/3.x/src/lib/libc/i386/gen/setjmp.S
  oskit/freebsd/3.x/src/lib/libc/i386/gen/sigsetjmp.S

My impression (based on a whole 60 seconds of looking at the code) is
that they are equivalent except:

o they store registers in different orders
o the FreeBSD version messes with the FPU
o The FreeBSD version seems to use a larger jmpbuf - the extra
  space seems to be for FPU state.

This means it's probably safe to just link in the minimal libc version
(as long as you make sure that every single use does go to the minimal
libc version) but you'd probably feel a whole lot more comfortable if
you could use the currect jmpbuf size in all uses as well.

I recommend you look at the code and make up your own mind.


--
Alastair Reid        reid@cs.utah.edu        http://www.cs.utah.edu/~reid/

References: