Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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
......@@ -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
......@@ -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
/*
* 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;
......
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/os.h,v 1.26 2010/02/01 17:38:48 rtoy Rel $
* $Header: /Volumes/share2/src/cmucl/cvs2git/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 long *os_sigcontext_pc(ucontext_t *);
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_ */
/*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/solaris-os.c,v 1.28 2010/12/23 23:02:58 rtoy Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/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 @@ os_sigcontext_fpu_modes(ucontext_t *scp)
modes ^= (0x3f << 7);
return modes;
}
boolean
os_support_sse2()
{
return TRUE;
}
#endif
/* x86-arch.c -*- Mode: C; comment-column: 40 -*-
*
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-arch.c,v 1.42 2010/12/23 22:55:31 rtoy Exp $
* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-arch.c,v 1.43 2010/12/26 16:04:43 rswindells Exp $
*
*/
......@@ -105,7 +105,7 @@ arch_init(fpu_mode_t mode)
{
int have_sse2;
have_sse2 = arch_support_sse2();
have_sse2 = arch_support_sse2() && os_support_sse2();
switch (mode) {
case AUTO:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment