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