From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stas Sergeev Subject: Re: freezes when not emulating CPU Date: Mon, 14 Sep 2009 19:26:08 +0400 Message-ID: <4AAE6090.5030603@aknet.ru> References: <4AAA2D35.3040309@aknet.ru> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-msdos-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: Bart Oldeman Cc: dosemu Hello. Bart Oldeman wrote: > I've been looking at this. The SIGFPEs don't happen for i386 (default > FP), only for x86-64 or when explicitly compiling with SSE floating > point (using gcc -msse2 -mfpmath=sse). OK, but the point is that I haven't specified these flags by hands, so they might be a default for dosemu right now. So it have to became sse-safe. > The "fnsave" instruction really > re-initializes the FPU (it's documented), I know it does, but the comment I was referring to, also says: --- which is good enough for calling FPU-using routines. --- and that appeared to be false. > but with SSE one needs to > use "fxsave" Hmm, why does'n it use fxsave right now? > and "fninit", and that still doesn't reinitialize the > SIMD part. Adding an "ldmxcsr" instruction solved that problem. I guess this might be a good work-around, at least till they invent yet another FP technique. :) > I still think that a simple FPU environment reset is sufficient, no > need to restore all the registers, because the DOSEMU FPU code is not > interrupted by DOS code. What if the DOS code (by some crazy chance) also uses sse? > The fpu save/restore operations aren't cheap, so perhaps one could > only use them around the sound code instead of for every vm86 call. > Though that could be messy. Indeed - so what was the problem with fninit/ldmxcsr then? Looks like it would load only the control/status word, so that might not be as expensive as the full reload? Also, I think fxrstor doesn't wait for completion, so the careful implementation may not be too expensive. There are also some tricks possible, like, for example, set FPU to something that will SIGFPE on any FP, and initialize it properly in a signal handler, but I guess this would be an overkill. >> Also, I found no docs about this FPU >> init/reset stuff, so everything in this >> patch is just a wild guesses based on >> a look into a bochs code. Have you had a look into that? I only zero out a few fields, I guess more should be re-set on a hardware reset (or via port I/O). I even thought this ought to be entire bzero() except for the few fields with pre-defined values, but it appears not, which I don't quite understand... and found no docs. >> write something meaningfull about SIGFPE >> instead of "Unknown exception". > I've done that now. Any idea why I am not receiving the SF e-mails for a long time now? I thought dosemu is long ago dead, but instead there might just be some problems with the notification messages...