Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

Side by Side Diff: src/trusted/validator_arm/inst_classes_testers.h

Issue 10459058: Define a baseline and testing patterns for ARM load_store_word_byte table. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 // |31302928|272625|24|23|22|21|20|19181716|15141312|1110 9 8| 7 6 5 4| 3 2 1 0| 414 // |31302928|272625|24|23|22|21|20|19181716|15141312|1110 9 8| 7 6 5 4| 3 2 1 0|
415 // +--------+------+--+--+--+--+--+--------+--------+--------+--------+--------+ 415 // +--------+------+--+--+--+--+--+--------+--------+--------+--------+--------+
416 // | cond | | P| U| | W| | Rn | Rt | imm4H | | imm4L | 416 // | cond | | P| U| | W| | Rn | Rt | imm4H | | imm4L |
417 // +--------+------+--+--+--+--+--+--------+--------+--------+--------+--------+ 417 // +--------+------+--+--+--+--+--+--------+--------+--------+--------+--------+
418 // wback = (P=0 || W=1) 418 // wback = (P=0 || W=1)
419 // 419 //
420 // if P=0 and W=1, should not parse as this instruction. 420 // if P=0 and W=1, should not parse as this instruction.
421 // if Rt=15 then Unpredictable 421 // if Rt=15 then Unpredictable
422 // if wback && (Rn=15 or Rn=Rt) then unpredictable. 422 // if wback && (Rn=15 or Rn=Rt) then unpredictable.
423 // NaCl disallows writing to PC. 423 // NaCl disallows writing to PC.
424 class LoadStore2RegisterImmediateOpTester : public Arm32DecoderTester { 424 class LoadStore2RegisterImm8OpTester : public Arm32DecoderTester {
425 public: 425 public:
426 explicit LoadStore2RegisterImmediateOpTester( 426 explicit LoadStore2RegisterImm8OpTester(
427 const NamedClassDecoder& decoder); 427 const NamedClassDecoder& decoder);
428 virtual bool ApplySanityChecks( 428 virtual bool ApplySanityChecks(
429 nacl_arm_dec::Instruction inst, 429 nacl_arm_dec::Instruction inst,
430 const NamedClassDecoder& decoder); 430 const NamedClassDecoder& decoder);
431 431
432 private: 432 private:
433 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImmediateOpTester); 433 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm8OpTester);
434 }; 434 };
435 435
436 // Defines a LoadStore2RegisterImmediateOpTester with the added constraint 436 // Defines a LoadStore2RegisterImm8OpTester with the added constraint
437 // that it doesn't parse when Rn=15 437 // that it doesn't parse when Rn=15
438 class LoadStore2RegisterImmediateOpTesterNotRnIsPc 438 class LoadStore2RegisterImm8OpTesterNotRnIsPc
439 : public LoadStore2RegisterImmediateOpTester { 439 : public LoadStore2RegisterImm8OpTester {
440 public: 440 public:
441 LoadStore2RegisterImmediateOpTesterNotRnIsPc( 441 LoadStore2RegisterImm8OpTesterNotRnIsPc(
442 const NamedClassDecoder& decoder); 442 const NamedClassDecoder& decoder);
443 virtual bool ApplySanityChecks( 443 virtual bool ApplySanityChecks(
444 nacl_arm_dec::Instruction inst, 444 nacl_arm_dec::Instruction inst,
445 const NamedClassDecoder& decoder); 445 const NamedClassDecoder& decoder);
446 446
447 private: 447 private:
448 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImmediateOpTesterNotRnIsPc); 448 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm8OpTesterNotRnIsPc);
449 }; 449 };
450 450
451 // Models a 2-register load/store immediate operation where the source/target 451 // Models a 2-register load/store immediate operation where the source/target
452 // is double wide (i.e. Rt and Rt2). 452 // is double wide (i.e. Rt and Rt2).
453 class LoadStore2RegisterImmediateDoubleOpTester 453 class LoadStore2RegisterImm8DoubleOpTester
454 : public LoadStore2RegisterImmediateOpTester { 454 : public LoadStore2RegisterImm8OpTester {
455 public: 455 public:
456 explicit LoadStore2RegisterImmediateDoubleOpTester( 456 explicit LoadStore2RegisterImm8DoubleOpTester(
457 const NamedClassDecoder& decoder); 457 const NamedClassDecoder& decoder);
458 virtual bool ApplySanityChecks( 458 virtual bool ApplySanityChecks(
459 nacl_arm_dec::Instruction inst, 459 nacl_arm_dec::Instruction inst,
460 const NamedClassDecoder& decoder); 460 const NamedClassDecoder& decoder);
461 461
462 private: 462 private:
463 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImmediateDoubleOpTester); 463 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm8DoubleOpTester);
464 }; 464 };
465 465
466 // Defines a LoadStore2RegisterImmediateDoubleOpTester with the added constraint 466 // Defines a LoadStore2RegisterImm8DoubleOpTester with the added constraint
467 // that it doesn't parse when Rn=15. 467 // that it doesn't parse when Rn=15.
468 class LoadStore2RegisterImmediateDoubleOpTesterNotRnIsPc 468 class LoadStore2RegisterImm8DoubleOpTesterNotRnIsPc
469 : public LoadStore2RegisterImmediateDoubleOpTester { 469 : public LoadStore2RegisterImm8DoubleOpTester {
470 public: 470 public:
471 LoadStore2RegisterImmediateDoubleOpTesterNotRnIsPc( 471 LoadStore2RegisterImm8DoubleOpTesterNotRnIsPc(
472 const NamedClassDecoder& decoder); 472 const NamedClassDecoder& decoder);
473 virtual bool ApplySanityChecks( 473 virtual bool ApplySanityChecks(
474 nacl_arm_dec::Instruction inst, 474 nacl_arm_dec::Instruction inst,
475 const NamedClassDecoder& decoder); 475 const NamedClassDecoder& decoder);
476 476
477 private: 477 private:
478 NACL_DISALLOW_COPY_AND_ASSIGN( 478 NACL_DISALLOW_COPY_AND_ASSIGN(
479 LoadStore2RegisterImmediateDoubleOpTesterNotRnIsPc); 479 LoadStore2RegisterImm8DoubleOpTesterNotRnIsPc);
480 };
481
482 // Models a 2-register load/store 12-bit immediate operation of the forms:
483 // Op<c> <Rt>, [<Rn> {, #+/-<imm12>}]
484 // Op<c> <Rt>, [<Rn>], #+/-<imm12>
485 // Op<c> <Rt>, [<Rn>, #+/-<imm12>]
486 // +--------+------+--+--+--+--+--+--------+--------+------------------------+
487 // |31302928|272625|24|23|22|21|20|19181716|15141312|1110 9 8 7 6 5 4 3 2 1 0|
488 // +--------+------+--+--+--+--+--+--------+--------+------------------------+
489 // | conds | | P| U| | w| | Rn | Rt | imm12 |
490 // +--------+------+--+--+--+--+--+--------+--------+------------------------+
491 // wback = (P=0 || W==1)
492 //
493 // if P=0 and W=1, should not parse as this instruction.
494 // if Rn=Sp && P=1 && U=0 && W=1 && imm12=4, then PUSH
495 // if wback && (Rn=15 or Rn=Rt) then unpredictable.
496 // NaCl disallows writing to PC.
497 //
498 // Note: We NaCl disallow Rt=PC for stores (not just loads), even
499 // though it isn't a requirement of the corresponding baseline
500 // classees. This is done so that StrImmediate (in the actual class
501 // decoders) behave the same as instances of this. This simplifies
502 // what we need to model in actual classes.
503 class LoadStore2RegisterImm12OpTester : public Arm32DecoderTester {
504 public:
505 explicit LoadStore2RegisterImm12OpTester(
506 const NamedClassDecoder& decoder);
507 virtual bool ApplySanityChecks(
508 nacl_arm_dec::Instruction inst,
509 const NamedClassDecoder& decoder);
510
511 private:
512 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm12OpTester);
513 };
514
515 // Defines a LoadStore2RegisterImm12OpTester with the added constraint
516 // that it doesn't parse when Rn=15.
517 class LoadStore2RegisterImm12OpTesterNotRnIsPc
518 : public LoadStore2RegisterImm12OpTester {
519 public:
520 LoadStore2RegisterImm12OpTesterNotRnIsPc(
521 const NamedClassDecoder& decoder);
522 virtual bool ApplySanityChecks(
523 nacl_arm_dec::Instruction inst,
524 const NamedClassDecoder& decoder);
525
526 private:
527 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore2RegisterImm12OpTesterNotRnIsPc);
480 }; 528 };
481 529
482 // Models a 3-register load/store operation of the forms: 530 // Models a 3-register load/store operation of the forms:
483 // Op<c> <Rt>, [<Rn>, +/-<Rm>]{!} 531 // Op<c> <Rt>, [<Rn>, +/-<Rm>]{!}
484 // Op<c> <Rt>, [<Rn>], +/-<Rm> 532 // Op<c> <Rt>, [<Rn>], +/-<Rm>
485 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ 533 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+
486 // |31302918|272625|24|23|22|21|20|19181716|15141312|1110 9 8 7 6 5 4| 3 2 1 0| 534 // |31302918|272625|24|23|22|21|20|19181716|15141312|1110 9 8 7 6 5 4| 3 2 1 0|
487 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ 535 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+
488 // | cond | | P| U| | W| | Rn | Rt | | Rm | 536 // | cond | | P| U| | W| | Rn | Rt | | Rm |
489 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+ 537 // +--------+------+--+--+--+--+--+--------+--------+----------------+--------+
(...skipping 23 matching lines...) Expand all
513 explicit LoadStore3RegisterDoubleOpTester( 561 explicit LoadStore3RegisterDoubleOpTester(
514 const NamedClassDecoder& decoder); 562 const NamedClassDecoder& decoder);
515 virtual bool ApplySanityChecks( 563 virtual bool ApplySanityChecks(
516 nacl_arm_dec::Instruction inst, 564 nacl_arm_dec::Instruction inst,
517 const NamedClassDecoder& decoder); 565 const NamedClassDecoder& decoder);
518 566
519 private: 567 private:
520 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore3RegisterDoubleOpTester); 568 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore3RegisterDoubleOpTester);
521 }; 569 };
522 570
571 // Models a 3-register with (shifted) immediate 5 load/store operation of
572 // the forms:
573 // Op<c> <Rt>, [<Rn>, +/-<Rm> {, <shift>}]{!}
574 // Op<c> <Rt>, [<Rn>], +-<Rm> {, <shift>}
575 // +------+------+--+--+--+--+--+--------+--------+----------+----+--+---------+
576 // |31..28|272625|24|23|22|21|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0 |
577 // +------+------+--+--+--+--+--+--------+--------+----------+----+--+---------+
578 // | cond | | P| U| | W| | Rm | Rt | imm5 |type| | Rm |
579 // +------+------+--+--+--+--+--+--------+--------+----------+----+--+---------+
580 // wback = (P=0 || W=1)
581 //
582 // If P=0 and W=1, should not parse as this instruction.
583 // If Rm=15 then unpredicatble.
584 // If wback && (Rn=15 or Rn=Rt) then unpredictable.
585 // if ArchVersion() < 6 && wback && Rm=Rn then unpredictable.
586 // NaCl Disallows writing to PC.
587 //
588 // Note: We NaCl disallow Rt=PC for stores (not just loads), even
589 // though it isn't a requirement of the corresponding baseline
590 // classes. This is done so that StrRegister (in the actual class
591 // decoders) behave the same as this. This simplifies what we need to
592 // model in actual classes.
593 class LoadStore3RegisterImm5OpTester : public Arm32DecoderTester {
594 public:
595 explicit LoadStore3RegisterImm5OpTester(
596 const NamedClassDecoder& decoder);
597 virtual bool ApplySanityChecks(
598 nacl_arm_dec::Instruction inst,
599 const NamedClassDecoder& decoder);
600
601 private:
602 NACL_DISALLOW_COPY_AND_ASSIGN(LoadStore3RegisterImm5OpTester);
603 };
604
523 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp. 605 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp.
524 // Op(S)<c> <Rd>, <Rm> {,<shift>} 606 // Op(S)<c> <Rd>, <Rm> {,<shift>}
525 // +--------+--------------+--+--------+--------+----------+----+--+--------+ 607 // +--------+--------------+--+--------+--------+----------+----+--+--------+
526 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| 608 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0|
527 // +--------+--------------+--+--------+--------+----------+----+--+--------+ 609 // +--------+--------------+--+--------+--------+----------+----+--+--------+
528 // | cond | | S| | Rd | imm5 |type| | Rm | 610 // | cond | | S| | Rd | imm5 |type| | Rm |
529 // +--------+--------------+--+--------+--------+----------+----+--+--------+ 611 // +--------+--------------+--+--------+--------+----------+----+--+--------+
530 // Definitions: 612 // Definitions:
531 // Rd - The destination register. 613 // Rd - The destination register.
532 // Rm - The source operand that is (optionally) shifted. 614 // Rm - The source operand that is (optionally) shifted.
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 nacl_arm_dec::Instruction inst, 837 nacl_arm_dec::Instruction inst,
756 const NamedClassDecoder& decoder); 838 const NamedClassDecoder& decoder);
757 839
758 private: 840 private:
759 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTestTesterRegsNotPc); 841 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTestTesterRegsNotPc);
760 }; 842 };
761 843
762 } // namespace 844 } // namespace
763 845
764 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ 846 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698