summaryrefslogtreecommitdiff
path: root/rts/StgCRun.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2011-07-18 13:48:53 +0100
committerSimon Marlow <marlowsd@gmail.com>2011-07-18 15:37:28 +0100
commit81eddb4c58c6d4171a46c727574112e2083c4878 (patch)
tree02c796458e3e8ee2dd0dc13e8de6162624478c35 /rts/StgCRun.c
parent6d8c5ae8de842b9461551b113b8a2b59b9736ba2 (diff)
downloadhaskell-81eddb4c58c6d4171a46c727574112e2083c4878.tar.gz
Fix Windows breakage (#5322). When I modified StgRun to use the pure
assembly version as part of the fix for #5250, we inadvertently lost the Windows magic for extending the stack. Win32 requires that the stack is extended a page at a time, otherwise you get a segfault. The C compiler knows how to do this, so we now call a C stub to ensure there's enough stack space at each invocation of the scheduler.
Diffstat (limited to 'rts/StgCRun.c')
-rw-r--r--rts/StgCRun.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/rts/StgCRun.c b/rts/StgCRun.c
index 54ac04151c..69d9549f6e 100644
--- a/rts/StgCRun.c
+++ b/rts/StgCRun.c
@@ -192,6 +192,18 @@ StgRunIsImplementedInAssembler(void)
);
}
+#if defined(mingw32_HOST_OS)
+// On windows the stack has to be allocated 4k at a time, otherwise
+// we get a segfault. The C compiler knows how to do this (it calls
+// _alloca()), so we make sure that we can allocate as much stack as
+// we need:
+StgWord8 *win32AllocStack(void)
+{
+ StgWord8 stack[RESERVED_C_STACK_BYTES + 16 + 12];
+ return stack;
+}
+#endif
+
#endif
/* ----------------------------------------------------------------------------