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 <assert.h> | 7 #include <assert.h> |
8 #include "native_client/src/trusted/service_runtime/nacl_config.h" | 8 #include "native_client/src/trusted/service_runtime/nacl_config.h" |
9 #include "native_client/src/trusted/validator_mips/validator.h" | 9 #include "native_client/src/trusted/validator_mips/validator.h" |
10 #include "native_client/src/include/nacl_macros.h" | 10 #include "native_client/src/include/nacl_macros.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 complete_success &= ApplyPatterns(prev, inst, critical, out); | 348 complete_success &= ApplyPatterns(prev, inst, critical, out); |
349 if (!out->ShouldContinue()) return false; | 349 if (!out->ShouldContinue()) return false; |
350 | 350 |
351 if (inst.IsDirectJump()) { | 351 if (inst.IsDirectJump()) { |
352 branches->Add(inst.addr()); | 352 branches->Add(inst.addr()); |
353 branch_targets->Add(inst.DestAddr()); | 353 branch_targets->Add(inst.DestAddr()); |
354 } | 354 } |
355 | 355 |
356 prev = inst; | 356 prev = inst; |
357 } | 357 } |
358 | |
359 // Validate the last instruction, paired with a nop. | |
360 const Instruction nop(nacl_mips_dec::kNop); | |
361 DecodedInstruction one_past_end(segment.EndAddr(), nop, initial_decoder); | |
JF
2012/11/16 21:03:27
Why initial_decoder here?
The ARM change does:
de
petarj
2012/11/19 18:46:10
Changed to nacl_mips_dec::decode(nop, decode_state
| |
362 complete_success &= ApplyPatterns(prev, one_past_end, critical, out); | |
363 | |
358 return complete_success; | 364 return complete_success; |
359 } | 365 } |
360 | 366 |
361 bool SfiValidator::ValidatePseudos(const SfiValidator &sfi, | 367 bool SfiValidator::ValidatePseudos(const SfiValidator &sfi, |
362 const std::vector<CodeSegment> &segments, | 368 const std::vector<CodeSegment> &segments, |
363 const AddressSet &branches, | 369 const AddressSet &branches, |
364 const AddressSet &branch_targets, | 370 const AddressSet &branch_targets, |
365 const AddressSet &critical, | 371 const AddressSet &critical, |
366 ProblemSink* out) { | 372 ProblemSink* out) { |
367 bool complete_success = true; | 373 bool complete_success = true; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 DecodedInstruction::DecodedInstruction(uint32_t vaddr, | 507 DecodedInstruction::DecodedInstruction(uint32_t vaddr, |
502 Instruction inst, | 508 Instruction inst, |
503 const ClassDecoder &decoder) | 509 const ClassDecoder &decoder) |
504 : vaddr_(vaddr), | 510 : vaddr_(vaddr), |
505 inst_(inst), | 511 inst_(inst), |
506 decoder_(&decoder), | 512 decoder_(&decoder), |
507 safety_(decoder.safety(inst_)) | 513 safety_(decoder.safety(inst_)) |
508 {} | 514 {} |
509 | 515 |
510 } // namespace | 516 } // namespace |
OLD | NEW |