| 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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_H_ | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_H_ |
| 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_H_ | 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_H_ |
| 9 | 9 |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 inline Imm4Bits16To19Interface() {} | 216 inline Imm4Bits16To19Interface() {} |
| 217 static inline uint32_t value(const Instruction& i) { | 217 static inline uint32_t value(const Instruction& i) { |
| 218 return i.bits(19, 16); | 218 return i.bits(19, 16); |
| 219 } | 219 } |
| 220 | 220 |
| 221 private: | 221 private: |
| 222 NACL_DISALLOW_COPY_AND_ASSIGN(Imm4Bits16To19Interface); | 222 NACL_DISALLOW_COPY_AND_ASSIGN(Imm4Bits16To19Interface); |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 // Interface class to pull out S (update) bit from bit 20, which | 225 // Interface class to pull out S (update) bit from bit 20, which |
| 226 // defines if the flags register is updated by the instruction. | 226 // defines if the condition bits in APSR are updated by the instruction. |
| 227 class UpdatesFlagsRegisterBit20Interface { | 227 class UpdatesConditionsBit20Interface { |
| 228 public: | 228 public: |
| 229 inline UpdatesFlagsRegisterBit20Interface() {} | 229 inline UpdatesConditionsBit20Interface() {} |
| 230 // Returns true if bit is set that states that the flags register is updated. | 230 // Returns true if bit is set that states that the condition bits |
| 231 // APSR is updated. |
| 231 static inline bool is_updated(const Instruction i) { | 232 static inline bool is_updated(const Instruction i) { |
| 232 return i.bit(20); | 233 return i.bit(20); |
| 233 } | 234 } |
| 234 // Returns the flags register if it is used. | 235 // Returns the conditions register if it is used. |
| 235 static inline Register reg_if_updated(const Instruction i) { | 236 static inline Register conds_if_updated(const Instruction i) { |
| 236 return is_updated(i) ? kRegisterFlags : kRegisterNone; | 237 return is_updated(i) ? kConditions : kRegisterNone; |
| 237 } | 238 } |
| 238 | 239 |
| 239 private: | 240 private: |
| 240 NACL_DISALLOW_COPY_AND_ASSIGN(UpdatesFlagsRegisterBit20Interface); | 241 NACL_DISALLOW_COPY_AND_ASSIGN(UpdatesConditionsBit20Interface); |
| 241 }; | 242 }; |
| 242 | 243 |
| 243 // A class decoder is designed to decode a set of instructions that | 244 // A class decoder is designed to decode a set of instructions that |
| 244 // have the same semantics, in terms of what the validator needs. This | 245 // have the same semantics, in terms of what the validator needs. This |
| 245 // includes the bit ranges in the instruction that correspond to | 246 // includes the bit ranges in the instruction that correspond to |
| 246 // assigned registers. as well as whether the instruction is safe to | 247 // assigned registers. as well as whether the instruction is safe to |
| 247 // use within the validator. | 248 // use within the validator. |
| 248 // | 249 // |
| 249 // The important property of these class decoders is that the | 250 // The important property of these class decoders is that the |
| 250 // corresponding DecoderState (defined in decoder.h) will inspect the | 251 // corresponding DecoderState (defined in decoder.h) will inspect the |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 inline Unpredictable() : UnsafeClassDecoder(UNPREDICTABLE) {} | 474 inline Unpredictable() : UnsafeClassDecoder(UNPREDICTABLE) {} |
| 474 virtual ~Unpredictable() {} | 475 virtual ~Unpredictable() {} |
| 475 | 476 |
| 476 private: | 477 private: |
| 477 NACL_DISALLOW_COPY_AND_ASSIGN(Unpredictable); | 478 NACL_DISALLOW_COPY_AND_ASSIGN(Unpredictable); |
| 478 }; | 479 }; |
| 479 | 480 |
| 480 } // namespace | 481 } // namespace |
| 481 | 482 |
| 482 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_H_ | 483 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_H_ |
| OLD | NEW |