summaryrefslogtreecommitdiffstats
path: root/win/tclWin32Dll.c
diff options
context:
space:
mode:
Diffstat (limited to 'win/tclWin32Dll.c')
-rw-r--r--win/tclWin32Dll.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index ac9e8cd..1c029f8 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -9,11 +9,16 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWin32Dll.c,v 1.20 2003/01/16 19:01:59 mdejong Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.21 2003/01/24 08:04:29 mdejong Exp $
*/
#include "tclWinInt.h"
+#if defined(HAVE_NO_ALLOC_DECL)
+void* __cdecl _alloca(size_t size);
+#define alloca _alloca
+#endif /* HAVE_NO_ALLOC_DECL */
+
/*
* The following data structures are used when loading the thunking
* library for execing child processes under Win32s.
@@ -40,6 +45,9 @@ static int platformId; /* Running under NT, or 95/98? */
#ifdef HAVE_NO_SEH
static void *ESP;
static void *EBP;
+static void* HANDLER[2];
+static void* NEW_HANDLER = &(HANDLER[0]);
+static void* OLD_HANDLER = &(HANDLER[1]);
#endif /* HAVE_NO_SEH */
/*
@@ -378,9 +386,12 @@ TclpCheckStackSpace()
"movl %ebp, _EBP");
__asm__ __volatile__ (
- "pushl $__except_checkstackspace_handler" "\n\t"
- "pushl %fs:0" "\n\t"
- "mov %esp, %fs:0");
+ "movl %fs:0, %eax" "\n\t"
+ "movl %eax, _OLD_HANDLER" "\n\t"
+ "movl __except_checkstackspace_handler, %eax" "\n\t"
+ "movl %eax, _NEW_HANDLER" "\n\t"
+ "movl _HANDLER, %eax" "\n\t"
+ "movl %eax, %fs:0");
#else
__try {
#endif /* HAVE_NO_SEH */
@@ -395,9 +406,8 @@ TclpCheckStackSpace()
__asm__ __volatile__ (
"checkstackspace_pop:" "\n\t"
- "mov (%esp), %eax" "\n\t"
- "mov %eax, %fs:0" "\n\t"
- "add $8, %esp");
+ "mov _OLD_HANDLER, %eax" "\n\t"
+ "mov %eax, %fs:0");
#else
} __except (EXCEPTION_EXECUTE_HANDLER) {}
#endif /* HAVE_NO_SEH */
@@ -625,6 +635,9 @@ static void squelch_warnings()
ptr = _except_checkstackspace_handler;
ESP = 0;
EBP = 0;
+ OLD_HANDLER = 0;
+ NEW_HANDLER = 0;
+ HANDLER[0] = 0;
squelch_warnings();
}
#endif /* HAVE_NO_SEH */