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

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
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 /* 221 /*
222 * Checks that 'this' always follows 'other' -- meaning that if 'other' 222 * Checks that 'this' always follows 'other' -- meaning that if 'other'
223 * executes, 'this' is guaranteed to follow. This is important if 'other' 223 * executes, 'this' is guaranteed to follow. This is important if 'other'
224 * produces an unsafe value that 'this' fixes before it can leak out. 224 * produces an unsafe value that 'this' fixes before it can leak out.
225 * 225 *
226 * Note that this function can't see the bundle size, so this result does not 226 * Note that this function can't see the bundle size, so this result does not
227 * take it into account. The SfiValidator reasons on this separately. 227 * take it into account. The SfiValidator reasons on this separately.
228 */ 228 */
229 bool always_follows(const DecodedInstruction &other) const { 229 bool always_follows(const DecodedInstruction &other) const {
230 return inst_.condition() == other.inst_.condition() 230 return inst_.condition() == other.inst_.condition()
231 && !other.defines(nacl_arm_dec::kRegisterFlags); 231 && !other.defines(nacl_arm_dec::kConditions);
232 } 232 }
233 233
234 /* 234 /*
235 * Checks that the execution of 'this' is conditional on the test result 235 * Checks that the execution of 'this' is conditional on the test result
236 * (specifically, the Z flag being set) from 'other' -- which must be 236 * (specifically, the Z flag being set) from 'other' -- which must be
237 * adjacent for this simple check to be meaningful. 237 * adjacent for this simple check to be meaningful.
238 */ 238 */
239 bool is_conditional_on(const DecodedInstruction &other) const { 239 bool is_conditional_on(const DecodedInstruction &other) const {
240 return inst_.condition() == nacl_arm_dec::Instruction::EQ 240 return inst_.condition() == nacl_arm_dec::Instruction::EQ
241 && other.inst_.condition() == nacl_arm_dec::Instruction::AL 241 && other.inst_.condition() == nacl_arm_dec::Instruction::AL
242 && other.defines(nacl_arm_dec::kRegisterFlags); 242 && other.defines(nacl_arm_dec::kConditions);
243 } 243 }
244 244
245 // The methods below mirror those on ClassDecoder, but are cached and cheap. 245 // The methods below mirror those on ClassDecoder, but are cached and cheap.
246 nacl_arm_dec::SafetyLevel safety() const { return safety_; } 246 nacl_arm_dec::SafetyLevel safety() const { return safety_; }
247 nacl_arm_dec::RegisterList defs() const { return defs_; } 247 nacl_arm_dec::RegisterList defs() const { return defs_; }
248 248
249 // The methods below pull values from ClassDecoder on demand. 249 // The methods below pull values from ClassDecoder on demand.
250 bool is_relative_branch() const { 250 bool is_relative_branch() const {
251 return decoder_->is_relative_branch(inst_); 251 return decoder_->is_relative_branch(inst_);
252 } 252 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 const char * const kProblemReadOnlyRegister = "kProblemReadOnlyRegister"; 405 const char * const kProblemReadOnlyRegister = "kProblemReadOnlyRegister";
406 // A pseudo-op pattern crosses a bundle boundary. 406 // A pseudo-op pattern crosses a bundle boundary.
407 const char * const kProblemPatternCrossesBundle = 407 const char * const kProblemPatternCrossesBundle =
408 "kProblemPatternCrossesBundle"; 408 "kProblemPatternCrossesBundle";
409 // A linking branch instruction is not in the last bundle slot. 409 // A linking branch instruction is not in the last bundle slot.
410 const char * const kProblemMisalignedCall = "kProblemMisalignedCall"; 410 const char * const kProblemMisalignedCall = "kProblemMisalignedCall";
411 411
412 } // namespace 412 } // namespace
413 413
414 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_VALIDATOR_H 414 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_VALIDATOR_H
OLDNEW
« src/trusted/validator_arm/model.h ('K') | « src/trusted/validator_arm/model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698