| 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 // Defines decoder testers for decoder classes. | 7 // Defines decoder testers for decoder classes. |
| 8 | 8 |
| 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ |
| 10 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 // |31302928|272625|24|23|22|21|20|19181716|15141312|1110 9 8| 7 6 5 4| 3 2 1 0| | 486 // |31302928|272625|24|23|22|21|20|19181716|15141312|1110 9 8| 7 6 5 4| 3 2 1 0| |
| 487 // +--------+------+--+--+--+--+--+--------+--------+--------+--------+--------+ | 487 // +--------+------+--+--+--+--+--+--------+--------+--------+--------+--------+ |
| 488 // | cond | | P| U| | W| | Rn | Rt | imm4H | | imm4L | | 488 // | cond | | P| U| | W| | Rn | Rt | imm4H | | imm4L | |
| 489 // +--------+------+--+--+--+--+--+--------+--------+--------+--------+--------+ | 489 // +--------+------+--+--+--+--+--+--------+--------+--------+--------+--------+ |
| 490 // wback = (P=0 || W=1) | 490 // wback = (P=0 || W=1) |
| 491 // | 491 // |
| 492 // if P=0 and W=1, should not parse as this instruction. | 492 // if P=0 and W=1, should not parse as this instruction. |
| 493 // if Rt=15 then Unpredictable | 493 // if Rt=15 then Unpredictable |
| 494 // if wback && (Rn=15 or Rn=Rt) then unpredictable. | 494 // if wback && (Rn=15 or Rn=Rt) then unpredictable. |
| 495 // NaCl disallows writing to PC. | 495 // NaCl disallows writing to PC. |
| 496 class LoadStore2RegisterImmediateOpTester : public Arm32DecoderTester { | 496 class LoadStore2RegisterImm8OpTester : public Arm32DecoderTester { |
| 497 public: | 497 public: |
| 498 explicit LoadStore2RegisterImmediateOpTester( | 498 explicit LoadStore2RegisterImm8OpTester( |
| 499 const NamedClassDecoder& decoder); | 499 const NamedClassDecoder& decoder); |
| 500 virtual bool ApplySanityChecks( | 500 virtual bool ApplySanityChecks( |
| 501 nacl_arm_dec::Instruction inst, | 501 nacl_arm_dec::Instruction inst, |
| 502 const NamedClassDecoder& decoder); | 502 const NamedClassDecoder& decoder); |
| 503 | 503 |
| 504 private: | 504 private: |
| 505 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImmediateOpTester); | 505 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm8OpTester); |
| 506 }; | 506 }; |
| 507 | 507 |
| 508 // Defines a LoadStore2RegisterImmediateOpTester with the added constraint | 508 // Defines a LoadStore2RegisterImm8OpTester with the added constraint |
| 509 // that it doesn't parse when Rn=15 | 509 // that it doesn't parse when Rn=15 |
| 510 class LoadStore2RegisterImmediateOpTesterNotRnIsPc | 510 class LoadStore2RegisterImm8OpTesterNotRnIsPc |
| 511 : public LoadStore2RegisterImmediateOpTester { | 511 : public LoadStore2RegisterImm8OpTester { |
| 512 public: | 512 public: |
| 513 LoadStore2RegisterImmediateOpTesterNotRnIsPc( | 513 LoadStore2RegisterImm8OpTesterNotRnIsPc( |
| 514 const NamedClassDecoder& decoder); | 514 const NamedClassDecoder& decoder); |
| 515 virtual bool ApplySanityChecks( | 515 virtual bool ApplySanityChecks( |
| 516 nacl_arm_dec::Instruction inst, | 516 nacl_arm_dec::Instruction inst, |
| 517 const NamedClassDecoder& decoder); | 517 const NamedClassDecoder& decoder); |
| 518 | 518 |
| 519 private: | 519 private: |
| 520 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImmediateOpTesterNotRnIsPc); | 520 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm8OpTesterNotRnIsPc); |
| 521 }; | 521 }; |
| 522 | 522 |
| 523 // Models a 2-register load/store immediate operation where the source/target | 523 // Models a 2-register load/store immediate operation where the source/target |
| 524 // is double wide (i.e. Rt and Rt2). | 524 // is double wide (i.e. Rt and Rt2). |
| 525 class LoadStore2RegisterImmediateDoubleOpTester | 525 class LoadStore2RegisterImm8DoubleOpTester |
| 526 : public LoadStore2RegisterImmediateOpTester { | 526 : public LoadStore2RegisterImm8OpTester { |
| 527 public: | 527 public: |
| 528 explicit LoadStore2RegisterImmediateDoubleOpTester( | 528 explicit LoadStore2RegisterImm8DoubleOpTester( |
| 529 const NamedClassDecoder& decoder); | 529 const NamedClassDecoder& decoder); |
| 530 virtual bool ApplySanityChecks( | 530 virtual bool ApplySanityChecks( |
| 531 nacl_arm_dec::Instruction inst, | 531 nacl_arm_dec::Instruction inst, |
| 532 const NamedClassDecoder& decoder); | 532 const NamedClassDecoder& decoder); |
| 533 | 533 |
| 534 private: | 534 private: |
| 535 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImmediateDoubleOpTester); | 535 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm8DoubleOpTester); |
| 536 }; | 536 }; |
| 537 | 537 |
| 538 // Defines a LoadStore2RegisterImmediateDoubleOpTester with the added constraint | 538 // Defines a LoadStore2RegisterImm8DoubleOpTester with the added constraint |
| 539 // that it doesn't parse when Rn=15. | 539 // that it doesn't parse when Rn=15. |
| 540 class LoadStore2RegisterImmediateDoubleOpTesterNotRnIsPc | 540 class LoadStore2RegisterImm8DoubleOpTesterNotRnIsPc |
| 541 : public LoadStore2RegisterImmediateDoubleOpTester { | 541 : public LoadStore2RegisterImm8DoubleOpTester { |
| 542 public: | 542 public: |
| 543 LoadStore2RegisterImmediateDoubleOpTesterNotRnIsPc( | 543 LoadStore2RegisterImm8DoubleOpTesterNotRnIsPc( |
| 544 const NamedClassDecoder& decoder); | 544 const NamedClassDecoder& decoder); |
| 545 virtual bool ApplySanityChecks( | 545 virtual bool ApplySanityChecks( |
| 546 nacl_arm_dec::Instruction inst, | 546 nacl_arm_dec::Instruction inst, |
| 547 const NamedClassDecoder& decoder); | 547 const NamedClassDecoder& decoder); |
| 548 | 548 |
| 549 private: | 549 private: |
| 550 NACL_DISALLOW_COPY_AND_ASSIGN( | 550 NACL_DISALLOW_COPY_AND_ASSIGN( |
| 551 LoadStore2RegisterImmediateDoubleOpTesterNotRnIsPc); | 551 LoadStore2RegisterImm8DoubleOpTesterNotRnIsPc); |
| 552 }; |
| 553 |
| 554 // Models a 2-register load/store 12-bit immediate operation of the forms: |
| 555 // Op<c> <Rt>, [<Rn> {, #+/-<imm12>}] |
| 556 // Op<c> <Rt>, [<Rn>], #+/-<imm12> |
| 557 // Op<c> <Rt>, [<Rn>, #+/-<imm12>] |
| 558 // +--------+------+--+--+--+--+--+--------+--------+------------------------+ |
| 559 // |31302928|272625|24|23|22|21|20|19181716|15141312|1110 9 8 7 6 5 4 3 2 1 0| |
| 560 // +--------+------+--+--+--+--+--+--------+--------+------------------------+ |
| 561 // | conds | | P| U| | w| | Rn | Rt | imm12 | |
| 562 // +--------+------+--+--+--+--+--+--------+--------+------------------------+ |
| 563 // wback = (P=0 || W==1) |
| 564 // |
| 565 // if P=0 and W=1, should not parse as this instruction. |
| 566 // if Rn=Sp && P=1 && U=0 && W=1 && imm12=4, then PUSH |
| 567 // if wback && (Rn=15 or Rn=Rt) then unpredictable. |
| 568 // NaCl disallows writing to PC. |
| 569 // |
| 570 // Note: We NaCl disallow Rt=PC for stores (not just loads), even |
| 571 // though it isn't a requirement of the corresponding baseline |
| 572 // classees. This is done so that StrImmediate (in the actual class |
| 573 // decoders) behave the same as instances of this. This simplifies |
| 574 // what we need to model in actual classes. |
| 575 class LoadStore2RegisterImm12OpTester : public Arm32DecoderTester { |
| 576 public: |
| 577 explicit LoadStore2RegisterImm12OpTester( |
| 578 const NamedClassDecoder& decoder); |
| 579 virtual bool ApplySanityChecks( |
| 580 nacl_arm_dec::Instruction inst, |
| 581 const NamedClassDecoder& decoder); |
| 582 |
| 583 private: |
| 584 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm12OpTester); |
| 585 }; |
| 586 |
| 587 // Defines a LoadStore2RegisterImm12OpTester with the added constraint |
| 588 // that it doesn't parse when Rn=15. |
| 589 class LoadStore2RegisterImm12OpTesterNotRnIsPc |
| 590 : public LoadStore2RegisterImm12OpTester { |
| 591 public: |
| 592 LoadStore2RegisterImm12OpTesterNotRnIsPc( |
| 593 const NamedClassDecoder& decoder); |
| 594 virtual bool ApplySanityChecks( |
| 595 nacl_arm_dec::Instruction inst, |
| 596 const NamedClassDecoder& decoder); |
| 597 |
| 598 private: |
| 599 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm12OpTesterNotRnIsPc); |
| 552 }; | 600 }; |
| 553 | 601 |
| 554 // Models a 3-register load/store operation of the forms: | 602 // Models a 3-register load/store operation of the forms: |
| 555 // Op<c> <Rt>, [<Rn>, +/-<Rm>]{!} | 603 // Op<c> <Rt>, [<Rn>, +/-<Rm>]{!} |
| 556 // Op<c> <Rt>, [<Rn>], +/-<Rm> | 604 // Op<c> <Rt>, [<Rn>], +/-<Rm> |
| 557 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ | 605 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ |
| 558 // |31302918|272625|24|23|22|21|20|19181716|15141312|1110 9 8 7 6 5 4| 3 2 1 0| | 606 // |31302918|272625|24|23|22|21|20|19181716|15141312|1110 9 8 7 6 5 4| 3 2 1 0| |
| 559 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ | 607 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ |
| 560 // | cond | | P| U| | W| | Rn | Rt | | Rm | | 608 // | cond | | P| U| | W| | Rn | Rt | | Rm | |
| 561 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ | 609 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 585 explicit LoadStore3RegisterDoubleOpTester( | 633 explicit LoadStore3RegisterDoubleOpTester( |
| 586 const NamedClassDecoder& decoder); | 634 const NamedClassDecoder& decoder); |
| 587 virtual bool ApplySanityChecks( | 635 virtual bool ApplySanityChecks( |
| 588 nacl_arm_dec::Instruction inst, | 636 nacl_arm_dec::Instruction inst, |
| 589 const NamedClassDecoder& decoder); | 637 const NamedClassDecoder& decoder); |
| 590 | 638 |
| 591 private: | 639 private: |
| 592 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore3RegisterDoubleOpTester); | 640 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore3RegisterDoubleOpTester); |
| 593 }; | 641 }; |
| 594 | 642 |
| 643 // Models a 3-register with (shifted) immediate 5 load/store operation of |
| 644 // the forms: |
| 645 // Op<c> <Rt>, [<Rn>, +/-<Rm> {, <shift>}]{!} |
| 646 // Op<c> <Rt>, [<Rn>], +-<Rm> {, <shift>} |
| 647 // +------+------+--+--+--+--+--+--------+--------+----------+----+--+---------+ |
| 648 // |31..28|272625|24|23|22|21|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0 | |
| 649 // +------+------+--+--+--+--+--+--------+--------+----------+----+--+---------+ |
| 650 // | cond | | P| U| | W| | Rm | Rt | imm5 |type| | Rm | |
| 651 // +------+------+--+--+--+--+--+--------+--------+----------+----+--+---------+ |
| 652 // wback = (P=0 || W=1) |
| 653 // |
| 654 // If P=0 and W=1, should not parse as this instruction. |
| 655 // If Rm=15 then unpredicatble. |
| 656 // If wback && (Rn=15 or Rn=Rt) then unpredictable. |
| 657 // if ArchVersion() < 6 && wback && Rm=Rn then unpredictable. |
| 658 // NaCl Disallows writing to PC. |
| 659 // |
| 660 // Note: We NaCl disallow Rt=PC for stores (not just loads), even |
| 661 // though it isn't a requirement of the corresponding baseline |
| 662 // classes. This is done so that StrRegister (in the actual class |
| 663 // decoders) behave the same as this. This simplifies what we need to |
| 664 // model in actual classes. |
| 665 class LoadStore3RegisterImm5OpTester : public Arm32DecoderTester { |
| 666 public: |
| 667 explicit LoadStore3RegisterImm5OpTester( |
| 668 const NamedClassDecoder& decoder); |
| 669 virtual bool ApplySanityChecks( |
| 670 nacl_arm_dec::Instruction inst, |
| 671 const NamedClassDecoder& decoder); |
| 672 |
| 673 private: |
| 674 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore3RegisterImm5OpTester); |
| 675 }; |
| 676 |
| 595 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp. | 677 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp. |
| 596 // Op(S)<c> <Rd>, <Rm> {,<shift>} | 678 // Op(S)<c> <Rd>, <Rm> {,<shift>} |
| 597 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 679 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 598 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| | 680 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| |
| 599 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 681 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 600 // | cond | | S| | Rd | imm5 |type| | Rm | | 682 // | cond | | S| | Rd | imm5 |type| | Rm | |
| 601 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 683 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 602 // Definitions: | 684 // Definitions: |
| 603 // Rd - The destination register. | 685 // Rd - The destination register. |
| 604 // Rm - The source operand that is (optionally) shifted. | 686 // Rm - The source operand that is (optionally) shifted. |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 nacl_arm_dec::Instruction inst, | 909 nacl_arm_dec::Instruction inst, |
| 828 const NamedClassDecoder& decoder); | 910 const NamedClassDecoder& decoder); |
| 829 | 911 |
| 830 private: | 912 private: |
| 831 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTestTesterRegsNotPc); | 913 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTestTesterRegsNotPc); |
| 832 }; | 914 }; |
| 833 | 915 |
| 834 } // namespace | 916 } // namespace |
| 835 | 917 |
| 836 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ | 918 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ |
| OLD | NEW |