OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The Native Client Authors. All rights reserved. | 2 * Copyright 2009 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_ITER_H__ | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_ITER_H__ |
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_ITER_H__ | 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_ITER_H__ |
9 | 9 |
10 /* | 10 /* |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 * vbase - The virtual address associated with the beginning of the code | 188 * vbase - The virtual address associated with the beginning of the code |
189 * segment. | 189 * segment. |
190 * sz - The number of bytes in the code segment. | 190 * sz - The number of bytes in the code segment. |
191 * state - The validator state to use while validating. | 191 * state - The validator state to use while validating. |
192 */ | 192 */ |
193 void NaClValidateSegment(uint8_t* mbase, | 193 void NaClValidateSegment(uint8_t* mbase, |
194 NaClPcAddress vbase, | 194 NaClPcAddress vbase, |
195 NaClMemorySize sz, | 195 NaClMemorySize sz, |
196 NaClValidatorState* state); | 196 NaClValidatorState* state); |
197 | 197 |
| 198 /* |
| 199 * Validate a segment for dynamic code replacement |
| 200 * Checks if code at mbase_old can be replaced with code at mbase_new |
| 201 * Note that mbase_old was validated when it was inserted originally. |
| 202 * If validation fails, state->validates_ok will be set to false. |
| 203 * Parameters: |
| 204 * mbase_old - The address of the beginning of the code segment to be |
| 205 * replaced |
| 206 * mbase_new - The address of the code segment that replaces the old |
| 207 * segment |
| 208 * vbase - Virtual address that is associated with both segments |
| 209 * size - Length of the code segments (the segments must be of the same |
| 210 * size) |
| 211 * state - The validator state to use while validating *new* segment |
| 212 */ |
| 213 void NaClValidateSegmentPair(uint8_t *mbase_old, |
| 214 uint8_t *mbase_new, |
| 215 NaClPcAddress vbase, |
| 216 size_t size, |
| 217 struct NaClValidatorState *state); |
| 218 |
198 /* Returns true if the validator hasn't found any problems with the validated | 219 /* Returns true if the validator hasn't found any problems with the validated |
199 * code segments. | 220 * code segments. |
200 * Parameters: | 221 * Parameters: |
201 * state - The validator state used to validate code segments. | 222 * state - The validator state used to validate code segments. |
202 * Returns: | 223 * Returns: |
203 * true only if no problems have been found. | 224 * true only if no problems have been found. |
204 */ | 225 */ |
205 Bool NaClValidatesOk(NaClValidatorState* state); | 226 Bool NaClValidatesOk(NaClValidatorState* state); |
206 | 227 |
207 /* Cleans up and returns the memory created by the corresponding | 228 /* Cleans up and returns the memory created by the corresponding |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 * inst - The instruction that caused the vaidator error. | 360 * inst - The instruction that caused the vaidator error. |
340 * format - The format string of the message to print. | 361 * format - The format string of the message to print. |
341 * ... - arguments to the format string. | 362 * ... - arguments to the format string. |
342 */ | 363 */ |
343 void NaClValidatorInstMessage(int level, | 364 void NaClValidatorInstMessage(int level, |
344 NaClValidatorState* state, | 365 NaClValidatorState* state, |
345 NaClInstState* inst, | 366 NaClInstState* inst, |
346 const char* format, | 367 const char* format, |
347 ...) ATTRIBUTE_FORMAT_PRINTF(4, 5); | 368 ...) ATTRIBUTE_FORMAT_PRINTF(4, 5); |
348 | 369 |
| 370 /* Prints out a validator message and two given instructions. |
| 371 * Parameters: |
| 372 * level - The level of the message, as defined in nacl_log.h |
| 373 * state - The validator state that detected the error. |
| 374 * inst1 - The first instruction to be printed. |
| 375 * inst2 - The second instruction to be printed. |
| 376 * format - The format string of the message to print. |
| 377 * ... - arguments to the format string. |
| 378 */ |
| 379 void NaClValidatorTwoInstMessage(int level, |
| 380 NaClValidatorState* state, |
| 381 NaClInstState* inst1, |
| 382 NaClInstState* inst2, |
| 383 const char* format, |
| 384 ...) ATTRIBUTE_FORMAT_PRINTF(5, 6); |
| 385 |
349 /* Returns true if the validator should quit due to previous errors. */ | 386 /* Returns true if the validator should quit due to previous errors. */ |
350 Bool NaClValidatorQuit(NaClValidatorState* state); | 387 Bool NaClValidatorQuit(NaClValidatorState* state); |
351 | 388 |
352 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_ITER_H__ */ | 389 #endif /* NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_X86_NCVALIDATE_ITER_H__ */ |
OLD | NEW |