Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 1998 09:05:25 -0700 (PDT)
From:      Julian Elischer <julian@whistle.com>
To:        luigi@labinfo.iet.unipi.it, Bruce Evans <bde@zeta.org.au>
Cc:        current@FreeBSD.ORG
Subject:   Re: floating point usage within the kernel - howto ?
Message-ID:  <Pine.BSF.3.95.980611085904.29233C-100000@current1.whistle.com>
In-Reply-To: <199806110938.TAA31787@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 11 Jun 1998, Bruce Evans wrote:

> >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.

Beware of future MMX optimisations which would use the floating point
registers without you being aware of it..
I agree with Mike

get an example of the calculations that need to be done of every
cycle and the accuracy needed and maybe we can figure out an optimised
fixed-point version. Any calculations that need to be done at a different
timescape (e.g. calibrations etc. shoul dbe done in a user-process, 
possibly running under rtprio. 

the driver should use the aquite_timer0() call to ensure that it's lowest
level routines are called at 1000Hz.

(we do this at various rates, and the pcaudio driver does it at 16000 Hz
so 1000 Hz is no challenge).

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


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?Pine.BSF.3.95.980611085904.29233C-100000>