[lkml]   [2000]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Question: Using floating point in the kernel
On Thu, 21 Sep 2000, Alan Cox wrote:

> > > > It is sufficient when you do tsk->flags |= PF_USEDFPU first.
> > >
> > > Unless you sleep
> >
> > Unless I'm missing something the lazy FPU state save in the 2.4 switch_to will
> > do the right thing at least on x86. Your kernel FPU state will overwrite the
> > user FPU state in current, but that's ok because it is undefined anyways
> > (and you restore the correct state when you wake up again)
> 2.4 maybe. Im not totally sure on that code. 2.2 wont

If you fire off about 20 copies of this, then execute the X-SERVER,
they will eventually all fail. Takes about 20 minutes on my machine.
I tried to update, but they don't support my screen-card anymore. This
was, I think, their first attempt at MMX stuff.

This is an old X-Server:

XFree86 Version / X Window System
(protocol Version 11, revision 0, vendor release 6300)
Release Date: December 29 1998
If the server is older than 6-12 months, or if your card is newer
than the above date, look for a newer version before reporting
problems. (see http://www.XFree86.Org/FAQ)

Here's the test code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <malloc.h>

#define ARRAY_LEN 0x10000

int main()
double *d0, *d1;
size_t i;
if((d0 = malloc(ARRAY_LEN *sizeof(double))) == NULL)
fprintf(stderr, "Memory allocation error\n");
if((d1 = malloc(ARRAY_LEN *sizeof(double))) == NULL)
fprintf(stderr, "Memory allocation error\n");
for(i=0; i< ARRAY_LEN; i++)
d0[i] = cos((double) (i % 60));
for(i=0; i< ARRAY_LEN; i++)
d1[i] = cos((double) (i % 60));
if(memcmp((char*)d0, (char *)d1, ARRAY_LEN * sizeof(double)))
for(i=0; i< ARRAY_LEN; i++)
if(d0[i] != d1[i]) break;
fprintf(stderr, "Floating point error at offset %u ", i);
fprintf(stderr, "d0[%u]=%f, d1[%u]=%f\n", i, d0[i], i, d1[i]);

Somebody who has RAID or whatever with MMX may want to try this.

Dick Johnson

Penguin : Linux version 2.2.15 on an i686 machine (797.90 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:39    [W:0.026 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site