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

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

Issue 10356115: Clean up code to clarify we are only tracking the condition flags of APSR. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « src/trusted/validator_arm/model.h ('k') | src/trusted/validator_arm/validator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_ARM_V2_VALIDATOR_H 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_VALIDATOR_H
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_VALIDATOR_H 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_VALIDATOR_H
9 9
10 /* 10 /*
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 * 'this' produces a sandboxed value that 'other' must consume. 217 * 'this' produces a sandboxed value that 'other' must consume.
218 * 218 *
219 * Note: This function is conservative in that if it isn't sure whether 219 * Note: This function is conservative in that if it isn't sure whether
220 * this instruction changes the condition, it assumes that it does. 220 * this instruction changes the condition, it assumes that it does.
221 * 221 *
222 * Note that this function can't see the bundle size, so this result does not 222 * Note that this function can't see the bundle size, so this result does not
223 * take it into account. The SfiValidator reasons on this separately. 223 * take it into account. The SfiValidator reasons on this separately.
224 */ 224 */
225 bool always_precedes(const DecodedInstruction &other) const { 225 bool always_precedes(const DecodedInstruction &other) const {
226 return inst_.condition() == other.inst_.condition() && 226 return inst_.condition() == other.inst_.condition() &&
227 !defines(nacl_arm_dec::kRegisterFlags); 227 !defines(nacl_arm_dec::kConditions);
228 } 228 }
229 229
230 /* 230 /*
231 * Checks that 'this' always follows 'other' -- meaning that if 'other' 231 * Checks that 'this' always follows 'other' -- meaning that if 'other'
232 * executes, 'this' is guaranteed to follow. This is important if 'other' 232 * executes, 'this' is guaranteed to follow. This is important if 'other'
233 * produces an unsafe value that 'this' fixes before it can leak out. 233 * produces an unsafe value that 'this' fixes before it can leak out.
234 * 234 *
235 * Note: This function is conservative in that if it isn't sure whether the 235 * Note: This function is conservative in that if it isn't sure whether the
236 * other instruction changes the codntion, it assumes that it does. 236 * other instruction changes the codntion, it assumes that it does.
237 * 237 *
238 * Note that this function can't see the bundle size, so this result does not 238 * Note that this function can't see the bundle size, so this result does not
239 * take it into account. The SfiValidator reasons on this separately. 239 * take it into account. The SfiValidator reasons on this separately.
240 */ 240 */
241 bool always_follows(const DecodedInstruction &other) const { 241 bool always_follows(const DecodedInstruction &other) const {
242 return other.always_precedes(*this); 242 return other.always_precedes(*this);
243 } 243 }
244 244
245 /* 245 /*
246 * Checks that the execution of 'this' is conditional on the test result 246 * Checks that the execution of 'this' is conditional on the test result
247 * (specifically, the Z flag being set) from 'other' -- which must be 247 * (specifically, the Z flag being set) from 'other' -- which must be
248 * adjacent for this simple check to be meaningful. 248 * adjacent for this simple check to be meaningful.
249 */ 249 */
250 bool is_conditional_on(const DecodedInstruction &other) const { 250 bool is_conditional_on(const DecodedInstruction &other) const {
251 return inst_.condition() == nacl_arm_dec::Instruction::EQ 251 return inst_.condition() == nacl_arm_dec::Instruction::EQ
252 && other.inst_.condition() == nacl_arm_dec::Instruction::AL 252 && other.inst_.condition() == nacl_arm_dec::Instruction::AL
253 && other.defines(nacl_arm_dec::kRegisterFlags); 253 && other.defines(nacl_arm_dec::kConditions);
254 } 254 }
255 255
256 // The methods below mirror those on ClassDecoder, but are cached and cheap. 256 // The methods below mirror those on ClassDecoder, but are cached and cheap.
257 nacl_arm_dec::SafetyLevel safety() const { return safety_; } 257 nacl_arm_dec::SafetyLevel safety() const { return safety_; }
258 nacl_arm_dec::RegisterList defs() const { return defs_; } 258 nacl_arm_dec::RegisterList defs() const { return defs_; }
259 259
260 // The methods below pull values from ClassDecoder on demand. 260 // The methods below pull values from ClassDecoder on demand.
261 bool is_relative_branch() const { 261 bool is_relative_branch() const {
262 return decoder_->is_relative_branch(inst_); 262 return decoder_->is_relative_branch(inst_);
263 } 263 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 const char * const kProblemReadOnlyRegister = "kProblemReadOnlyRegister"; 416 const char * const kProblemReadOnlyRegister = "kProblemReadOnlyRegister";
417 // A pseudo-op pattern crosses a bundle boundary. 417 // A pseudo-op pattern crosses a bundle boundary.
418 const char * const kProblemPatternCrossesBundle = 418 const char * const kProblemPatternCrossesBundle =
419 "kProblemPatternCrossesBundle"; 419 "kProblemPatternCrossesBundle";
420 // A linking branch instruction is not in the last bundle slot. 420 // A linking branch instruction is not in the last bundle slot.
421 const char * const kProblemMisalignedCall = "kProblemMisalignedCall"; 421 const char * const kProblemMisalignedCall = "kProblemMisalignedCall";
422 422
423 } // namespace 423 } // namespace
424 424
425 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_VALIDATOR_H 425 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_VALIDATOR_H
OLDNEW
« no previous file with comments | « src/trusted/validator_arm/model.h ('k') | src/trusted/validator_arm/validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698