| 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 <inttypes.h> | 7 #include <inttypes.h> |
| 8 | 8 |
| 9 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 9 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
| 10 #include "native_client/src/trusted/validator_arm/model.h" | 10 #include "native_client/src/trusted/validator_arm/model.h" |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 return construction_failed_; | 668 return construction_failed_; |
| 669 } | 669 } |
| 670 | 670 |
| 671 bool SfiValidator::validate_fallthrough(const CodeSegment& segment, | 671 bool SfiValidator::validate_fallthrough(const CodeSegment& segment, |
| 672 ProblemSink* out, | 672 ProblemSink* out, |
| 673 AddressSet* branches, | 673 AddressSet* branches, |
| 674 AddressSet* critical) { | 674 AddressSet* critical) { |
| 675 bool complete_success = true; | 675 bool complete_success = true; |
| 676 | 676 |
| 677 nacl_arm_dec::Forbidden initial_decoder; | 677 nacl_arm_dec::Forbidden initial_decoder; |
| 678 // Initialize the previous instruction to a scary BKPT, so patterns all fail. | 678 // Initialize the previous instruction so it always fails validation. |
| 679 DecodedInstruction pred( | 679 DecodedInstruction pred( |
| 680 0, // Virtual address 0, which will be in a different bundle; | 680 0, // Virtual address 0, which will be in a different bundle; |
| 681 Instruction(nacl_arm_dec::kLiteralPoolHeadInstruction), | 681 Instruction(nacl_arm_dec::kFailValidation), |
| 682 initial_decoder); // and ensure that it decodes as Forbidden. | 682 initial_decoder); // and ensure that it decodes as Forbidden. |
| 683 | 683 |
| 684 for (uint32_t va = segment.begin_addr(); va < segment.end_addr(); va += 4) { | 684 for (uint32_t va = segment.begin_addr(); va < segment.end_addr(); va += 4) { |
| 685 DecodedInstruction inst(va, segment[va], | 685 DecodedInstruction inst(va, segment[va], |
| 686 decode_state_.decode(segment[va])); | 686 decode_state_.decode(segment[va])); |
| 687 | 687 |
| 688 if (inst.safety() != nacl_arm_dec::MAY_BE_SAFE) { | 688 if (inst.safety() != nacl_arm_dec::MAY_BE_SAFE) { |
| 689 out->ReportProblemSafety(va, inst.safety()); | 689 out->ReportProblemSafety(va, inst.safety()); |
| 690 if (!out->should_continue()) { | 690 if (!out->should_continue()) { |
| 691 return false; | 691 return false; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 Instruction inst, | 902 Instruction inst, |
| 903 const ClassDecoder& decoder) | 903 const ClassDecoder& decoder) |
| 904 : vaddr_(vaddr), | 904 : vaddr_(vaddr), |
| 905 inst_(inst), | 905 inst_(inst), |
| 906 decoder_(&decoder), | 906 decoder_(&decoder), |
| 907 safety_(decoder.safety(inst_)), | 907 safety_(decoder.safety(inst_)), |
| 908 defs_(decoder.defs(inst_)) | 908 defs_(decoder.defs(inst_)) |
| 909 {} | 909 {} |
| 910 | 910 |
| 911 } // namespace nacl_arm_val | 911 } // namespace nacl_arm_val |
| OLD | NEW |