| 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/service_runtime/nacl_config.h" | 7 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
| 8 #include "native_client/src/trusted/validator_arm/validator.h" | 8 #include "native_client/src/trusted/validator_arm/validator.h" |
| 9 #include "native_client/src/include/nacl_macros.h" | 9 #include "native_client/src/include/nacl_macros.h" |
| 10 | 10 |
| 11 #include <assert.h> | 11 #include <assert.h> |
| 12 | 12 |
| 13 using nacl_arm_dec::Instruction; | 13 using nacl_arm_dec::Instruction; |
| 14 using nacl_arm_dec::ClassDecoder; | 14 using nacl_arm_dec::ClassDecoder; |
| 15 using nacl_arm_dec::Register; | 15 using nacl_arm_dec::Register; |
| 16 using nacl_arm_dec::RegisterList; | 16 using nacl_arm_dec::RegisterList; |
| 17 using nacl_arm_dec::kRegisterNone; | 17 using nacl_arm_dec::kRegisterNone; |
| 18 using nacl_arm_dec::kRegisterFlags; | 18 using nacl_arm_dec::kConditions; |
| 19 using nacl_arm_dec::kRegisterPc; | 19 using nacl_arm_dec::kRegisterPc; |
| 20 using nacl_arm_dec::kRegisterLink; | 20 using nacl_arm_dec::kRegisterLink; |
| 21 | 21 |
| 22 using std::vector; | 22 using std::vector; |
| 23 | 23 |
| 24 namespace nacl_arm_val { | 24 namespace nacl_arm_val { |
| 25 | 25 |
| 26 /********************************************************* | 26 /********************************************************* |
| 27 * Implementations of patterns used in the first pass. | 27 * Implementations of patterns used in the first pass. |
| 28 * | 28 * |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (second.base_address_register() == kRegisterPc | 65 if (second.base_address_register() == kRegisterPc |
| 66 && second.offset_is_immediate()) { | 66 && second.offset_is_immediate()) { |
| 67 /* PC + immediate addressing is always safe. */ | 67 /* PC + immediate addressing is always safe. */ |
| 68 return PATTERN_SAFE; | 68 return PATTERN_SAFE; |
| 69 } | 69 } |
| 70 | 70 |
| 71 if (first.defines(second.base_address_register()) | 71 if (first.defines(second.base_address_register()) |
| 72 && first.clears_bits(sfi.data_address_mask()) | 72 && first.clears_bits(sfi.data_address_mask()) |
| 73 && !first.defs()[kRegisterFlags] | 73 && !first.defs()[kConditions] |
| 74 && first.always_precedes(second)) { | 74 && first.always_precedes(second)) { |
| 75 return PATTERN_SAFE_2; | 75 return PATTERN_SAFE_2; |
| 76 } | 76 } |
| 77 | 77 |
| 78 if (first.sets_Z_if_bits_clear(second.base_address_register(), | 78 if (first.sets_Z_if_bits_clear(second.base_address_register(), |
| 79 sfi.data_address_mask()) | 79 sfi.data_address_mask()) |
| 80 && second.is_conditional_on(first)) { | 80 && second.is_conditional_on(first)) { |
| 81 return PATTERN_SAFE_2; | 81 return PATTERN_SAFE_2; |
| 82 } | 82 } |
| 83 | 83 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 Instruction inst, | 472 Instruction inst, |
| 473 const ClassDecoder &decoder) | 473 const ClassDecoder &decoder) |
| 474 : vaddr_(vaddr), | 474 : vaddr_(vaddr), |
| 475 inst_(inst), | 475 inst_(inst), |
| 476 decoder_(&decoder), | 476 decoder_(&decoder), |
| 477 safety_(decoder.safety(inst_)), | 477 safety_(decoder.safety(inst_)), |
| 478 defs_(decoder.defs(inst_)) | 478 defs_(decoder.defs(inst_)) |
| 479 {} | 479 {} |
| 480 | 480 |
| 481 } // namespace | 481 } // namespace |
| OLD | NEW |