From owner-freebsd-current Thu Jun 11 02:50:22 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA01589 for freebsd-current-outgoing; Thu, 11 Jun 1998 02:50:22 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.15.68.22]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA01487 for ; Thu, 11 Jun 1998 02:50:08 -0700 (PDT) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id TAA31787; Thu, 11 Jun 1998 19:38:42 +1000 Date: Thu, 11 Jun 1998 19:38:42 +1000 From: Bruce Evans Message-Id: <199806110938.TAA31787@godzilla.zeta.org.au> To: current@FreeBSD.ORG, luigi@labinfo.iet.unipi.it Subject: Re: floating point usage within the kernel - howto ? Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >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