| 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/validator_arm/actual_classes.h" | 7 #include "native_client/src/trusted/validator_arm/actual_classes.h" |
| 8 | 8 |
| 9 #include <assert.h> | 9 #include <assert.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 SafetyLevel EffectiveNoOp::safety(Instruction i) const { | 521 SafetyLevel EffectiveNoOp::safety(Instruction i) const { |
| 522 UNREFERENCED_PARAMETER(i); | 522 UNREFERENCED_PARAMETER(i); |
| 523 return MAY_BE_SAFE; | 523 return MAY_BE_SAFE; |
| 524 } | 524 } |
| 525 | 525 |
| 526 RegisterList EffectiveNoOp::defs(Instruction i) const { | 526 RegisterList EffectiveNoOp::defs(Instruction i) const { |
| 527 UNREFERENCED_PARAMETER(i); | 527 UNREFERENCED_PARAMETER(i); |
| 528 return RegisterList(); | 528 return RegisterList(); |
| 529 } | 529 } |
| 530 | 530 |
| 531 // Roadblock | 531 // PermanentlyUndefined |
| 532 SafetyLevel Roadblock::safety(Instruction i) const { | 532 SafetyLevel PermanentlyUndefined::safety(Instruction i) const { |
| 533 UNREFERENCED_PARAMETER(i); | 533 // Restrict UDF's encoding to values we've chosen as safe. |
| 534 return MAY_BE_SAFE; | 534 if ((i.Bits(31, 0) == kHaltFill) || |
| 535 (i.Bits(31, 0) == kAbortNow)) |
| 536 return MAY_BE_SAFE; |
| 537 return FORBIDDEN_OPERANDS; |
| 535 } | 538 } |
| 536 | 539 |
| 537 RegisterList Roadblock::defs(Instruction i) const { | 540 RegisterList PermanentlyUndefined::defs(Instruction i) const { |
| 538 UNREFERENCED_PARAMETER(i); | 541 UNREFERENCED_PARAMETER(i); |
| 539 return RegisterList(); | 542 return RegisterList(); |
| 540 } | 543 } |
| 541 | 544 |
| 542 // Breakpoint | 545 // Breakpoint |
| 543 SafetyLevel Breakpoint::safety(Instruction i) const { | 546 SafetyLevel Breakpoint::safety(Instruction i) const { |
| 544 return i.GetCondition() == Instruction::AL | 547 if (i.GetCondition() != Instruction::AL) |
| 545 ? MAY_BE_SAFE | 548 return UNPREDICTABLE; |
| 546 : UNPREDICTABLE; | 549 // Restrict BKPT's encoding to values we've chosen as safe. |
| 550 if ((i.Bits(31, 0) == kLiteralPoolHead) || |
| 551 (i.Bits(31, 0) == kBreakpoint)) |
| 552 return MAY_BE_SAFE; |
| 553 return FORBIDDEN_OPERANDS; |
| 554 } |
| 555 |
| 556 RegisterList Breakpoint::defs(Instruction i) const { |
| 557 UNREFERENCED_PARAMETER(i); |
| 558 return RegisterList(); |
| 547 } | 559 } |
| 548 | 560 |
| 549 bool Breakpoint::is_literal_pool_head(const Instruction i) const { | 561 bool Breakpoint::is_literal_pool_head(const Instruction i) const { |
| 550 return i.Bits(31, 0) == kLiteralPoolHeadInstruction; | 562 return i.Bits(31, 0) == kLiteralPoolHead; |
| 551 } | 563 } |
| 552 | 564 |
| 553 SafetyLevel PackSatRev::safety(const Instruction i) const { | 565 SafetyLevel PackSatRev::safety(const Instruction i) const { |
| 554 if (defs(i).Contains(Register::Pc())) { | 566 if (defs(i).Contains(Register::Pc())) { |
| 555 return FORBIDDEN_OPERANDS; | 567 return FORBIDDEN_OPERANDS; |
| 556 } | 568 } |
| 557 return MAY_BE_SAFE; | 569 return MAY_BE_SAFE; |
| 558 } | 570 } |
| 559 | 571 |
| 560 RegisterList PackSatRev::defs(const Instruction i) const { | 572 RegisterList PackSatRev::defs(const Instruction i) const { |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 else if (width == 32) { | 856 else if (width == 32) { |
| 845 // Clears everything. | 857 // Clears everything. |
| 846 return true; | 858 return true; |
| 847 } else { | 859 } else { |
| 848 uint32_t bit_mask = (((1 << width) - 1) << lsbit); | 860 uint32_t bit_mask = (((1 << width) - 1) << lsbit); |
| 849 return (bit_mask & mask) == mask; | 861 return (bit_mask & mask) == mask; |
| 850 } | 862 } |
| 851 } | 863 } |
| 852 | 864 |
| 853 } // namespace nacl_arm_dec | 865 } // namespace nacl_arm_dec |
| OLD | NEW |