| 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 #include "native_client/src/trusted/validator_arm/ncvalidate.h" | 7 #include "native_client/src/trusted/validator_arm/ncvalidate.h" |
| 8 | 8 |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 vector<CodeSegment> segments; | 60 vector<CodeSegment> segments; |
| 61 segments.push_back(CodeSegment(mbase, vbase, size)); | 61 segments.push_back(CodeSegment(mbase, vbase, size)); |
| 62 | 62 |
| 63 bool success = validator.validate(segments, &sink); | 63 bool success = validator.validate(segments, &sink); |
| 64 if (!success) return 2; // for compatibility with old validator | 64 if (!success) return 2; // for compatibility with old validator |
| 65 return 0; | 65 return 0; |
| 66 } | 66 } |
| 67 | 67 |
| 68 NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidator, arm, 32) ( | 68 NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidator, arm, 32) ( |
| 69 enum NaClSBKind sb_kind, | 69 enum NaClSBKind sb_kind, |
| 70 NaClApplyValidationKind kind, | |
| 71 uintptr_t guest_addr, | 70 uintptr_t guest_addr, |
| 72 uint8_t *data, | 71 uint8_t *data, |
| 73 size_t size, | 72 size_t size, |
| 74 int bundle_size, | 73 int bundle_size, |
| 74 int stubout_mode, |
| 75 int readonly_text, | 75 int readonly_text, |
| 76 const NaClCPUFeaturesArm *cpu_features, | 76 const NaClCPUFeaturesArm *cpu_features, |
| 77 struct NaClValidationCache *cache) { | 77 struct NaClValidationCache *cache) { |
| 78 NaClValidationStatus status = NaClValidationFailedNotImplemented; | 78 NaClValidationStatus status = NaClValidationFailedNotImplemented; |
| 79 UNREFERENCED_PARAMETER(cpu_features); | 79 UNREFERENCED_PARAMETER(cpu_features); |
| 80 UNREFERENCED_PARAMETER(sb_kind); | 80 UNREFERENCED_PARAMETER(sb_kind); |
| 81 /* The ARM validator is currently unsafe w.r.t. caching. */ | 81 /* The ARM validator is currently unsafe w.r.t. caching. */ |
| 82 UNREFERENCED_PARAMETER(cache); | 82 UNREFERENCED_PARAMETER(cache); |
| 83 if (stubout_mode) return NaClValidationFailedNotImplemented; |
| 83 if (readonly_text) return NaClValidationFailedNotImplemented; | 84 if (readonly_text) return NaClValidationFailedNotImplemented; |
| 84 if (bundle_size == 16) { | 85 if (bundle_size == 16) { |
| 85 if (kind == NaClApplyCodeValidation) { | 86 status = ((0 == NCValidateSegment(data, guest_addr, size)) |
| 86 status = ((0 == NCValidateSegment(data, guest_addr, size)) | 87 ? NaClValidationSucceeded : NaClValidationFailed); |
| 87 ? NaClValidationSucceeded : NaClValidationFailed); | |
| 88 } | |
| 89 } | 88 } |
| 90 return status; | 89 return status; |
| 91 } | 90 } |
| 92 | 91 |
| 93 NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorCodeReplacement, arm, 32) | 92 NaClValidationStatus NACL_SUBARCH_NAME(ApplyValidatorCodeReplacement, arm, 32) |
| 94 (enum NaClSBKind sb_kind, | 93 (enum NaClSBKind sb_kind, |
| 95 uintptr_t guest_addr, | 94 uintptr_t guest_addr, |
| 96 uint8_t *data_old, | 95 uint8_t *data_old, |
| 97 uint8_t *data_new, | 96 uint8_t *data_new, |
| 98 size_t size, | 97 size_t size, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 120 UNREFERENCED_PARAMETER(guest_addr); | 119 UNREFERENCED_PARAMETER(guest_addr); |
| 121 UNREFERENCED_PARAMETER(data_old); | 120 UNREFERENCED_PARAMETER(data_old); |
| 122 UNREFERENCED_PARAMETER(data_new); | 121 UNREFERENCED_PARAMETER(data_new); |
| 123 UNREFERENCED_PARAMETER(size); | 122 UNREFERENCED_PARAMETER(size); |
| 124 UNREFERENCED_PARAMETER(bundle_size); | 123 UNREFERENCED_PARAMETER(bundle_size); |
| 125 UNREFERENCED_PARAMETER(cpu_features); | 124 UNREFERENCED_PARAMETER(cpu_features); |
| 126 return NaClValidationFailedNotImplemented; | 125 return NaClValidationFailedNotImplemented; |
| 127 } | 126 } |
| 128 | 127 |
| 129 EXTERN_C_END | 128 EXTERN_C_END |
| OLD | NEW |