author | richk |
Tue, 17 Jun 2008 13:22:13 +0000 | |
branch | NewGRF_ports |
changeset 10994 | cd9968b6f96b |
parent 10724 | 68a692eacf22 |
permissions | -rw-r--r-- |
3093
f677403be64f
(svn r3682) -Fix: didn't write $ correct in G5_detector in r3673, which caused problems for tortoisesvn
bjarni
parents:
3084
diff
changeset
|
1 |
/* $Id$ */ |
3084
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
2 |
|
10724
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
5835
diff
changeset
|
3 |
/** @file G5_detector.cpp Detection for G5 machines (PowerPC). */ |
68a692eacf22
(svn r13274) [NewGRF_ports] -Sync: with trunk r12806:13144.
richk
parents:
5835
diff
changeset
|
4 |
|
3084
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
5 |
#include <mach/mach.h> |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
6 |
#include <mach/mach_host.h> |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
7 |
#include <mach/host_info.h> |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
8 |
#include <mach/machine.h> |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
9 |
#include <stdio.h> |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
10 |
|
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
11 |
|
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
12 |
#ifndef CPU_SUBTYPE_POWERPC_970 |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
13 |
#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100) |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
14 |
#endif |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
15 |
|
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
16 |
// this function is a lightly modified version of some code from Apple's developer homepage to detect G5 CPUs at runtime |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
17 |
main() |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
18 |
{ |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
19 |
host_basic_info_data_t hostInfo; |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
20 |
mach_msg_type_number_t infoCount; |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
21 |
boolean_t is_G5; |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
22 |
|
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
23 |
infoCount = HOST_BASIC_INFO_COUNT; |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
24 |
host_info(mach_host_self(), HOST_BASIC_INFO, |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
25 |
(host_info_t)&hostInfo, &infoCount); |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
26 |
|
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
27 |
is_G5 = ((hostInfo.cpu_type == CPU_TYPE_POWERPC) && |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
28 |
(hostInfo.cpu_subtype == CPU_SUBTYPE_POWERPC_970)); |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
29 |
if (is_G5) |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
30 |
printf("1"); |
18abee1dd88d
(svn r3673) -Codechange: [OSX] changed the makefile to autodetect if it compiles on G5 and then adds flags to optimise for G5
bjarni
parents:
diff
changeset
|
31 |
} |