[cmucl-commit] CMUCL commit: src/lisp (8 files)

Robert Swindells rswindells at common-lisp.net
Sun Dec 26 17:04:44 CET 2010


    Date: Sunday, December 26, 2010 @ 11:04:44
  Author: rswindells
    Path: /project/cmucl/cvsroot/src/lisp

Modified: Darwin-os.c FreeBSD-os.c Linux-os.c NetBSD-os.c lisp.c os.h
          solaris-os.c x86-arch.c

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.


--------------+
 Darwin-os.c  |   10 +++++++++-
 FreeBSD-os.c |   11 ++++++++++-
 Linux-os.c   |   10 +++++++++-
 NetBSD-os.c  |   18 +++++++++++++++++-
 lisp.c       |    6 +++---
 os.h         |    6 +++++-
 solaris-os.c |    8 +++++++-
 x86-arch.c   |    4 ++--
 8 files changed, 62 insertions(+), 11 deletions(-)


Index: src/lisp/Darwin-os.c
diff -u src/lisp/Darwin-os.c:1.30 src/lisp/Darwin-os.c:1.31
--- src/lisp/Darwin-os.c:1.30	Tue Jun 22 12:55:17 2010
+++ src/lisp/Darwin-os.c	Sun Dec 26 11:04:43 2010
@@ -14,7 +14,7 @@
  * Frobbed for OpenBSD by Pierre R. Mai, 2001.
  * Frobbed for Darwin by Pierre R. Mai, 2003.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/Darwin-os.c,v 1.30 2010-06-22 16:55:17 rtoy Rel $
+ * $Header: /project/cmucl/cvsroot/src/lisp/Darwin-os.c,v 1.31 2010-12-26 16:04:43 rswindells Exp $
  *
  */
 
@@ -523,3 +523,11 @@
 
     return sym_addr;
 }
+
+#ifdef i386
+boolean
+os_support_sse2()
+{
+    return TRUE;
+}
+#endif
Index: src/lisp/FreeBSD-os.c
diff -u src/lisp/FreeBSD-os.c:1.36 src/lisp/FreeBSD-os.c:1.37
--- src/lisp/FreeBSD-os.c:1.36	Tue Sep  7 23:28:08 2010
+++ src/lisp/FreeBSD-os.c	Sun Dec 26 11:04:43 2010
@@ -12,7 +12,7 @@
  * Much hacked by Paul Werkowski
  * GENCGC support by Douglas Crosher, 1996, 1997.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/FreeBSD-os.c,v 1.36 2010-09-08 03:28:08 agoncharov Rel $
+ * $Header: /project/cmucl/cvsroot/src/lisp/FreeBSD-os.c,v 1.37 2010-12-26 16:04:43 rswindells Exp $
  *
  */
 
@@ -356,3 +356,12 @@
     }
 #endif
 }
+
+#ifdef i386
+boolean
+os_support_sse2()
+{
+    return TRUE;
+}
+#endif
+
Index: src/lisp/Linux-os.c
diff -u src/lisp/Linux-os.c:1.50 src/lisp/Linux-os.c:1.51
--- src/lisp/Linux-os.c:1.50	Tue Jun 22 12:55:17 2010
+++ src/lisp/Linux-os.c	Sun Dec 26 11:04:43 2010
@@ -15,7 +15,7 @@
  * GENCGC support by Douglas Crosher, 1996, 1997.
  * Alpha support by Julian Dolby, 1999.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/Linux-os.c,v 1.50 2010-06-22 16:55:17 rtoy Rel $
+ * $Header: /project/cmucl/cvsroot/src/lisp/Linux-os.c,v 1.51 2010-12-26 16:04:43 rswindells Exp $
  *
  */
 
@@ -537,3 +537,11 @@
 #endif        
     }
 }
+
+#ifdef i386
+boolean
+os_support_sse2()
+{
+    return TRUE;
+}
+#endif
Index: src/lisp/NetBSD-os.c
diff -u src/lisp/NetBSD-os.c:1.18 src/lisp/NetBSD-os.c:1.19
--- src/lisp/NetBSD-os.c:1.18	Thu Dec 23 12:38:05 2010
+++ src/lisp/NetBSD-os.c	Sun Dec 26 11:04:43 2010
@@ -15,7 +15,7 @@
  * Frobbed for OpenBSD by Pierre R. Mai, 2001.
  * Frobbed for NetBSD by Pierre R. Mai, 2002.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/NetBSD-os.c,v 1.18 2010-12-23 17:38:05 rtoy Exp $
+ * $Header: /project/cmucl/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 @@
 	__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
Index: src/lisp/lisp.c
diff -u src/lisp/lisp.c:1.80 src/lisp/lisp.c:1.81
--- src/lisp/lisp.c:1.80	Wed Dec 22 22:20:27 2010
+++ src/lisp/lisp.c	Sun Dec 26 11:04:43 2010
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/lisp.c,v 1.80 2010-12-23 03:20:27 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/lisp.c,v 1.81 2010-12-26 16:04:43 rswindells Exp $
  *
  */
 
@@ -715,8 +715,8 @@
     }
 
 #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;
Index: src/lisp/os.h
diff -u src/lisp/os.h:1.26 src/lisp/os.h:1.27
--- src/lisp/os.h:1.26	Mon Feb  1 12:38:48 2010
+++ src/lisp/os.h	Sun Dec 26 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/os.h,v 1.26 2010-02-01 17:38:48 rtoy Rel $
+ * $Header: /project/cmucl/cvsroot/src/lisp/os.h,v 1.27 2010-12-26 16:04:43 rswindells Exp $
  *
  * Common interface for os-dependent functions.
  *
@@ -115,6 +115,10 @@
 unsigned char *os_sigcontext_fpu_reg(ucontext_t *, int);
 unsigned int os_sigcontext_fpu_modes(ucontext_t *);
 
+#ifdef i386
+extern boolean os_support_sse2(void);
+#endif
+
 char* convert_lisp_string(char* c_string, void* lisp_string, int len);
 
 #endif /* _OS_H_ */
Index: src/lisp/solaris-os.c
diff -u src/lisp/solaris-os.c:1.28 src/lisp/solaris-os.c:1.29
--- src/lisp/solaris-os.c:1.28	Thu Dec 23 18:02:58 2010
+++ src/lisp/solaris-os.c	Sun Dec 26 11:04:43 2010
@@ -1,5 +1,5 @@
 /*
- * $Header: /project/cmucl/cvsroot/src/lisp/solaris-os.c,v 1.28 2010-12-23 23:02:58 rtoy Exp $
+ * $Header: /project/cmucl/cvsroot/src/lisp/solaris-os.c,v 1.29 2010-12-26 16:04:43 rswindells Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
  * OS-independent interface to the operating system VM facilities.
@@ -609,4 +609,10 @@
     modes ^= (0x3f << 7);
     return modes;
 }
+
+boolean
+os_support_sse2()
+{
+    return TRUE;
+}
 #endif
Index: src/lisp/x86-arch.c
diff -u src/lisp/x86-arch.c:1.42 src/lisp/x86-arch.c:1.43
--- src/lisp/x86-arch.c:1.42	Thu Dec 23 17:55:31 2010
+++ src/lisp/x86-arch.c	Sun Dec 26 11:04:43 2010
@@ -1,6 +1,6 @@
 /* x86-arch.c -*- Mode: C; comment-column: 40 -*-
  *
- * $Header: /project/cmucl/cvsroot/src/lisp/x86-arch.c,v 1.42 2010-12-23 22:55:31 rtoy Exp $ 
+ * $Header: /project/cmucl/cvsroot/src/lisp/x86-arch.c,v 1.43 2010-12-26 16:04:43 rswindells Exp $ 
  *
  */
 
@@ -105,7 +105,7 @@
 {
     int have_sse2;
 
-    have_sse2 = arch_support_sse2();
+    have_sse2 = arch_support_sse2() && os_support_sse2();
     
     switch (mode) {
       case AUTO:


More information about the cmucl-commit mailing list