[lkml]   [1997]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectstrange interaction between signal and used_math
If you run the included program you'll see that he FPU control word gets
reset in a signal handler. The cause of this is the fninit in
math_state_restore(void) in arch/i386/kernel/traps.c. It seams that
used_math isn't set for the signal handler of a process that has set the

I'm unsure what the normal behavior is, but in CMUCL there are no
special cases in the handler (except now for Linux).

Should Linus rubber stamp the current behavior or should the cw be
restored for the signal handler?

__asm__("frstor %0": :"m" (current->tss.i387));
* Our first FPU usage, clean the chip.
This causes the signal handler to lose the cw...
current->used_math = 1;

Groetjes, Peter

It's logic Jim, but not as we know it.
finger for pgp public key.
Version: 3.12
GS/CS/L/C d->? s+:++>+@ a-- C++(+++)>$ ULOS++>++++$ P+>++++ L+++>++++
E>++ W+(--) U++>+++ o>+ K? w--- O>+@ M-? V? PS++ PE(--) Y+ PGP+>++
t++>+++ 5++ X++>+++ R tv b+++>++++ DI++ D++@ G+>++ e++>++++ h!>+ r-@ y>+++**@
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <signal.h>
#include <i386/fpu_control.h>

int in_handler=0;

void handler(void)
in_handler = __getfpucw();

int main(int argc,char *argv[])
printf("alarm in 5 secs...\n");
printf("main: %x handler: %x\n",__getfpucw(),in_handler);
 \ /
  Last update: 2005-03-22 13:38    [W:0.017 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site