summaryrefslogtreecommitdiff
path: root/src/post/goom/cpu_info.c
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2004-06-27 11:58:47 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2004-06-27 11:58:47 +0000
commit90f730ca714fb53f47ee16be46fcb06bd98d53ed (patch)
treec028f9afa30ec4137501fdada9c6ef1130daf2fb /src/post/goom/cpu_info.c
parent29f04d913513a470bc91aff3e6c0fca699e460f8 (diff)
downloadxine-lib-90f730ca714fb53f47ee16be46fcb06bd98d53ed.tar.gz
xine-lib-90f730ca714fb53f47ee16be46fcb06bd98d53ed.tar.bz2
include the new goom version 2k4-dev15
everybody: test, test, test CVS patchset: 6756 CVS date: 2004/06/27 11:58:47
Diffstat (limited to 'src/post/goom/cpu_info.c')
-rw-r--r--src/post/goom/cpu_info.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/post/goom/cpu_info.c b/src/post/goom/cpu_info.c
new file mode 100644
index 000000000..d392ee3d3
--- /dev/null
+++ b/src/post/goom/cpu_info.c
@@ -0,0 +1,63 @@
+/*
+ * cpu_info.c
+ * Goom
+ *
+ * Created by Guillaume Borios on Sun Dec 28 2003.
+ * Copyright (c) 2003 iOS. All rights reserved.
+ *
+ */
+
+#include "cpu_info.h"
+
+
+static unsigned int CPU_FLAVOUR = 0;
+static unsigned int CPU_NUMBER = 1;
+static unsigned int CPU_DETECTED = 0;
+
+static void autoset_cpu_info (void)
+{
+ CPU_DETECTED = 1;
+
+#ifdef CPU_POWERPC
+ int result;
+ size_t size;
+
+ result = 0;
+ size = 4;
+ if (sysctlbyname("hw.optional.altivec",&result,&size,NULL,NULL) == 0)
+ {
+ if (result != 0) CPU_FLAVOUR |= CPU_OPTION_ALTIVEC;
+ }
+
+ result = 0;
+ size = 4;
+ if (sysctlbyname("hw.optional.64bitops",&result,&size,NULL,NULL) == 0)
+ {
+ if (result != 0) CPU_FLAVOUR |= CPU_OPTION_64_BITS;
+ }
+
+ result = 0;
+ size = 4;
+ if (sysctlbyname("hw.ncpu",&result,&size,NULL,NULL) == 0)
+ {
+ if (result != 0) CPU_NUMBER = result;
+ }
+#endif /* CPU_POWERPC */
+
+#ifdef CPU_X86
+ if (mmx_supported()) CPU_FLAVOUR |= CPU_OPTION_MMX;
+ if (xmmx_supported()) CPU_FLAVOUR |= CPU_OPTION_XMMX;
+#endif /* CPU_X86 */
+}
+
+unsigned int cpu_flavour (void)
+{
+ if (CPU_DETECTED == 0) autoset_cpu_info();
+ return CPU_FLAVOUR;
+}
+
+unsigned int cpu_number (void)
+{
+ if (CPU_DETECTED == 0) autoset_cpu_info();
+ return CPU_NUMBER;
+}