#include <sys/sysctl.h>
#endif
+#if defined(__OpenBSD__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <machine/cpu.h>
+#endif
/***** powerpc *****/
}
#endif
-#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__APPLE__) && !defined(__linux__)
+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(__linux__)
static void
test_altivec (void * ignored)
{
}
#endif
+#if defined(__OpenBSD__)
+static unsigned long
+orc_check_altivec_sysctl_openbsd (void)
+{
+ unsigned long cpu_flags = 0;
+ int mib[2], ret, vu;
+ size_t len;
+
+ mib[0] = CTL_MACHDEP;
+ mib[1] = CPU_ALTIVEC;
+
+ len = sizeof(vu);
+ ret = sysctl(mib, 2, &vu, &len, NULL, 0);
+ if (!ret && vu) {
+ cpu_flags |= ORC_TARGET_ALTIVEC_ALTIVEC;
+ }
+
+ return cpu_flags;
+}
+#endif
+
#if defined(__linux__)
static unsigned long
orc_check_altivec_proc_auxv (void)
}
#endif
-#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__APPLE__) && !defined(__linux__)
+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(__linux__)
static void
orc_check_altivec_fault (void)
{
{
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__)
orc_check_altivec_sysctl_bsd();
+#elif defined(__OpenBSD__)
+ orc_check_altivec_sysctl_openbsd();
#elif defined(__linux__)
orc_check_altivec_proc_auxv();
#else
* unmasked SSE FPU exception bug. Other than that, if /proc/cpuinfo
* reported SSE, then it's safe.
*/
-#elif defined(__sun)
- /* Solaris is OK */
-#elif defined(__NetBSD__)
- /* NetBSD is OK */
+#elif defined(__sun) || defined(__NetBSD__) || defined(__OpenBSD__)
+ /* Solaris/NetBSD/OpenBSD are OK */
#else
ORC_WARNING("Operating system is not known to support SSE. "