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 NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ |
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ | 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ |
9 | 9 |
10 /* Defines the API to the native client validation code. | 10 /* Defines the API to the native client validation code. |
11 * | 11 * |
12 * Note that the API is designed to use the NACL_SUBARCH_NAME | 12 * Note that the API is designed to use the NACL_SUBARCH_NAME |
13 * macro. This macro encapsulates the target architecture the | 13 * macro. This macro encapsulates the target architecture the |
14 * code is being compiled for into the name of the function. | 14 * code is being compiled for into the name of the function. |
15 * This lets the API call different functions based on the | 15 * This lets the API call different functions based on the |
16 * target architecture the code is being compiled for. It also allows | 16 * target architecture the code is being compiled for. It also allows |
17 * the maintainers of the compiled libraries to change the implementation | 17 * the maintainers of the compiled libraries to change the implementation |
18 * without having to update the API callers. | 18 * without having to update the API callers. |
19 * | 19 * |
20 * The macro NACL_SUBARCH_NAME(name, arch, subarch) prepends "NaCl_" | 20 * The macro NACL_SUBARCH_NAME(name, arch, subarch) prepends "NaCl_" |
21 * to the function name, and suffixes it with the architecture and | 21 * to the function name, and suffixes it with the architecture and |
22 * corresponding subarchitecture (with underscores separating it). | 22 * corresponding subarchitecture (with underscores separating it). |
23 * Hence, for example, NACL_SUBARCH_NAME(ApplyValidator, x86, 64) | 23 * Hence, for example, NACL_SUBARCH_NAME(ApplyValidator, x86, 64) |
24 * would generate the function name NaCL_ApplyValidator_x86_64. | 24 * would generate the function name NaCL_ApplyValidator_x86_64. |
25 */ | 25 */ |
26 | 26 |
27 #include "native_client/src/include/nacl_base.h" | 27 #include "native_client/src/include/nacl_base.h" |
28 #include "native_client/src/shared/utils/types.h" | 28 #include "native_client/src/shared/utils/types.h" |
29 #include "native_client/src/trusted/validator/cpufeatures.h" | 29 #include "native_client/src/trusted/validator/cpufeatures.h" |
| 30 #include "native_client/src/trusted/validator/validation_cache.h" |
30 | 31 |
31 EXTERN_C_BEGIN | 32 EXTERN_C_BEGIN |
32 | 33 |
33 /* Defines the API to select the validator kind. | 34 /* Defines the API to select the validator kind. |
34 * So far only the ARM architecture has a non-default validator kind | 35 * So far only the ARM architecture has a non-default validator kind |
35 * | 36 * |
36 * NaClSBKind can be architecture specific, but requries more | 37 * NaClSBKind can be architecture specific, but requries more |
37 * scaffolding. So it is probably not worth while to split up the flag. | 38 * scaffolding. So it is probably not worth while to split up the flag. |
38 */ | 39 */ |
39 enum NaClSBKind { | 40 enum NaClSBKind { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 */ | 104 */ |
104 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidator, | 105 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidator, |
105 NACL_TARGET_ARCH, | 106 NACL_TARGET_ARCH, |
106 NACL_TARGET_SUBARCH)( | 107 NACL_TARGET_SUBARCH)( |
107 enum NaClSBKind sb_kind, | 108 enum NaClSBKind sb_kind, |
108 NaClApplyValidationKind kind, | 109 NaClApplyValidationKind kind, |
109 uintptr_t guest_addr, | 110 uintptr_t guest_addr, |
110 uint8_t *data, | 111 uint8_t *data, |
111 size_t size, | 112 size_t size, |
112 int bundle_size, | 113 int bundle_size, |
113 NaClCPUFeatures *cpu_features); | 114 NaClCPUFeatures *cpu_features, |
| 115 NaClValidationCache *cache, |
| 116 void *cache_context); |
114 | 117 |
115 /* Applies the validator, as used in a command-line tool to report issues. | 118 /* Applies the validator, as used in a command-line tool to report issues. |
116 * Note: This is intentionally separated from ApplyValidator, since it need | 119 * Note: This is intentionally separated from ApplyValidator, since it need |
117 * not be performance critical. | 120 * not be performance critical. |
118 * Parameters are: | 121 * Parameters are: |
119 * kind - The way the validator should be applied. | 122 * kind - The way the validator should be applied. |
120 * local_cpu: True if local cpu rules should be applied. | 123 * local_cpu: True if local cpu rules should be applied. |
121 * Otherwise, assume no cpu specific rules. | 124 * Otherwise, assume no cpu specific rules. |
122 * guest_addr - The virtual pc to assume with the beginning address of the | 125 * guest_addr - The virtual pc to assume with the beginning address of the |
123 * code segment. Typically, this is the corresponding addresss that | 126 * code segment. Typically, this is the corresponding addresss that |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 uintptr_t guest_addr, | 190 uintptr_t guest_addr, |
188 uint8_t *data_old, | 191 uint8_t *data_old, |
189 uint8_t *data_new, | 192 uint8_t *data_new, |
190 size_t size, | 193 size_t size, |
191 int bundle_size, | 194 int bundle_size, |
192 NaClCPUFeatures *cpu_features); | 195 NaClCPUFeatures *cpu_features); |
193 | 196 |
194 EXTERN_C_END | 197 EXTERN_C_END |
195 | 198 |
196 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ | 199 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ |
OLD | NEW |