-/* 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"
-#else
-int arch_os_thread_init(struct thread *thread) {
- stack_t sigstack;
-#ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
- /* Signal handlers are run on the control stack, so if it is exhausted
- * we had better use an alternate stack for whatever signal tells us
- * we've exhausted it */
- sigstack.ss_sp=((void *) thread)+dynamic_values_bytes;
- sigstack.ss_flags=0;
- sigstack.ss_size = 32*SIGSTKSZ;
- sigaltstack(&sigstack,0);
+#ifdef __FreeBSD__
+static void freebsd_init()
+{
+ /* Quote from sbcl-devel (NIIMI Satoshi): "Some OSes, like FreeBSD
+ * 4.x with GENERIC kernel, does not enable SSE support even on
+ * SSE capable CPUs". Detect this situation and skip the
+ * fast_bzero sse/base selection logic that's normally done in
+ * x86-assem.S.
+ */
+#ifdef LISP_FEATURE_X86
+ size_t len;
+ int instruction_sse;
+
+ len = sizeof(instruction_sse);
+ if (sysctlbyname("hw.instruction_sse", &instruction_sse, &len, NULL, 0) == 0
+ && instruction_sse != 0) {
+ /* Use the SSE detector */
+ fast_bzero_pointer = fast_bzero_detect;
+ }
+#endif /* LISP_FEATURE_X86 */
+}
+#endif /* __FreeBSD__ */
+
+#ifdef LISP_FEATURE_DARWIN
+/* defined in ppc-darwin-os.c instead */
+#elif defined(LISP_FEATURE_FREEBSD)
+#ifndef KERN_PROC_PATHNAME
+#define KERN_PROC_PATHNAME 12