From: Stas Sergeev <stsp@aknet.ru>
To: Bart Oldeman <bartoldeman@users.sourceforge.net>
Cc: dosemu <linux-msdos@vger.kernel.org>
Subject: Re: freezes when not emulating CPU
Date: Mon, 14 Sep 2009 19:26:08 +0400 [thread overview]
Message-ID: <4AAE6090.5030603@aknet.ru> (raw)
In-Reply-To: <c3d607cc0909140605u476f26c9s41fc22ad38ecd3c7@mail.gmail.com>
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...
next prev parent reply other threads:[~2009-09-14 15:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 10:57 freezes when not emulating CPU (was: MIDI input patch) Stas Sergeev
2009-09-14 13:05 ` Bart Oldeman
2009-09-14 15:26 ` Stas Sergeev [this message]
2009-09-17 20:37 ` freezes when not emulating CPU Samuel Bronson
2009-09-17 21:05 ` Stas Sergeev
2009-09-18 12:49 ` Bart Oldeman
[not found] ` <AE6CA625AD924972A78210F20D55D7BC@kofowork>
2009-09-18 15:25 ` Bart Oldeman
2009-09-18 15:47 ` Gert Koefoed Andersen
2009-09-18 17:27 ` Gert Koefoed Andersen
2009-09-14 17:02 ` freezes when not emulating CPU (was: MIDI input patch) Frank Cox
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=4AAE6090.5030603@aknet.ru \
--to=stsp@aknet.ru \
--cc=bartoldeman@users.sourceforge.net \
--cc=linux-msdos@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