1 /* $Id: G5_detector.cpp 24524 2012-09-13 18:42:33Z yexo $ */
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
10 /** @file G5_detector.cpp Detection for G5 machines (PowerPC). */
12 #include <mach/mach.h>
13 #include <mach/mach_host.h>
14 #include <mach/host_info.h>
15 #include <mach/machine.h>
19 #ifndef CPU_SUBTYPE_POWERPC_970
20 #define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
23 /* this function is a lightly modified version of some code from Apple's developer homepage to detect G5 CPUs at runtime */
26 host_basic_info_data_t hostInfo
;
27 mach_msg_type_number_t infoCount
;
30 infoCount
= HOST_BASIC_INFO_COUNT
;
31 host_info(mach_host_self(), HOST_BASIC_INFO
,
32 (host_info_t
)&hostInfo
, &infoCount
);
34 is_G5
= ((hostInfo
.cpu_type
== CPU_TYPE_POWERPC
) &&
35 (hostInfo
.cpu_subtype
== CPU_SUBTYPE_POWERPC_970
));