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 exposed by the Native Client validators. */ | 10 /* Defines the API exposed by the Native Client validators. */ |
| 11 | 11 |
| 12 #include "native_client/src/include/build_config.h" | 12 #include "native_client/src/include/build_config.h" |
| 13 #include "native_client/src/include/nacl_base.h" | 13 #include "native_client/src/include/nacl_base.h" |
| 14 #include "native_client/src/include/portability.h" | 14 #include "native_client/src/include/portability.h" |
| 15 #include "native_client/src/trusted/cpu_features/cpu_features.h" | 15 #include "native_client/src/trusted/cpu_features/cpu_features.h" |
| 16 | 16 |
| 17 | 17 |
| 18 EXTERN_C_BEGIN | 18 EXTERN_C_BEGIN |
| 19 | 19 |
| 20 struct NaClValidationCache; | 20 struct NaClValidationCache; |
| 21 struct NaClValidationMetadata; | 21 struct NaClValidationMetadata; |
| 22 | 22 |
| 23 /* Defines possible validation flags. */ | |
| 24 typedef enum NaClValidationFlags { | |
| 25 DISABLE_NONTEMPORALS = 0x1, | |
| 26 X86_VALIDATION_FLAGS_MASK = 0x1, | |
|
Mark Seaborn
2015/07/29 16:09:23
Nit: these should really have a "NACL_" prefix to
| |
| 27 ARM_VALIDATION_FLAGS_MASK = 0x0, | |
| 28 MIPS_VALIDATION_FLAGS_MASK = 0x0 | |
| 29 } NaClValidationFlags; | |
| 30 | |
| 23 /* Defines possible validation status values. */ | 31 /* Defines possible validation status values. */ |
| 24 typedef enum NaClValidationStatus { | 32 typedef enum NaClValidationStatus { |
| 25 /* The call to the validator succeeded. */ | 33 /* The call to the validator succeeded. */ |
| 26 NaClValidationSucceeded, | 34 NaClValidationSucceeded, |
| 27 /* The call to the validator failed (Reason unspecified) */ | 35 /* The call to the validator failed (Reason unspecified) */ |
| 28 NaClValidationFailed, | 36 NaClValidationFailed, |
| 29 /* The call to the validator failed, due to not enough memory. */ | 37 /* The call to the validator failed, due to not enough memory. */ |
| 30 NaClValidationFailedOutOfMemory, | 38 NaClValidationFailedOutOfMemory, |
| 31 /* The call to the validator failed, due to it not being implemented yet. */ | 39 /* The call to the validator failed, due to it not being implemented yet. */ |
| 32 NaClValidationFailedNotImplemented, | 40 NaClValidationFailedNotImplemented, |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 56 * in sel_ldr or command-line tool). | 64 * in sel_ldr or command-line tool). |
| 57 * readonly_text - If code should be considered read-only. | 65 * readonly_text - If code should be considered read-only. |
| 58 * cpu_features - The CPU features to support while validating. | 66 * cpu_features - The CPU features to support while validating. |
| 59 * cache - Pointer to NaCl validation cache. | 67 * cache - Pointer to NaCl validation cache. |
| 60 */ | 68 */ |
| 61 typedef NaClValidationStatus (*NaClValidateFunc)( | 69 typedef NaClValidationStatus (*NaClValidateFunc)( |
| 62 uintptr_t guest_addr, | 70 uintptr_t guest_addr, |
| 63 uint8_t *data, | 71 uint8_t *data, |
| 64 size_t size, | 72 size_t size, |
| 65 int stubout_mode, | 73 int stubout_mode, |
| 74 uint32_t flags, | |
| 66 int readonly_text, | 75 int readonly_text, |
| 67 const NaClCPUFeatures *cpu_features, | 76 const NaClCPUFeatures *cpu_features, |
| 68 const struct NaClValidationMetadata *metadata, | 77 const struct NaClValidationMetadata *metadata, |
| 69 struct NaClValidationCache *cache); | 78 struct NaClValidationCache *cache); |
| 70 | 79 |
| 71 /* Function type to copy an instruction safely. Returns non-zero on success. | 80 /* Function type to copy an instruction safely. Returns non-zero on success. |
| 72 * Implemented by the Service Runtime. | 81 * Implemented by the Service Runtime. |
| 73 */ | 82 */ |
| 74 typedef int (*NaClCopyInstructionFunc)( | 83 typedef int (*NaClCopyInstructionFunc)( |
| 75 uint8_t *dst, | 84 uint8_t *dst, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 NACL_BUILD_ARCH, | 212 NACL_BUILD_ARCH, |
| 204 NACL_BUILD_SUBARCH)( | 213 NACL_BUILD_SUBARCH)( |
| 205 uintptr_t guest_addr, | 214 uintptr_t guest_addr, |
| 206 uint8_t *data, | 215 uint8_t *data, |
| 207 size_t size, | 216 size_t size, |
| 208 const NaClCPUFeatures *cpu_features); | 217 const NaClCPUFeatures *cpu_features); |
| 209 | 218 |
| 210 EXTERN_C_END | 219 EXTERN_C_END |
| 211 | 220 |
| 212 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ | 221 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ |
| OLD | NEW |