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