Module Name:    xsrc
Committed By:   macallan
Date:           Thu Feb 28 12:38:03 UTC 2013

Modified Files:
        xsrc/external/mit/pixman/dist/pixman: pixman-mips.c

Log Message:
support Loomgson Multimedia Instructions on NetBSD


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
    xsrc/external/mit/pixman/dist/pixman/pixman-mips.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/pixman/dist/pixman/pixman-mips.c
diff -u xsrc/external/mit/pixman/dist/pixman/pixman-mips.c:1.1.1.1 xsrc/external/mit/pixman/dist/pixman/pixman-mips.c:1.2
--- xsrc/external/mit/pixman/dist/pixman/pixman-mips.c:1.1.1.1	Thu Jan 31 10:28:48 2013
+++ xsrc/external/mit/pixman/dist/pixman/pixman-mips.c	Thu Feb 28 12:38:02 2013
@@ -30,6 +30,12 @@
 #include <string.h>
 #include <stdlib.h>
 
+#ifdef __NetBSD__
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <machine/cpu.h>
+#endif
+
 static pixman_bool_t
 have_feature (const char *search_string)
 {
@@ -57,6 +63,20 @@ have_feature (const char *search_string)
     }
 
     fclose (f);
+#elif defined(__NetBSD__)
+    int error, have_lmmi;
+    int mib[2] = { CTL_MACHDEP, CPU_LMMI };
+    size_t length = sizeof(have_lmmi);
+
+    if (strcmp(search_string, "Loongson") != 0)
+    	return FALSE;
+
+    error = sysctl (mib, 2, &have_lmmi, &length, NULL, 0);
+
+    if (error != 0)
+	return FALSE;
+
+    return have_lmmi;
 #endif
 
     /* Did not find string in the proc file, or not Linux ELF. */

Reply via email to