| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The Native Client Authors. All rights reserved. | 2 * Copyright 2008 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * platform_qual_test.c | 8 * platform_qual_test.c |
| 9 * | 9 * |
| 10 * Native Client Platform Qualification Test | 10 * Native Client Platform Qualification Test |
| 11 * | 11 * |
| 12 * This uses shell status code to indicate its result; non-zero return | 12 * This uses shell status code to indicate its result; non-zero return |
| 13 * code indicates the CPUID instruction is not implemented or not | 13 * code indicates the CPUID instruction is not implemented or not |
| 14 * implemented correctly. | 14 * implemented correctly. |
| 15 */ | 15 */ |
| 16 #include "native_client/src/include/portability.h" | 16 #include "native_client/src/include/portability.h" |
| 17 #include <stdio.h> | 17 #include <stdio.h> |
| 18 #include "native_client/src/trusted/validator_x86/nacl_cpuid.h" | 18 #include "native_client/src/trusted/validator_x86/nacl_cpuid.h" |
| 19 #include "native_client/src/trusted/platform_qualify/nacl_cpuwhitelist.h" | 19 #include "native_client/src/trusted/platform_qualify/nacl_cpuwhitelist.h" |
| 20 #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h" |
| 20 #include "native_client/src/trusted/platform_qualify/nacl_os_qualify.h" | 21 #include "native_client/src/trusted/platform_qualify/nacl_os_qualify.h" |
| 21 #include "native_client/src/trusted/platform_qualify/vcpuid.h" | 22 #include "native_client/src/trusted/platform_qualify/vcpuid.h" |
| 22 | 23 |
| 23 int main() { | 24 int main() { |
| 24 | 25 |
| 25 /* | 26 /* |
| 26 * TODO(bradchen): need to fix vcpuid to use intrinsics rather than inline | 27 * TODO(bradchen): need to fix vcpuid to use intrinsics rather than inline |
| 27 * assembly code. (Issue 440) | 28 * assembly code. (Issue 440) |
| 28 */ | 29 */ |
| 29 #if !(NACL_WINDOWS && NACL_BUILD_SUBARCH == 64) | 30 #if !(NACL_WINDOWS && NACL_BUILD_SUBARCH == 64) |
| 30 if (!CPUIDImplIsValid()) return -1; | 31 if (!CPUIDImplIsValid()) return -1; |
| 31 printf("CPUID implementation looks okay\n"); | 32 printf("CPUID implementation looks okay\n"); |
| 32 if (NaCl_ThisCPUIsBlacklisted()) return -1; | 33 if (NaCl_ThisCPUIsBlacklisted()) return -1; |
| 33 printf("CPU is not blacklisted\n"); | 34 printf("CPU is not blacklisted\n"); |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 /* | 37 /* |
| 37 * don't use the white list for now | 38 * don't use the white list for now |
| 38 * if (NaCl_CPUIsWhitelisted() == 0) return -1; | 39 * if (NaCl_CPUIsWhitelisted() == 0) return -1; |
| 39 * printf("CPU is whitelisted\n"); | 40 * printf("CPU is whitelisted\n"); |
| 40 */ | 41 */ |
| 41 | 42 |
| 42 if (NaClOsIsSupported() != 1) return -1; | 43 if (NaClOsIsSupported() != 1) return -1; |
| 43 printf("OS is supported\n"); | 44 printf("OS is supported\n"); |
| 44 if (NaClOsRestoresLdt() != 1) return -1; | 45 if (NaClOsRestoresLdt() != 1) return -1; |
| 45 printf("OS restores LDT\n"); | 46 printf("OS restores LDT\n"); |
| 46 | 47 |
| 48 if (NaClCheckDEP() != 1) return -1; |
| 49 printf("DEP is either working or not required\n"); |
| 50 |
| 47 printf("platform_qual_test: PASS\n"); | 51 printf("platform_qual_test: PASS\n"); |
| 48 return 0; | 52 return 0; |
| 49 } | 53 } |
| OLD | NEW |