| 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 /* Implement the ApplyValidatorVerbosely API for the x86-32 architecture. */ | 7 /* Implement the ApplyValidatorVerbosely API for the x86-32 architecture. */ |
| 8 | 8 |
| 9 #include "native_client/src/trusted/validator/ncvalidate.h" | 9 #include "native_client/src/trusted/validator/ncvalidate.h" |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 NCValidateSetErrorReporter(vstate, &kNCVerboseErrorReporter); | 40 NCValidateSetErrorReporter(vstate, &kNCVerboseErrorReporter); |
| 41 NCValidateSegment(data, guest_addr, size, vstate); | 41 NCValidateSegment(data, guest_addr, size, vstate); |
| 42 validator_result = NCValidateFinish(vstate); | 42 validator_result = NCValidateFinish(vstate); |
| 43 NCValidateFreeState(&vstate); | 43 NCValidateFreeState(&vstate); |
| 44 return (validator_result == 0) | 44 return (validator_result == 0) |
| 45 ? NaClValidationSucceeded : NaClValidationFailed; | 45 ? NaClValidationSucceeded : NaClValidationFailed; |
| 46 } | 46 } |
| 47 | 47 |
| 48 NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorVerbosely, x86, 32) | 48 NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorVerbosely, x86, 32) |
| 49 (enum NaClSBKind sb_kind, | 49 (enum NaClSBKind sb_kind, |
| 50 NaClApplyValidationKind kind, | |
| 51 uintptr_t guest_addr, | 50 uintptr_t guest_addr, |
| 52 uint8_t *data, | 51 uint8_t *data, |
| 53 size_t size, | 52 size_t size, |
| 54 int bundle_size, | 53 int bundle_size, |
| 55 const NaClCPUFeaturesX86 *cpu_features) { | 54 const NaClCPUFeaturesX86 *cpu_features) { |
| 56 NaClValidationStatus status = NaClValidationFailedNotImplemented; | 55 NaClValidationStatus status = NaClValidationFailedNotImplemented; |
| 57 assert(NACL_SB_DEFAULT == sb_kind); | 56 assert(NACL_SB_DEFAULT == sb_kind); |
| 58 if (bundle_size == 16 || bundle_size == 32) { | 57 if (bundle_size == 16 || bundle_size == 32) { |
| 59 if (!NaClArchSupported(cpu_features)) | 58 if (!NaClArchSupported(cpu_features)) |
| 60 return NaClValidationFailedCpuNotSupported; | 59 return NaClValidationFailedCpuNotSupported; |
| 61 switch (kind) { | 60 status = NCApplyValidatorVerbosely_x86_32( |
| 62 case NaClApplyCodeValidation: | 61 guest_addr, data, size, bundle_size, cpu_features); |
| 63 status = NCApplyValidatorVerbosely_x86_32( | |
| 64 guest_addr, data, size, bundle_size, cpu_features); | |
| 65 break; | |
| 66 case NaClApplyValidationDoStubout: | |
| 67 status = NCApplyValidatorStubout_x86_32( | |
| 68 guest_addr, data, size, bundle_size, cpu_features); | |
| 69 break; | |
| 70 default: | |
| 71 /* If reached, it isn't implemented (yet). */ | |
| 72 break; | |
| 73 } | |
| 74 } | 62 } |
| 75 return status; | 63 return status; |
| 76 } | 64 } |
| OLD | NEW |