Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 1998 19:38:42 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        current@FreeBSD.ORG, luigi@labinfo.iet.unipi.it
Subject:   Re: floating point usage within the kernel - howto ?
Message-ID:  <199806110938.TAA31787@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>a local user has a need to do some Floating Point computations within
>the kernel. I think this is not possible without explicitly
>saving&restoring the FP register around the task, is this correct ?
>And if this is true, is there any trick/asm routine to call to do the
>saving & restoring of the registers ?

You don't want to do this.

The usual asm("fnsave ...; fldcw ...") to save the old state and
initialize the new state, and asm("frstor ...") to restore the old
state works in some cases (essentially, if you have a modern i*86 CPU
and don't call any kernel function that already uses floating point).
This is used (with some optimizations) for kernel bcopies on P5's.
General code can't both use the FPU or call bcopy (or bzero) without
breaking the optimizations.  There are more complications and the
same restrictions for copyin() and copyout().  There are different
complications on plain i386's.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806110938.TAA31787>