strange interaction between signal and used_math

Peter.Vaneynde (s950045@uia.ua.ac.be)
Fri, 17 Jan 1997 15:25:24 +0100 (MET)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--0-1793488779-853511124=:1256
Content-Type: TEXT/PLAIN; charset=US-ASCII

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
cw.

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?

if(current->used_math)
__asm__("frstor %0": :"m" (current->tss.i387));
else
{
/*
* Our first FPU usage, clean the chip.
*/
__asm__("fninit");
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 s950045@hipe.uia.ac.be 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>+++**@

--0-1793488779-853511124=:1256 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="t.c" Content-Transfer-Encoding: BASE64 Content-ID: <Pine.OSF.3.93.970117152524.1256F@hhipe.uia.ac.be> Content-Description:

I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5j bHVkZSA8bWF0aC5oPg0KI2luY2x1ZGUgPHNpZ25hbC5oPg0KI2luY2x1ZGUg PGkzODYvZnB1X2NvbnRyb2wuaD4NCg0KaW50IGluX2hhbmRsZXI9MDsNCg0K dm9pZCBoYW5kbGVyKHZvaWQpDQp7DQogIGluX2hhbmRsZXIgPSBfX2dldGZw dWN3KCk7DQp9DQoNCg0KaW50IG1haW4oaW50IGFyZ2MsY2hhciAqYXJndltd KQ0Kew0KICBfX3NldGZwdWN3KDB4MTM3MCk7DQogIHNpZ25hbChTSUdBTFJN LCZoYW5kbGVyKTsNCiAgYWxhcm0oNSk7DQogIHByaW50ZigiYWxhcm0gaW4g NSBzZWNzLi4uXG4iKTsNCiAgZm9yKDs7KQ0KICAgIHsNCiAgICAgIHNsZWVw KDIpOw0KICAgICAgcHJpbnRmKCJtYWluOiAleCBoYW5kbGVyOiAleFxuIixf X2dldGZwdWN3KCksaW5faGFuZGxlcik7DQogICAgfQ0KfQ0K --0-1793488779-853511124=:1256--