1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
$NetBSD: patch-ad,v 1.5 2009/03/22 21:02:17 wiz Exp $
Provide proper detection of altivec on NetBSD/powerpc ports.
--- liboil/liboilcpu-powerpc.c.orig 2009-02-26 19:50:42.000000000 +0000
+++ liboil/liboilcpu-powerpc.c
@@ -59,6 +59,12 @@
#include <sys/sysctl.h>
#endif
+#if defined(__NetBSD__)
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
#if defined(__OpenBSD__)
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -75,7 +81,7 @@ oil_profile_stamp_tb(void)
return ts;
}
-#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(__linux__)
+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(__linux__) && !defined(__NetBSD__)
static void
test_altivec (void * ignored)
{
@@ -83,6 +89,21 @@ test_altivec (void * ignored)
}
#endif
+#if defined(__NetBSD__)
+static void
+oil_check_altivec_sysctl_netbsd (void)
+{
+ int ret, av;
+ size_t len;
+
+ len = sizeof(av);
+ ret = sysctlbyname("machdep.altivec", &av, &len, NULL, 0);
+ if (!ret && av) {
+ oil_cpu_flags |= OIL_IMPL_FLAG_ALTIVEC;
+ }
+}
+#endif
+
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
static void
oil_check_altivec_sysctl_freebsd (void)
@@ -181,7 +202,7 @@ out:
}
#endif
-#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(__linux__)
+#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(__linux__) && !defined(__NetBSD__)
static void
oil_check_altivec_fault (void)
{
@@ -199,6 +220,8 @@ oil_cpu_detect_arch(void)
{
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
oil_check_altivec_sysctl_freebsd();
+#elif defined(__NetBSD__)
+ oil_check_altivec_sysctl_netbsd();
#elif defined(__OpenBSD__)
oil_check_altivec_sysctl_openbsd();
#elif defined(__APPLE__)
|