| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * An implementation of CPU whitelisting for x86's CPUID identification scheme. | 8 * An implementation of CPU whitelisting for x86's CPUID identification scheme. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "native_client/src/include/portability.h" | 11 #include "native_client/src/include/portability.h" |
| 12 #include <stdio.h> | 12 #include <stdio.h> |
| 13 #include <string.h> | 13 #include <string.h> |
| 14 #include <assert.h> | 14 #include <assert.h> |
| 15 #include <stdlib.h> | 15 #include <stdlib.h> |
| 16 #include "native_client/src/include/nacl_macros.h" | 16 #include "native_client/src/include/nacl_macros.h" |
| 17 #include "native_client/src/trusted/validator/x86/nacl_cpuid.h" | 17 #include "native_client/src/trusted/cpu_features/arch/x86/cpu_x86.h" |
| 18 #include "native_client/src/trusted/platform_qualify/nacl_cpuwhitelist.h" | 18 #include "native_client/src/trusted/platform_qualify/nacl_cpuwhitelist.h" |
| 19 | 19 |
| 20 | 20 |
| 21 static int idcmp(const void *s1, const void *s2) { | 21 static int idcmp(const void *s1, const void *s2) { |
| 22 return strncmp((char *)s1, *(char **)s2, kCPUIDStringLength); | 22 return strncmp((char *)s1, *(char **)s2, kCPUIDStringLength); |
| 23 } | 23 } |
| 24 | 24 |
| 25 /* NOTE: The blacklist must be in alphabetical order. */ | 25 /* NOTE: The blacklist must be in alphabetical order. */ |
| 26 static const char* const kNaclCpuBlacklist[] = { | 26 static const char* const kNaclCpuBlacklist[] = { |
| 27 /* 1 2 */ | 27 /* 1 2 */ |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 int NaCl_ThisCPUIsBlacklisted(void) { | 111 int NaCl_ThisCPUIsBlacklisted(void) { |
| 112 NaClCPUData data; | 112 NaClCPUData data; |
| 113 const char* myid; | 113 const char* myid; |
| 114 NaClCPUDataGet(&data); | 114 NaClCPUDataGet(&data); |
| 115 myid = GetCPUIDString(&data); | 115 myid = GetCPUIDString(&data); |
| 116 return IsCpuInList(myid, | 116 return IsCpuInList(myid, |
| 117 kNaclCpuBlacklist, | 117 kNaclCpuBlacklist, |
| 118 NACL_ARRAY_SIZE(kNaclCpuBlacklist)); | 118 NACL_ARRAY_SIZE(kNaclCpuBlacklist)); |
| 119 } | 119 } |
| OLD | NEW |