michael@0: /* michael@0: * Copyright (c) 2010 The WebM project authors. All Rights Reserved. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license michael@0: * that can be found in the LICENSE file in the root of the source michael@0: * tree. An additional intellectual property rights grant can be found michael@0: * in the file PATENTS. All contributing project authors may michael@0: * be found in the AUTHORS file in the root of the source tree. michael@0: */ michael@0: michael@0: #include michael@0: #include "x86.h" michael@0: michael@0: struct cpuid_vendors { michael@0: char vendor_string[12]; michael@0: vpx_cpu_t vendor_id; michael@0: }; michael@0: michael@0: static struct cpuid_vendors cpuid_vendor_list[VPX_CPU_LAST] = { michael@0: { "AuthenticAMD", VPX_CPU_AMD }, michael@0: { "AMDisbetter!", VPX_CPU_AMD_OLD }, michael@0: { "CentaurHauls", VPX_CPU_CENTAUR }, michael@0: { "CyrixInstead", VPX_CPU_CYRIX }, michael@0: { "GenuineIntel", VPX_CPU_INTEL }, michael@0: { "NexGenDriven", VPX_CPU_NEXGEN }, michael@0: { "Geode by NSC", VPX_CPU_NSC }, michael@0: { "RiseRiseRise", VPX_CPU_RISE }, michael@0: { "SiS SiS SiS ", VPX_CPU_SIS }, michael@0: { "GenuineTMx86", VPX_CPU_TRANSMETA }, michael@0: { "TransmetaCPU", VPX_CPU_TRANSMETA_OLD }, michael@0: { "UMC UMC UMC ", VPX_CPU_UMC }, michael@0: { "VIA VIA VIA ", VPX_CPU_VIA }, michael@0: }; michael@0: michael@0: vpx_cpu_t vpx_x86_vendor(void) { michael@0: unsigned int reg_eax; michael@0: unsigned int vs[3]; michael@0: int i; michael@0: michael@0: /* Get the Vendor String from the CPU */ michael@0: cpuid(0, reg_eax, vs[0], vs[2], vs[1]); michael@0: michael@0: for (i = 0; i < VPX_CPU_LAST; i++) { michael@0: if (strncmp((const char *)vs, cpuid_vendor_list[i].vendor_string, 12) == 0) michael@0: return (cpuid_vendor_list[i].vendor_id); michael@0: } michael@0: michael@0: return VPX_CPU_UNKNOWN; michael@0: }