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 NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_CPUID_MIPS_H_ | |
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_CPUID_MIPS_H_ | |
9 | |
10 #include "native_client/src/include/nacl_compiler_annotations.h" | |
11 #include "native_client/src/include/nacl_macros.h" | |
12 #include "native_client/src/include/portability.h" | |
13 #include "native_client/src/trusted/validator/ncvalidate.h" | |
14 | |
15 | |
16 EXTERN_C_BEGIN | |
17 | |
18 /* List of features supported by MIPS CPUs. */ | |
19 typedef enum { | |
20 #define NACL_MIPS_CPU_FEATURE(name) NACL_CONCAT(NaClCPUFeatureMips_, name), | |
21 #include "native_client/src/trusted/validator_mips/cpuid_mips_features.h" | |
22 #undef NACL_MIPS_CPU_FEATURE | |
23 /* Leave the following as the last entry. */ | |
24 NaClCPUFeatureMips_Max | |
25 } NaClCPUFeatureMipsID; | |
26 | |
27 typedef struct cpu_feature_struct_mips { | |
28 char data[NaClCPUFeatureMips_Max]; | |
29 } NaClCPUFeaturesMips; | |
30 | |
31 /* | |
32 * Platform-independent NaClValidatorInterface functions. | |
33 */ | |
34 void NaClSetAllCPUFeaturesMips(NaClCPUFeatures *features); | |
35 void NaClGetCurrentCPUFeaturesMips(NaClCPUFeatures *features); | |
36 int NaClFixCPUFeaturesMips(NaClCPUFeatures *features); | |
37 | |
38 /* | |
39 * Platform-dependent getter/setter. | |
40 */ | |
41 static INLINE int NaClGetCPUFeatureMips(const NaClCPUFeaturesMips *features, | |
42 NaClCPUFeatureMipsID id) { | |
43 return features->data[id]; | |
44 } | |
45 | |
46 void NaClSetCPUFeatureMips(NaClCPUFeaturesMips *features, | |
47 NaClCPUFeatureMipsID id, int state); | |
48 const char *NaClGetCPUFeatureMipsName(NaClCPUFeatureMipsID id); | |
49 | |
50 /* | |
51 * Platform-independent functions which are only used in platform-dependent | |
52 * code. | |
53 */ | |
54 void NaClClearCPUFeaturesMips(NaClCPUFeaturesMips *features); | |
55 /* | |
56 * TODO(jfb) The x86 CPU features also offers these functions, which are | |
57 * currently notused on MIPS: NaClCopyCPUFeaturesMips, NaClArchSupportedMips. | |
58 */ | |
59 | |
60 EXTERN_C_END | |
61 | |
62 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_MIPS_CPUID_MIPS_H_ | |
OLD | NEW |