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 : #include "native_client/src/trusted/service_runtime/sel_qualify.h"
8 :
9 : #include "native_client/src/trusted/platform_qualify/nacl_cpuwhitelist.h"
10 : #include "native_client/src/trusted/platform_qualify/nacl_dep_qualify.h"
11 : #include "native_client/src/trusted/platform_qualify/nacl_os_qualify.h"
12 : #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm
13 : #include "native_client/src/trusted/platform_qualify/arch/arm/nacl_arm_qualify.h"
14 : #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips
15 : #include "native_client/src/trusted/platform_qualify/arch/mips/nacl_mips_qualify.h"
16 : #endif
17 :
18 : NaClErrorCode NaClRunSelQualificationTests(void) {
19 265 : if (!NaClOsIsSupported()) {
20 0 : return LOAD_UNSUPPORTED_OS_PLATFORM;
21 : }
22 :
23 : /* Mips does not support DEP and it does not need it, so skip it. */
24 : #if NACL_ARCH(NACL_BUILD_ARCH) != NACL_mips
25 265 : if (!NaClCheckDEP()) {
26 0 : return LOAD_DEP_UNSUPPORTED;
27 : }
28 : #endif
29 :
30 : #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86
31 265 : if (NaCl_ThisCPUIsBlacklisted()) {
32 0 : return LOAD_UNSUPPORTED_CPU;
33 : }
34 : #endif
35 :
36 : #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_arm
37 : if (!NaClQualifyFpu() ||
38 : !NaClQualifySandboxInstrs() ||
39 : !NaClQualifyUnaligned()) {
40 : return LOAD_UNSUPPORTED_CPU;
41 : }
42 : #endif
43 :
44 : #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips
45 : if (!NaClQualifyFpu()) {
46 : return LOAD_UNSUPPORTED_CPU;
47 : }
48 : #endif
49 :
50 265 : return LOAD_OK;
51 265 : }
|