Commit aa9c2237 authored by rswindells's avatar rswindells
Browse files

Add a test for whether the operating system supports use of the SSE2

registers. The test is a stub on everything except NetBSD for now.
parent 90907c8b
Loading
Loading
Loading
Loading
+9 −1
Changes for lisp/Darwin-os.c: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * Frobbed for OpenBSD by Pierre R. Mai, 2001.
 * Frobbed for Darwin by Pierre R. Mai, 2003.
 *
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Darwin-os.c,v 1.30 2010/06/22 16:55:17 rtoy Rel $
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Darwin-os.c,v 1.31 2010/12/26 16:04:43 rswindells Exp $
 *
 */

@@ -523,3 +523,11 @@ os_dlsym(const char *sym_name, lispobj lib_list)

    return sym_addr;
}

#ifdef i386
boolean
os_support_sse2()
{
    return TRUE;
}
#endif
+10 −1
Changes for lisp/FreeBSD-os.c: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
 * Much hacked by Paul Werkowski
 * GENCGC support by Douglas Crosher, 1996, 1997.
 *
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.36 2010/09/08 03:28:08 agoncharov Rel $
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/FreeBSD-os.c,v 1.37 2010/12/26 16:04:43 rswindells Exp $
 *
 */

@@ -356,3 +356,12 @@ restore_fpu(ucontext_t *scp)
    }
#endif
}

#ifdef i386
boolean
os_support_sse2()
{
    return TRUE;
}
#endif
+9 −1
Changes for lisp/Linux-os.c: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 * GENCGC support by Douglas Crosher, 1996, 1997.
 * Alpha support by Julian Dolby, 1999.
 *
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.50 2010/06/22 16:55:17 rtoy Rel $
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.51 2010/12/26 16:04:43 rswindells Exp $
 *
 */

@@ -537,3 +537,11 @@ restore_fpu(ucontext_t *context)
#endif        
    }
}

#ifdef i386
boolean
os_support_sse2()
{
    return TRUE;
}
#endif
+17 −1
Changes for lisp/NetBSD-os.c: 17 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 * Frobbed for OpenBSD by Pierre R. Mai, 2001.
 * Frobbed for NetBSD by Pierre R. Mai, 2002.
 *
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/NetBSD-os.c,v 1.18 2010/12/23 17:38:05 rtoy Exp $
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/NetBSD-os.c,v 1.19 2010/12/26 16:04:43 rswindells Exp $
 *
 */

@@ -36,6 +36,7 @@
/* #include <sys/sysinfo.h> */
#include <sys/proc.h>
#include <dlfcn.h>
#include <sys/sysctl.h>
#include "validate.h"
size_t os_vm_page_size;

@@ -409,3 +410,18 @@ restore_fpu(ucontext_t *scp)
	__asm__ __volatile__ ("ldmxcsr %0"::"m"(*&mxcsr));
    }
}

#ifdef i386
boolean
os_support_sse2()
{
    int support_sse2;
    size_t len;

    if (sysctlbyname("machdep.sse2", &support_sse2, &len,
		     NULL, 0) == 0 && support_sse2 != 0)
	return TRUE;
    else
	return FALSE;
}
#endif
+3 −3
Changes for lisp/lisp.c: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
/*
 * main() entry point for a stand alone lisp image.
 *
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.80 2010/12/23 03:20:27 rtoy Exp $
 * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.81 2010/12/26 16:04:43 rswindells Exp $
 *
 */

@@ -715,8 +715,8 @@ main(int argc, const char *argv[], const char *envp[])
    }

#ifdef i386
    if ((fpu_type == SSE2) && !arch_support_sse2()) {
	fprintf(stderr, "Core uses SSE2, but CPU doesn't support SSE2.  Exiting\n");
    if ((fpu_type == SSE2) && (!arch_support_sse2() || !os_support_sse2())) {
	fprintf(stderr, "Core uses SSE2, but CPU/OS doesn't support SSE2.  Exiting\n");
	exit(1);
    }
    fpu_mode = fpu_type;
Loading