Monday, March 27, 2006, 12:51:03 AM, Petr Tesarik wrote:
Hi,
this patch fixes a bug in get_thread_context(). Currently, this routine assumes that all registers except debug registers are saved in
thread->>context if it exists. However, it does not include FPU
registers.
IMO, we should not blindly assume which registers are present in
thread->>context but look at ContextFlags.
BTW I found this bug when winedbg stopped working with programs using the FPU.
ChangeLog:
- Look at ContextFlags to see which registers are saved in thread->context.
Sorry this is not correct. Exception handler should get full context including FPU context. If we not saving it that's the problem on the other end.
Vitaliy Margolen
Dne 03/27/06 v 08:03:58 (-0700), Vitaliy Margolen napsal(a):
Monday, March 27, 2006, 12:51:03 AM, Petr Tesarik wrote:
Hi,
this patch fixes a bug in get_thread_context(). Currently, this routine assumes that all registers except debug registers are saved in
thread->>context if it exists. However, it does not include FPU
registers.
IMO, we should not blindly assume which registers are present in
thread->>context but look at ContextFlags.
BTW I found this bug when winedbg stopped working with programs using the FPU.
ChangeLog:
- Look at ContextFlags to see which registers are saved in thread->context.
Sorry this is not correct. Exception handler should get full context including FPU context. If we not saving it that's the problem on the other end.
I don't think so. A real 80386 without a math coprocessor does not even have an FPU context. I guess this is why CONTEXT_FULL does not include CONTEXT_FLOATING_POINT.
Petr Tesarik
Dne 03/27/06 v 17:19:47 (+0200), Petr Tesarik napsal(a):
Dne 03/27/06 v 08:03:58 (-0700), Vitaliy Margolen napsal(a):
Monday, March 27, 2006, 12:51:03 AM, Petr Tesarik wrote:
[skip]
- Look at ContextFlags to see which registers are saved in thread->context.
Sorry this is not correct. Exception handler should get full context including FPU context. If we not saving it that's the problem on the other end.
I don't think so. A real 80386 without a math coprocessor does not even have an FPU context. I guess this is why CONTEXT_FULL does not include CONTEXT_FLOATING_POINT.
As I'm re-thinking it once more, I'm no longer sure about my point. You're right that the signal handler must definitely save the FPU state if there is one. Otherwise, it can't restore the context correctly if the exception handler uses the FPU (which it is AFAIK allowed to do). And at least under Linux, there is always an FPU state (either from a real FPU, or emulated).
So, I'll change my question: Is there a platform, where FPU instructions can't be invoked unless there is a real FPU?
To kick the answers off, I'm providing a table of possible operating systems we run on the x86 architecture. Whoever knows for sure that floating point instructions can or can not be safely run even without a real (hardware) FPU, please help complete the chart. Also, feel free to add any other systems which can run Wine.
Linux: OK FreeBSD: ??? NetBSD: ??? OpenBSD: ??? Solaris: ??? OS/X: ???
Petr Tesarik