+ SHOW("os_install_interrupt_handlers()/bsd-os/defined(GENCGC)");
+ undoably_install_low_level_interrupt_handler(SIG_MEMORY_FAULT,
+ memory_fault_handler);
+ SHOW("leaving os_install_interrupt_handlers()");
+}
+
+#else /* Currently Darwin only */
+
+static void
+sigsegv_handler(int signal, siginfo_t *info, void* void_context)
+{
+ os_context_t *context = arch_os_get_context(&void_context);
+ unsigned int pc = (unsigned int *)(*os_context_pc_addr(context));
+ os_vm_address_t addr;
+
+ addr = arch_get_bad_addr(signal,info,context);
+ if(!interrupt_maybe_gc(signal, info, context))
+ if(!handle_guard_page_triggered(context,addr))
+ interrupt_handle_now(signal, info, context);
+ /* Work around G5 bug; fix courtesy gbyers */
+ DARWIN_FIX_CONTEXT(context);
+}
+
+void
+os_install_interrupt_handlers(void)
+{
+ SHOW("os_install_interrupt_handlers()/bsd-os/!defined(GENCGC)");
+ undoably_install_low_level_interrupt_handler(SIG_MEMORY_FAULT,
+ sigsegv_handler);
+}
+
+#endif /* defined GENCGC */
+
+#ifdef __NetBSD__
+static void netbsd_init()
+{
+ struct rlimit rl;
+ int mib[2], osrev;
+ size_t len;
+
+ /* Are we running on a sufficiently functional kernel? */
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_OSREV;
+
+ len = sizeof(osrev);
+ sysctl(mib, 2, &osrev, &len, NULL, 0);
+
+ /* If we're older than 2.0... */
+ if (osrev < 200000000) {
+ fprintf(stderr, "osrev = %d (needed at least 200000000).\n", osrev);
+ lose("NetBSD kernel too old to run sbcl.\n");
+ }
+
+ /* NetBSD counts mmap()ed space against the process's data size limit,
+ * so yank it up. This might be a nasty thing to do? */
+ getrlimit (RLIMIT_DATA, &rl);
+ /* Amazingly for such a new port, the provenance and meaning of
+ this number are unknown. It might just mean REALLY_BIG_LIMIT,
+ or possibly it should be calculated from dynamic space size.
+ -- CSR, 2004-04-08 */
+ rl.rlim_cur = 1073741824;
+ if (setrlimit (RLIMIT_DATA, &rl) < 0) {
+ fprintf (stderr,
+ "RUNTIME WARNING: unable to raise process data size limit:\n\
+ %s.\n\
+The system may fail to start.\n",
+ strerror(errno));
+ }
+}
+#endif /* __NetBSD__ */
+\f
+/* threads */
+
+/* no threading in any *BSD variant on any CPU (yet? in sbcl-0.8.0 anyway) */
+#ifdef LISP_FEATURE_SB_THREAD
+#error "Define threading support functions"