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/model.h" | 8 #include "native_client/src/trusted/validator_arm/model.h" |
9 #include "native_client/src/trusted/validator_arm/validator.h" | 9 #include "native_client/src/trusted/validator_arm/validator.h" |
10 #include "native_client/src/include/nacl_macros.h" | 10 #include "native_client/src/include/nacl_macros.h" |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 } | 714 } |
715 | 715 |
716 // Decrement the virtual address by one instruction, so the for | 716 // Decrement the virtual address by one instruction, so the for |
717 // loop can bump it back forward. This is slightly dirty. | 717 // loop can bump it back forward. This is slightly dirty. |
718 va -= 4; | 718 va -= 4; |
719 } | 719 } |
720 | 720 |
721 pred.Copy(inst); | 721 pred.Copy(inst); |
722 } | 722 } |
723 | 723 |
| 724 // Validate the last instruction, paired with a nop. |
| 725 const Instruction nop(nacl_arm_dec::kNop); |
| 726 DecodedInstruction one_past_end(segment.end_addr(), nop, |
| 727 decode_state_.decode(nop)); |
| 728 complete_success &= apply_patterns(pred, one_past_end, critical, out); |
| 729 |
724 return complete_success; | 730 return complete_success; |
725 } | 731 } |
726 | 732 |
727 static bool address_contained(uint32_t va, const vector<CodeSegment>& segs) { | 733 static bool address_contained(uint32_t va, const vector<CodeSegment>& segs) { |
728 for (vector<CodeSegment>::const_iterator it = segs.begin(); it != segs.end(); | 734 for (vector<CodeSegment>::const_iterator it = segs.begin(); it != segs.end(); |
729 ++it) { | 735 ++it) { |
730 if (it->contains_address(va)) return true; | 736 if (it->contains_address(va)) return true; |
731 } | 737 } |
732 return false; | 738 return false; |
733 } | 739 } |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 Instruction inst, | 907 Instruction inst, |
902 const ClassDecoder& decoder) | 908 const ClassDecoder& decoder) |
903 : vaddr_(vaddr), | 909 : vaddr_(vaddr), |
904 inst_(inst), | 910 inst_(inst), |
905 decoder_(&decoder), | 911 decoder_(&decoder), |
906 safety_(decoder.safety(inst_)), | 912 safety_(decoder.safety(inst_)), |
907 defs_(decoder.defs(inst_)) | 913 defs_(decoder.defs(inst_)) |
908 {} | 914 {} |
909 | 915 |
910 } // namespace nacl_arm_val | 916 } // namespace nacl_arm_val |
OLD | NEW |