Exception Handling with a "bad" ESP

Felix Nawothnig felix.nawothnig at t-online.de
Fri Jul 22 15:18:31 CDT 2005


Glenn Wurster wrote:
>>Our current DIB implementation is an ugly hack. We need a real DIB 
>>implementation, either as a complete GDI engine in Wine or as an X11 
>>extension.
> But is it the DIB implementation that is really at fault here or is it
> the fact that we are adding extra exceptions and can't be sure what
> the esp will be when they fire, especially since they don't occurr on
> Windows.

Both are - the current DIB implementation wouldn't work without that 
extra exceptions.

The "real" DIB, used for GDI calls, is stored on X side but the DIB 
surface, used for direct access, is stored on Wine side and we need to 
keep them in sync by catching reads / writes to the DIB surface.

We need to get rid of that seperation - either the DIB should be stored 
fully on X side (which would require to add some features to X) or fully 
on Wine side (by implementing a GDI renderer in Wine).

And since we already got a full-flegded rendering engine in X11 we 
already use (and will continue to use unless we wanna drop network 
transparency) I think the right way would be to add the missing features 
to X (which would just be XPixmaps of arbitrary depth as we should be 
able to use SHM for direct memory access).

> As far as I can tell, the problem is that we have extra exceptions
> firing when the application is not expecting them and they would not
> occurr on Windows.  So, the two options are to enforce that Wine never
> throws exceptions other than those that occurr on windows (and I
> suspect people in general do not like this restriction for performance
> reasons) or to fix the exception handler to work in the face of a bad
> ESP.  Perhaps exceptions fired due to wine can use a different stack
> so that they don't rely on an assumed state of the application?

I dunno if that's possible but it would be yet another hack to 
workaround limitations of the current DIB hack (which also has other 
limitations that just *can't* be worked around).

>>Some work has been done on a GDI engine in Wine by Transgaming a couple 
>>of years ago but it wasn't merged. Then, some weeks ago someone 
>>suggested to port the ReactOS GDI engine to Wine.
> Yes, I read that.  The Transgaming engine that was discussed uses
> exceptions to detect when the application modifies a DIB, which is the
> problem we have right now. 

Does it? I see no reason for that...

> I don't know how the ReactOS GDI engine does it.

I'm just talking about the render engine - a "real" GDI implementation 
doesn't need those exceptions (as you can observe on Windows).

Felix



More information about the wine-devel mailing list