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 <climits> | 7 #include <climits> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 *is_position_independent = validator.is_position_independent(); | 136 *is_position_independent = validator.is_position_independent(); |
137 if (!success) return 2; // for compatibility with old validator | 137 if (!success) return 2; // for compatibility with old validator |
138 return 0; | 138 return 0; |
139 } | 139 } |
140 | 140 |
141 static NaClValidationStatus ApplyValidatorArm( | 141 static NaClValidationStatus ApplyValidatorArm( |
142 uintptr_t guest_addr, | 142 uintptr_t guest_addr, |
143 uint8_t *data, | 143 uint8_t *data, |
144 size_t size, | 144 size_t size, |
145 int stubout_mode, | 145 int stubout_mode, |
146 uint32_t flags, | |
146 int readonly_text, | 147 int readonly_text, |
147 const NaClCPUFeatures *cpu_features, | 148 const NaClCPUFeatures *cpu_features, |
148 const struct NaClValidationMetadata *metadata, | 149 const struct NaClValidationMetadata *metadata, |
149 struct NaClValidationCache *cache) { | 150 struct NaClValidationCache *cache) { |
150 // The ARM validator never modifies the text, so this flag can be ignored. | 151 // The ARM validator never modifies the text, so this flag can be ignored. |
151 UNREFERENCED_PARAMETER(readonly_text); | 152 UNREFERENCED_PARAMETER(readonly_text); |
153 CHECK((flags & ARM_VALIDATION_FLAGS_MASK) == 0); | |
Mark Seaborn
2015/07/29 16:09:23
What's the purpose of this, given that ARM_VALIDAT
| |
152 CheckAddressAlignAndOverflow((uint8_t *) guest_addr, size); | 154 CheckAddressAlignAndOverflow((uint8_t *) guest_addr, size); |
153 CheckAddressOverflow(data, size); | 155 CheckAddressOverflow(data, size); |
154 CheckAddressOverflow(data, size); | 156 CheckAddressOverflow(data, size); |
155 | 157 |
156 if (stubout_mode) | 158 if (stubout_mode) |
157 return NaClValidationFailedNotImplemented; | 159 return NaClValidationFailedNotImplemented; |
158 | 160 |
159 CHECK(guest_addr <= std::numeric_limits<uint32_t>::max()); | 161 CHECK(guest_addr <= std::numeric_limits<uint32_t>::max()); |
160 | 162 |
161 // These checks are redundant with ones done inside the validator. It is done | 163 // These checks are redundant with ones done inside the validator. It is done |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 // so is their mix (single instruction update is atomic). | 285 // so is their mix (single instruction update is atomic). |
284 // We just have to make sure that unintended fallthrough doesn't | 286 // We just have to make sure that unintended fallthrough doesn't |
285 // happen, and we don't change position of guard instructions. | 287 // happen, and we don't change position of guard instructions. |
286 // Problem is that code is mapped for execution at different address | 288 // Problem is that code is mapped for execution at different address |
287 // that one we use here, and ARM usually use virtually indexed caches, | 289 // that one we use here, and ARM usually use virtually indexed caches, |
288 // so we couldn't invalidate correctly anyway. | 290 // so we couldn't invalidate correctly anyway. |
289 return 0; | 291 return 0; |
290 } | 292 } |
291 | 293 |
292 EXTERN_C_END | 294 EXTERN_C_END |
OLD | NEW |