public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tonnerre <tonnerre@thundrix.ch>
To: linux-kernel@vger.kernel.org
Subject: Re: [2.6.8.1/x86] The kernel is _always_ compiled with -msoft-float
Date: Wed, 15 Sep 2004 17:35:28 +0200	[thread overview]
Message-ID: <20040915153528.GE24818@thundrix.ch> (raw)
In-Reply-To: <20040915021418.A1621@natasha.ward.six>

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

Salut,

On Wed, Sep 15, 2004 at 02:14:18AM +0600, Denis Zaitsev wrote:
> Why this kernel is always compiled with the FP emulation for x86?
> This is the line from the beginning of arch/i386/Makefile:
> 
> CFLAGS += -pipe -msoft-float
> 
> And it's hardcoded, it does not depend on CONFIG_MATH_EMULATION.  So,
> is this just a typo or not?

The problem  is that  the kernel can't  use the  FPU. I think  this is
because  its context  is  not  saved on  context  switch (userland  ->
kernel),  so  we'd end  up  messing up  the  FPU  state, and  userland
applications  would get  silly results  for calculations  with context
switches in between.

Thus  we force gcc  to use  the library  functions for  floating point
arith, and  since we  don't link  against gcc's lib,  FPU users  get a
fancy linker error.

If  you want to  use floating  point arith  inside the  kernel, you're
probably wrong wanting it. If you really need it, you can

a) emulate it using fixed-point math on unsigned long or
b) manually save the FPU state, load your operations into it, operate,
   get the results and restore the FPU state.

I have yet to see someone  who really needs to do floating point maths
inside the kernel.

			    Tonnerre

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-09-15 15:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-14 20:14 [2.6.8.1/x86] The kernel is _always_ compiled with -msoft-float Denis Zaitsev
2004-09-14 19:36 ` Alan Cox
2004-09-14 20:39 ` Brian Gerst
2004-09-14 20:40 ` Arjan van de Ven
2004-09-14 20:45 ` Dave Jones
2004-09-14 20:48 ` Matt Mackall
2004-09-14 21:39 ` Denis Zaitsev
2004-09-15 15:35 ` Tonnerre [this message]
2004-09-15 15:51   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040915153528.GE24818@thundrix.ch \
    --to=tonnerre@thundrix.ch \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox