Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: src/trusted/validator/ncvalidate.h

Issue 10024039: Replace kind variable from validator API with Boolean stubout parameter. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 /* The call to the validator failed, due to not enough memory. */ 56 /* The call to the validator failed, due to not enough memory. */
57 NaClValidationFailedOutOfMemory, 57 NaClValidationFailedOutOfMemory,
58 /* The call to the validator failed, due to it not being implemented yet. */ 58 /* The call to the validator failed, due to it not being implemented yet. */
59 NaClValidationFailedNotImplemented, 59 NaClValidationFailedNotImplemented,
60 /* The call to the validator failed, because the CPU is not supported. */ 60 /* The call to the validator failed, because the CPU is not supported. */
61 NaClValidationFailedCpuNotSupported, 61 NaClValidationFailedCpuNotSupported,
62 /* The call to the validator failed, due to segment alignment issues. */ 62 /* The call to the validator failed, due to segment alignment issues. */
63 NaClValidationFailedSegmentationIssue 63 NaClValidationFailedSegmentationIssue
64 } NaClValidationStatus; 64 } NaClValidationStatus;
65 65
66 /* Defines possible ways that validation can be applied. */
67 typedef enum NaClApplyValidationKind {
68 /* This applies the validator. Returns the resulting status
69 * of the validation of a code segment.
70 * Typically used for sel_ldr.
71 */
72 NaClApplyCodeValidation,
73 /* This applies the validator silently, stubbing out instructions
74 * that may not validate with a suitable halt instruction.
75 * Note: The return status of NaClValidationSucceeded in this case
76 * does not necessarily imply that all illegal instructions have
77 * been stubbed out. It is the responsability of the caller to
Mark Seaborn 2012/04/10 00:57:38 This commentary seems to be lost in this change.
Nick Bray (chromium) 2012/04/10 18:49:20 Done.
78 * call the validator a second time to see if the stubbed code
79 * is valid. Typically used as the first step of a stubout tool
80 * (either in sel_ldr or command-line tool).
81 */
82 NaClApplyValidationDoStubout,
83 /* This applies the validator, reporting errors as needed by
84 * ncval_annotate. That is, messages of the form:
85 * VALIDATOR: XXXXXX: Message
86 * where XXXXXX is an instruction address, and Message is
87 * an error message. ncval_annotate will then use this
88 * information to print out the corresponding instruction
89 * using objdump, with the corresponding error message. Returns
90 * the resulting status of the validation of a code segment.
91 * Typically used to generate input for ncval_annotate.
92 */
93 NaClApplyValidationAnnotator
Mark Seaborn 2012/04/10 00:57:38 If this is unused, it helps to say that in the com
Nick Bray (chromium) 2012/04/10 18:49:20 Done.
94 } NaClApplyValidationKind;
95
96 /* Applies the validator, as defined by sel_ldr. That is, run the 66 /* Applies the validator, as defined by sel_ldr. That is, run the
97 * validator where performance is critical. 67 * validator where performance is critical.
98 * Parameters are: 68 * Parameters are:
99 * kind - The way the validator should be applied.
100 * local_cpu: True if local cpu rules should be applied. 69 * local_cpu: True if local cpu rules should be applied.
101 * Otherwise, assume no cpu specific rules. 70 * Otherwise, assume no cpu specific rules.
102 * guest_addr - The virtual pc to assume with the beginning address of the 71 * guest_addr - The virtual pc to assume with the beginning address of the
103 * code segment. Typically, this is the corresponding addresss that 72 * code segment. Typically, this is the corresponding addresss that
104 * will be used by objdump. 73 * will be used by objdump.
105 * data - The contents of the code segment to be validated. 74 * data - The contents of the code segment to be validated.
106 * size - The size of the code segment to be validated. 75 * size - The size of the code segment to be validated.
107 * bundle_size - The number of bytes in a code bundle. 76 * bundle_size - The number of bytes in a code bundle.
77 * stubout_mode - If the validator should stub out illegal instructions.
108 * readonly_text - If code should be considered read-only. 78 * readonly_text - If code should be considered read-only.
109 * cpu_features - The CPU features to support while validating. 79 * cpu_features - The CPU features to support while validating.
110 * cache - Pointer to NaCl validation cache. 80 * cache - Pointer to NaCl validation cache.
111 */ 81 */
112 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidator, 82 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidator,
113 NACL_TARGET_ARCH, 83 NACL_TARGET_ARCH,
114 NACL_TARGET_SUBARCH)( 84 NACL_TARGET_SUBARCH)(
115 enum NaClSBKind sb_kind, 85 enum NaClSBKind sb_kind,
116 NaClApplyValidationKind kind,
117 uintptr_t guest_addr, 86 uintptr_t guest_addr,
118 uint8_t *data, 87 uint8_t *data,
119 size_t size, 88 size_t size,
120 int bundle_size, 89 int bundle_size,
90 int stubout_mode,
121 int readonly_text, 91 int readonly_text,
122 const NaClCPUFeatures *cpu_features, 92 const NaClCPUFeatures *cpu_features,
123 struct NaClValidationCache *cache); 93 struct NaClValidationCache *cache);
124 94
125 /* Applies the validator, as used in a command-line tool to report issues. 95 /* Applies the validator, as used in a command-line tool to report issues.
126 * Note: This is intentionally separated from ApplyValidator, since it need 96 * Note: This is intentionally separated from ApplyValidator, since it need
127 * not be performance critical. 97 * not be performance critical.
128 * Parameters are: 98 * Parameters are:
129 * kind - The way the validator should be applied.
130 * local_cpu: True if local cpu rules should be applied. 99 * local_cpu: True if local cpu rules should be applied.
131 * Otherwise, assume no cpu specific rules. 100 * Otherwise, assume no cpu specific rules.
132 * guest_addr - The virtual pc to assume with the beginning address of the 101 * guest_addr - The virtual pc to assume with the beginning address of the
133 * code segment. Typically, this is the corresponding addresss that 102 * code segment. Typically, this is the corresponding addresss that
134 * will be used by objdump. 103 * will be used by objdump.
135 * data - The contents of the code segment to be validated. 104 * data - The contents of the code segment to be validated.
136 * size - The size of the code segment to be validated. 105 * size - The size of the code segment to be validated.
137 * bundle_size - The number of bytes in a code bundle. 106 * bundle_size - The number of bytes in a code bundle.
138 * cpu_features - The CPU features to support while validating. 107 * cpu_features - The CPU features to support while validating.
139 */ 108 */
140 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorVerbosely, 109 extern NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorVerbosely,
141 NACL_TARGET_ARCH, 110 NACL_TARGET_ARCH,
142 NACL_TARGET_SUBARCH)( 111 NACL_TARGET_SUBARCH)(
143 enum NaClSBKind sb_kind, 112 enum NaClSBKind sb_kind,
144 NaClApplyValidationKind kind,
145 uintptr_t guest_addr, 113 uintptr_t guest_addr,
146 uint8_t *data, 114 uint8_t *data,
147 size_t size, 115 size_t size,
148 int bundle_size, 116 int bundle_size,
149 const NaClCPUFeatures *cpu_features); 117 const NaClCPUFeatures *cpu_features);
150 118
151 /* Applies validator to new code segment, assuming that it was updated 119 /* Applies validator to new code segment, assuming that it was updated
152 * from the previously validated old code segment. Assumes that instruction 120 * from the previously validated old code segment. Assumes that instruction
153 * sizes are the same. Only allows changes in branches that don't change 121 * sizes are the same. Only allows changes in branches that don't change
154 * instruction sizes. 122 * instruction sizes.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 uintptr_t guest_addr, 165 uintptr_t guest_addr,
198 uint8_t *data_old, 166 uint8_t *data_old,
199 uint8_t *data_new, 167 uint8_t *data_new,
200 size_t size, 168 size_t size,
201 int bundle_size, 169 int bundle_size,
202 const NaClCPUFeatures *cpu_features); 170 const NaClCPUFeatures *cpu_features);
203 171
204 EXTERN_C_END 172 EXTERN_C_END
205 173
206 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */ 174 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_H__ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698