PATCH: fixed exception calling problem

Marcus Meissner marcus at jet.franken.de
Fri Oct 28 11:29:03 CDT 2005


Hi,

This fixes bugs with:
err:seh:setup_exception stack overflow 136 bytes in thread 0009 eip 55709639 esp 55b10f78 stack 0x55b10000-0x55c10000

or similar.

GCC was reordering the arguments of EXC_CallHandler which it must not do.

http://bugs.winehq.org/show_bug.cgi?id=2778 is one instance.

The gcc info page recommends __attribute__((used)), so here it is.

Ciao, Marcus

Changelog:
	Make sure the order of arguments of EXC_CallHandler() is not
	changed, some code it calls relies on it.

Index: dlls/ntdll/exception.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/exception.c,v
retrieving revision 1.85
diff -u -r1.85 exception.c
--- dlls/ntdll/exception.c	12 Sep 2005 15:14:07 -0000	1.85
+++ dlls/ntdll/exception.c	28 Oct 2005 16:24:08 -0000
@@ -116,8 +116,15 @@
  * happening during the handler execution.
  * Please do not change the first 4 parameters order in any way - some exceptions handlers
  * rely on Base Pointer (EBP) to have a fixed position related to the exception frame
+ *
+ * The __attribute__((used)) takes care that newer gccs do not reorder the
+ * order of the arguments of this function (they do for static functions).
  */
-static DWORD EXC_CallHandler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECORD *frame,
+static DWORD
+#ifdef __GNUC__
+__attribute__((used))
+#endif
+EXC_CallHandler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECORD *frame,
                               CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher,
                               PEXCEPTION_HANDLER handler, PEXCEPTION_HANDLER nested_handler)
 {



More information about the wine-patches mailing list