| 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 #ifndef NACL_TRUSTED_BUT_NOT_TCB | 7 #ifndef NACL_TRUSTED_BUT_NOT_TCB |
| 8 #error("This file is not meant for use in the TCB") | 8 #error("This file is not meant for use in the TCB") |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 /* | 11 /* |
| 12 * nacl_cpuid_test.c | 12 * cpu_x86_test.c |
| 13 * test main and subroutines for nacl_cpuid | 13 * test main and subroutines for cpu_x86 |
| 14 */ | 14 */ |
| 15 #include "native_client/src/include/portability.h" | 15 #include "native_client/src/include/portability.h" |
| 16 #include <stdio.h> | 16 #include <stdio.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 | 18 |
| 19 int main(int argc, char *argv[]) { | 19 int main(void) { |
| 20 NaClCPUFeaturesX86 fv; | 20 NaClCPUFeaturesX86 fv; |
| 21 NaClCPUData cpu_data; | 21 NaClCPUData cpu_data; |
| 22 int feature_id; | 22 int feature_id; |
| 23 NaClCPUDataGet(&cpu_data); | 23 NaClCPUDataGet(&cpu_data); |
| 24 | 24 |
| 25 NaClGetCurrentCPUFeaturesX86((NaClCPUFeatures *) &fv); | 25 NaClGetCurrentCPUFeaturesX86((NaClCPUFeatures *) &fv); |
| 26 if (NaClArchSupportedX86(&fv)) { | 26 if (NaClArchSupportedX86(&fv)) { |
| 27 printf("This is a native client %d-bit %s compatible computer\n", | 27 printf("This is a native client %d-bit %s compatible computer\n", |
| 28 NACL_TARGET_SUBARCH, GetCPUIDString(&cpu_data)); | 28 NACL_TARGET_SUBARCH, GetCPUIDString(&cpu_data)); |
| 29 } else { | 29 } else { |
| 30 if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUIDSupported)) { | 30 if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUIDSupported)) { |
| 31 printf("Computer doesn't support CPUID\n"); | 31 printf("Computer doesn't support CPUID\n"); |
| 32 } | 32 } |
| 33 if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUSupported)) { | 33 if (!NaClGetCPUFeatureX86(&fv, NaClCPUFeatureX86_CPUSupported)) { |
| 34 printf("Computer id %s is not supported\n", GetCPUIDString(&cpu_data)); | 34 printf("Computer id %s is not supported\n", GetCPUIDString(&cpu_data)); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 printf("This processor has:\n"); | 38 printf("This processor has:\n"); |
| 39 for (feature_id = 0; feature_id < NaClCPUFeatureX86_Max; ++feature_id) { | 39 for (feature_id = 0; feature_id < NaClCPUFeatureX86_Max; ++feature_id) { |
| 40 if (NaClGetCPUFeatureX86(&fv, feature_id)) | 40 if (NaClGetCPUFeatureX86(&fv, feature_id)) |
| 41 printf(" %s\n", NaClGetCPUFeatureX86Name(feature_id)); | 41 printf(" %s\n", NaClGetCPUFeatureX86Name(feature_id)); |
| 42 } | 42 } |
| 43 return 0; | 43 return 0; |
| 44 } | 44 } |
| OLD | NEW |