Hi,

> First, as already mentioned here, you cannot access %esp from inline
> assembly and hope to have it point to something specific, gcc is free
> to manage the stack however it wants.

The function that does this, EH_prolog, is for binary compatability for VC++ 
compiled apps only, and will never be called by gcc compiled code. So 
accessing a given stack offset is fine (required). EH_prolog is needed by 
every VC program before they'll run, so I'm sending this patch seperately; it 
might take a while to clean up the rest of the exception handling.

For the other (inline asm) cases, the stack is not modified outside the 
context of a single asm block (its always restored to its value at the start 
of the block). This is perfectly acceptable from a gcc point of view; 
modified & then restored regs dont even have to be listed as clobbers (in a 
__volatile__ block, anyway). As you pointed out though, those inlines are 
ugly for other reasons, so they should go away anyhow.

Cheers,
Jon

Changelog:
   * dlls/msvcrt/exception.c
     Jon Griffiths <[EMAIL PROTECTED]>
     - Add binary compatible __EH_prolog

-- 
"Once you realise you're not _meant_ to fit in, it all makes sense..."
[EMAIL PROTECTED] , [EMAIL PROTECTED]
--- wine-cvs/dlls/msvcrt/except.c       Wed Jan 10 23:59:26 2001
+++ wine-new/dlls/msvcrt/except.c       Thu Jan 11 18:58:34 2001
@@ -47,10 +47,24 @@
 /*********************************************************************
  *             _EH_prolog (MSVCRT.@)
  */
+#if !defined(__GNUC__) || !defined(__i386__)
 void __cdecl MSVCRT__EH_prolog(void)
 {
   FIXME("stub\n");
 }
+#else
+/* Provided for VC++ binary compatability only */
+__ASM_GLOBAL_FUNC(MSVCRT__EH_prolog,
+                  "pushl $0xff
+                   pushl %eax
+                   pushl %fs:0
+                   movl  %esp, %fs:0
+                   movl  12(%esp), %eax
+                   movl  %ebp, 12(%esp)
+                   leal  12(%esp), %ebp
+                   pushl %eax
+                   ret");
+#endif
 
 /*********************************************************************
  *             _XcptFilter (MSVCRT.@)

Reply via email to