Move the global safepoint to one page before static space
[sbcl.git] / src / runtime / runtime.c
index d2cb732..38770a6 100644 (file)
@@ -30,7 +30,7 @@
 #include <sys/file.h>
 #include <sys/param.h>
 #include <sys/stat.h>
-#include <signal.h>
+#include "runtime.h"
 #ifndef LISP_FEATURE_WIN32
 #include <sched.h>
 #endif
@@ -42,7 +42,9 @@
 #include <time.h>
 #endif
 
+#if !(defined(LISP_FEATURE_WIN32) && defined(LISP_FEATURE_SB_THREAD))
 #include "signal.h"
+#endif
 
 #include "runtime.h"
 #include "vars.h"
@@ -292,11 +294,13 @@ search_for_executable(const char *argv0)
 }
 #endif /* LISP_FEATURE_WIN32 */
 
-long parse_size_arg(char *arg, char *arg_name)
+unsigned long parse_size_arg(char *arg, char *arg_name)
 {
   char *tail, *power_name;
-  long power, res;
-  res = strtol(arg, &tail, 0);
+  unsigned long power, res;
+
+  res = strtoul(arg, &tail, 0);
+
   if (arg == tail) {
     lose("%s argument is not a number: %s", arg_name, arg);
   } else if (tail[0]) {
@@ -325,7 +329,7 @@ long parse_size_arg(char *arg, char *arg_name)
     free(power_name);
   }
   if ((res <= 0) ||
-      (res >= (LONG_MAX >> power))) {
+      (res > (ULONG_MAX >> power))) {
     lose("%s argument is out of range: %s", arg_name, arg);
   }
   res <<= power;
@@ -338,6 +342,10 @@ char *core_string;
 struct runtime_options *runtime_options;
 
 char *saved_runtime_path = NULL;
+#if defined(LISP_FEATURE_WIN32) && defined(LISP_FEATURE_SB_THREAD)
+void pthreads_win32_init();
+#endif
+
 \f
 int
 main(int argc, char *argv[], char *envp[])
@@ -362,6 +370,11 @@ main(int argc, char *argv[], char *envp[])
     lispobj initial_function;
     const char *sbcl_home = getenv("SBCL_HOME");
 
+#if defined(LISP_FEATURE_WIN32) && defined(LISP_FEATURE_SB_THREAD)
+    os_preinit();
+    pthreads_win32_init();
+#endif
+
     interrupt_init();
     block_blockable_signals(0, 0);
 
@@ -449,7 +462,7 @@ main(int argc, char *argv[], char *envp[])
                        DYNAMIC_SPACE_START+dynamic_space_size) &&
                       (DYNAMIC_SPACE_START+dynamic_space_size <=
                        MAX_DYNAMIC_SPACE_END)))
-                  lose("--dynamic-space-size argument %s is too large, max %ldMiB",
+                  lose("--dynamic-space-size argument %s is too large, max %lu",
                        argv[argi-1], MAX_DYNAMIC_SPACE_END-DYNAMIC_SPACE_START);
 #               endif
             } else if (0 == strcmp(arg, "--control-stack-size")) {
@@ -542,6 +555,7 @@ main(int argc, char *argv[], char *envp[])
      * systems (e.g. Alpha) arch_init() needs need os_vm_page_size, so
      * it must follow os_init(). -- WHN 2000-01-26 */
     os_init(argv, envp);
+    dyndebug_init(); /* after os_init: do not print output before execve */
     arch_init();
     gc_init();
     validate();