Date: Wed, 10 Jun 1998 22:24:46 -0700 From: Mike Smith <mike@smith.net.au> To: Luigi Rizzo <luigi@labinfo.iet.unipi.it> Cc: mike@smith.net.au (Mike Smith), current@FreeBSD.ORG Subject: Re: floating point usage within the kernel - howto ? Message-ID: <199806110524.WAA01035@antipodes.cdrom.com> In-Reply-To: Your message of "Thu, 11 Jun 1998 06:43:08 %2B0200." <199806110443.GAA21849@labinfo.iet.unipi.it>
next in thread | previous 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 > .... > > The simple answer is "don't do it". You might try '-msoft-float' as a > > compiler option, but it'd be better just to come up with a fixed-point > > or manually-coded floating point implementation. > > > > What do they want to do FP in the kernel for anyway? > > they want to run a P-I-D controller (and more generic controllers > if this goes well) to control a few motors, for didactical purposes. > > The used to do the same thing under DOS, by hooking this 'real-time' > task to the timer interrupt. I am trying to push them to use FreeBSD > (and an LKM for this module) so that they can easily access the > controller across the network or via the web, use high level stuff > for visualization, etc. A worthy goal. They're not interested in using a "real" motor controller card? > For sure they can do fixed point, but if i can find a solution for > 'save_fp_regs()/restore_fp_regs()' this might have other uses as well. The problem is mostly just one of dealing with the FP context switch; at the moment it's done in a lazy fashion taking advantage of the trap handler. You'd have to ensure there was an FP context to save into all the time, and deal with taking a fault in the kernel to swap contexts. IMHO, you'd be better of with them using rtprio() and running the control applicaton in user-space, especially if they were previously using the 18Hz timer resolution. It doesn't sound like anything other than the hardware access needs to be in the kernel at all. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com 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?199806110524.WAA01035>