bjarni@3093: /* $Id$ */ bjarni@3084: rubidium@9111: /** @file G5_detector.cpp Detection for G5 machines (PowerPC). */ rubidium@9111: bjarni@3084: #include bjarni@3084: #include bjarni@3084: #include bjarni@3084: #include bjarni@3084: #include bjarni@3084: bjarni@3084: bjarni@3084: #ifndef CPU_SUBTYPE_POWERPC_970 bjarni@3084: #define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100) bjarni@3084: #endif bjarni@3084: bjarni@3084: // this function is a lightly modified version of some code from Apple's developer homepage to detect G5 CPUs at runtime bjarni@3084: main() bjarni@3084: { bjarni@3084: host_basic_info_data_t hostInfo; bjarni@3084: mach_msg_type_number_t infoCount; bjarni@3084: boolean_t is_G5; bjarni@3084: bjarni@3084: infoCount = HOST_BASIC_INFO_COUNT; bjarni@3084: host_info(mach_host_self(), HOST_BASIC_INFO, bjarni@3084: (host_info_t)&hostInfo, &infoCount); bjarni@3084: bjarni@3084: is_G5 = ((hostInfo.cpu_type == CPU_TYPE_POWERPC) && bjarni@3084: (hostInfo.cpu_subtype == CPU_SUBTYPE_POWERPC_970)); bjarni@3084: if (is_G5) bjarni@3084: printf("1"); bjarni@3084: }