Chromium Code Reviews| 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. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 * would generate the function name NaCL_ApplyValidator_x86_64. | 24 * would generate the function name NaCL_ApplyValidator_x86_64. |
| 25 */ | 25 */ |
| 26 /* TODO(bradchen): Cleanup the interface to the validator. There | 26 /* TODO(bradchen): Cleanup the interface to the validator. There |
| 27 * are too many combinations of different calls and input parameters, | 27 * are too many combinations of different calls and input parameters, |
| 28 * making this interface hard to understand and hard to modify. | 28 * making this interface hard to understand and hard to modify. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "native_client/src/include/nacl_base.h" | 31 #include "native_client/src/include/nacl_base.h" |
| 32 #include "native_client/src/shared/utils/types.h" | 32 #include "native_client/src/shared/utils/types.h" |
| 33 #include "native_client/src/trusted/validator/cpufeatures.h" | 33 #include "native_client/src/trusted/validator/cpufeatures.h" |
| 34 #include "native_client/src/trusted/validator/validation_status.h" | |
| 34 | 35 |
| 35 EXTERN_C_BEGIN | 36 EXTERN_C_BEGIN |
| 36 | 37 |
| 37 struct NaClValidationCache; | 38 struct NaClValidationCache; |
| 38 | 39 |
| 39 /* Defines possible validation status values. */ | |
|
Nick Bray
2012/04/25 20:57:42
See previous comments, it may make sense to keep t
pasko-google - do not use
2012/04/26 15:17:01
Done.
| |
| 40 typedef enum NaClValidationStatus { | |
| 41 /* The call to the validator succeeded. */ | |
| 42 NaClValidationSucceeded, | |
| 43 /* The call to the validator failed (Reason unspecified) */ | |
| 44 NaClValidationFailed, | |
| 45 /* The call to the validator failed, due to not enough memory. */ | |
| 46 NaClValidationFailedOutOfMemory, | |
| 47 /* The call to the validator failed, due to it not being implemented yet. */ | |
| 48 NaClValidationFailedNotImplemented, | |
| 49 /* The call to the validator failed, because the CPU is not supported. */ | |
| 50 NaClValidationFailedCpuNotSupported, | |
| 51 /* The call to the validator failed, due to segment alignment issues. */ | |
| 52 NaClValidationFailedSegmentationIssue | |
| 53 } NaClValidationStatus; | |
| 54 | |
| 55 /* Applies the validator, as defined by sel_ldr. That is, run the | 40 /* Applies the validator, as defined by sel_ldr. That is, run the |
| 56 * validator where performance is critical. | 41 * validator where performance is critical. |
| 57 * Parameters are: | 42 * Parameters are: |
| 58 * local_cpu: True if local cpu rules should be applied. | |
| 59 * Otherwise, assume no cpu specific rules. | |
| 60 * guest_addr - The virtual pc to assume with the beginning address of the | 43 * guest_addr - The virtual pc to assume with the beginning address of the |
| 61 * code segment. Typically, this is the corresponding addresss that | 44 * code segment. Typically, this is the corresponding addresss that |
| 62 * will be used by objdump. | 45 * will be used by objdump. |
| 63 * data - The contents of the code segment to be validated. | 46 * data - The contents of the code segment to be validated. |
| 64 * size - The size of the code segment to be validated. | 47 * size - The size of the code segment to be validated. |
| 65 * stubout_mode - Whether the validator should stub out disallowed | 48 * stubout_mode - Whether the validator should stub out disallowed |
| 66 * instructions. This applies the validator silently, stubbing out | 49 * instructions. This applies the validator silently, stubbing out |
| 67 * instructions that may not validate with a suitable halt | 50 * instructions that may not validate with a suitable halt |
| 68 * instruction. Note: The return status of NaClValidationSucceeded in | 51 * instruction. Note: The return status of NaClValidationSucceeded in |
| 69 * this case does not necessarily imply that all illegal instructions | 52 * this case does not necessarily imply that all illegal instructions |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 99 size_t size, | 82 size_t size, |
| 100 int stubout_mode, | 83 int stubout_mode, |
| 101 int readonly_text, | 84 int readonly_text, |
| 102 const NaClCPUFeatures *cpu_features, | 85 const NaClCPUFeatures *cpu_features, |
| 103 struct NaClValidationCache *cache); | 86 struct NaClValidationCache *cache); |
| 104 | 87 |
| 105 /* Applies the validator, as used in a command-line tool to report issues. | 88 /* Applies the validator, as used in a command-line tool to report issues. |
| 106 * Note: This is intentionally separated from ApplyValidator, since it need | 89 * Note: This is intentionally separated from ApplyValidator, since it need |
| 107 * not be performance critical. | 90 * not be performance critical. |
| 108 * Parameters are: | 91 * Parameters are: |
| 109 * local_cpu: True if local cpu rules should be applied. | |
| 110 * Otherwise, assume no cpu specific rules. | |
| 111 * guest_addr - The virtual pc to assume with the beginning address of the | 92 * guest_addr - The virtual pc to assume with the beginning address of the |
| 112 * code segment. Typically, this is the corresponding addresss that | 93 * code segment. Typically, this is the corresponding addresss that |
| 113 * will be used by objdump. | 94 * will be used by objdump. |
| 114 * data - The contents of the code segment to be validated. | 95 * data - The contents of the code segment to be validated. |
| 115 * size - The size of the code segment to be validated. | 96 * size - The size of the code segment to be validated. |
| 116 * cpu_features - The CPU features to support while validating. | 97 * cpu_features - The CPU features to support while validating. |
| 117 */ | 98 */ |
| 118 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorVerbosely, | 99 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorVerbosely, |
| 119 NACL_TARGET_ARCH, | 100 NACL_TARGET_ARCH, |
| 120 NACL_TARGET_SUBARCH)( | 101 NACL_TARGET_SUBARCH)( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 NACL_TARGET_SUBARCH)( | 147 NACL_TARGET_SUBARCH)( |
| 167 uintptr_t guest_addr, | 148 uintptr_t guest_addr, |
| 168 uint8_t *data_old, | 149 uint8_t *data_old, |
| 169 uint8_t *data_new, | 150 uint8_t *data_new, |
| 170 size_t size, | 151 size_t size, |
| 171 const NaClCPUFeatures *cpu_features); | 152 const NaClCPUFeatures *cpu_features); |
| 172 | 153 |
| 173 EXTERN_C_END | 154 EXTERN_C_END |
| 174 | 155 |
| 175 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ | 156 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ |
| OLD | NEW |