wine/dlls/ntdll signal_i386.c exception.c
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Nov 1 03:21:03 CST 2005
ChangeSet ID: 21010
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/01 03:21:03
Modified files:
dlls/ntdll : signal_i386.c exception.c
Log message:
Robert Shearman <rob at codeweavers.com>
Make the call exception handler function more compatible with NT and
with what Shrinker expects.
Patch: http://cvs.winehq.org/patch.py?id=21010
Old revision New revision Changes Path
1.101 1.102 +37 -22 wine/dlls/ntdll/signal_i386.c
1.86 1.87 +0 -2 wine/dlls/ntdll/exception.c
Index: wine/dlls/ntdll/signal_i386.c
diff -u -p wine/dlls/ntdll/signal_i386.c:1.101 wine/dlls/ntdll/signal_i386.c:1.102
--- wine/dlls/ntdll/signal_i386.c 1 Nov 2005 9:21: 3 -0000
+++ /dev/null 1 Nov 2005 9:21: 3 -0000
@@ -1387,33 +1387,48 @@ __ASM_GLOBAL_FUNC( DbgUserBreakPoint, "i
/**********************************************************************
* EXC_CallHandler (internal)
+ *
+ * Some exception handlers depend on EBP to have a fixed position relative to
+ * the exception frame.
+ * Shrinker depends on (*1) doing what it does,
+ * (*2) being the exact instruction it is and (*3) beginning with 0x64
+ * (i.e. the %fs prefix to the movl instruction). It also depends on the
+ * function calling the handler having only 5 parameters (*4).
*/
__ASM_GLOBAL_FUNC( EXC_CallHandler,
" pushl %ebp\n"
" movl %esp, %ebp\n"
-" subl $12, %esp\n"
-" movl 28(%ebp), %eax\n"
-" movl 12(%ebp), %edx\n"
-" movl %eax, -8(%ebp)\n"
-" movl %edx, -4(%ebp)\n"
-" leal -12(%ebp), %eax\n"
-" .byte 0x64\n"
-" movl (0),%ecx\n"
-" movl %ecx,(%eax)\n"
-" .byte 0x64\n"
-" movl %eax,(0)\n"
-" movl 20(%ebp), %eax\n"
-" pushl %eax\n"
-" movl 16(%ebp), %eax\n"
-" pushl %eax\n"
-" movl 8(%ebp), %eax\n"
-" pushl %edx\n"
-" pushl %eax\n"
-" call *24(%ebp)\n"
-" movl -12(%ebp), %edx\n"
-" .byte 0x64\n"
-" movl %edx,(0)\n"
+" movl 28(%ebp), %edx\n" /* ugly hack to pass the 6th param needed because of Shrinker */
+" pushl 24(%ebp)\n"
+" pushl 20(%ebp)\n"
+" pushl 16(%ebp)\n"
+" pushl 12(%ebp)\n"
+" pushl 8(%ebp)\n"
+" call call_exception_handler\n"
" leave\n"
" ret\n"
);
+__ASM_GLOBAL_FUNC(call_exception_handler,
+" pushl %ebp\n"
+" movl %esp, %ebp\n"
+" pushl 12(%ebp)\n" /* make any exceptions in this... */
+" pushl %edx\n" /* handler be handled by... */
+" .byte 0x64\n"
+" pushl (0)\n" /* nested_handler (passed in edx). */
+" .byte 0x64\n"
+" movl %esp,(0)\n" /* push the new exception frame onto the exception stack. */
+" pushl 20(%ebp)\n"
+" pushl 16(%ebp)\n"
+" pushl 12(%ebp)\n"
+" pushl 8(%ebp)\n"
+" movl 24(%ebp), %ecx\n" /* (*1) */
+" call *%ecx\n" /* call handler. (*2) */
+" .byte 0x64\n"
+" movl (0), %esp\n" /* restore previous... (*3) */
+" .byte 0x64\n"
+" popl (0)\n" /* exception frame. */
+" movl %ebp, %esp\n" /* restore saved stack, in case it was corrupted */
+" popl %ebp\n"
+" ret $20\n" /* (*4) */
+);
#endif /* __i386__ */
Index: wine/dlls/ntdll/exception.c
diff -u -p wine/dlls/ntdll/exception.c:1.86 wine/dlls/ntdll/exception.c:1.87
--- wine/dlls/ntdll/exception.c 1 Nov 2005 9:21: 3 -0000
+++ /dev/null 1 Nov 2005 9:21: 3 -0000
@@ -114,8 +114,6 @@ static DWORD EXC_UnwindHandler( EXCEPTIO
*
* Call an exception handler, setting up an exception frame to catch exceptions
* 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
*
* For i386 this function is implemented in assembler in signal_i386.c.
*/
More information about the wine-cvs
mailing list