media/libvpx/vpx_ports/x86_cpuid.c

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license
michael@0 5 * that can be found in the LICENSE file in the root of the source
michael@0 6 * tree. An additional intellectual property rights grant can be found
michael@0 7 * in the file PATENTS. All contributing project authors may
michael@0 8 * be found in the AUTHORS file in the root of the source tree.
michael@0 9 */
michael@0 10
michael@0 11 #include <string.h>
michael@0 12 #include "x86.h"
michael@0 13
michael@0 14 struct cpuid_vendors {
michael@0 15 char vendor_string[12];
michael@0 16 vpx_cpu_t vendor_id;
michael@0 17 };
michael@0 18
michael@0 19 static struct cpuid_vendors cpuid_vendor_list[VPX_CPU_LAST] = {
michael@0 20 { "AuthenticAMD", VPX_CPU_AMD },
michael@0 21 { "AMDisbetter!", VPX_CPU_AMD_OLD },
michael@0 22 { "CentaurHauls", VPX_CPU_CENTAUR },
michael@0 23 { "CyrixInstead", VPX_CPU_CYRIX },
michael@0 24 { "GenuineIntel", VPX_CPU_INTEL },
michael@0 25 { "NexGenDriven", VPX_CPU_NEXGEN },
michael@0 26 { "Geode by NSC", VPX_CPU_NSC },
michael@0 27 { "RiseRiseRise", VPX_CPU_RISE },
michael@0 28 { "SiS SiS SiS ", VPX_CPU_SIS },
michael@0 29 { "GenuineTMx86", VPX_CPU_TRANSMETA },
michael@0 30 { "TransmetaCPU", VPX_CPU_TRANSMETA_OLD },
michael@0 31 { "UMC UMC UMC ", VPX_CPU_UMC },
michael@0 32 { "VIA VIA VIA ", VPX_CPU_VIA },
michael@0 33 };
michael@0 34
michael@0 35 vpx_cpu_t vpx_x86_vendor(void) {
michael@0 36 unsigned int reg_eax;
michael@0 37 unsigned int vs[3];
michael@0 38 int i;
michael@0 39
michael@0 40 /* Get the Vendor String from the CPU */
michael@0 41 cpuid(0, reg_eax, vs[0], vs[2], vs[1]);
michael@0 42
michael@0 43 for (i = 0; i < VPX_CPU_LAST; i++) {
michael@0 44 if (strncmp((const char *)vs, cpuid_vendor_list[i].vendor_string, 12) == 0)
michael@0 45 return (cpuid_vendor_list[i].vendor_id);
michael@0 46 }
michael@0 47
michael@0 48 return VPX_CPU_UNKNOWN;
michael@0 49 }

mercurial