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 #ifndef NACL_TRUSTED_BUT_NOT_TCB | 6 #ifndef NACL_TRUSTED_BUT_NOT_TCB |
7 #error This file is not meant for use in the TCB | 7 #error This file is not meant for use in the TCB |
8 #endif | 8 #endif |
9 | 9 |
10 #include "native_client/src/trusted/validator_arm/inst_classes_testers.h" | 10 #include "native_client/src/trusted/validator_arm/inst_classes_testers.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 const NamedClassDecoder& decoder) { | 406 const NamedClassDecoder& decoder) { |
407 // Check that we don't parse when Rd=15 and S=1. | 407 // Check that we don't parse when Rd=15 and S=1. |
408 if ((expected_decoder_.d.reg(inst).Equals(Register::Pc())) && | 408 if ((expected_decoder_.d.reg(inst).Equals(Register::Pc())) && |
409 expected_decoder_.conditions.is_updated(inst)) { | 409 expected_decoder_.conditions.is_updated(inst)) { |
410 NC_EXPECT_NE_PRECOND(&ExpectedDecoder(), &decoder); | 410 NC_EXPECT_NE_PRECOND(&ExpectedDecoder(), &decoder); |
411 } | 411 } |
412 | 412 |
413 return Unary1RegisterImmediateOpTester::ApplySanityChecks(inst, decoder); | 413 return Unary1RegisterImmediateOpTester::ApplySanityChecks(inst, decoder); |
414 } | 414 } |
415 | 415 |
416 // Unary1RegisterBitRangeMsbGeLsbTesterRegsNotPc | 416 // Unary1RegisterBitRangeMsbGeLsbTester |
417 Unary1RegisterBitRangeMsbGeLsbTesterRegsNotPc:: | 417 Unary1RegisterBitRangeMsbGeLsbTester:: |
418 Unary1RegisterBitRangeMsbGeLsbTesterRegsNotPc( | 418 Unary1RegisterBitRangeMsbGeLsbTester( |
419 const NamedClassDecoder& decoder) | 419 const NamedClassDecoder& decoder) |
420 : CondDecoderTester(decoder) {} | 420 : CondDecoderTester(decoder) {} |
421 | 421 |
422 bool Unary1RegisterBitRangeMsbGeLsbTesterRegsNotPc:: | 422 bool Unary1RegisterBitRangeMsbGeLsbTester:: |
423 ApplySanityChecks(Instruction inst, | 423 ApplySanityChecks(Instruction inst, |
424 const NamedClassDecoder& decoder) { | 424 const NamedClassDecoder& decoder) { |
425 // Check if expected class name found. | 425 // Check if expected class name found. |
426 NC_PRECOND(CondDecoderTester::ApplySanityChecks(inst, decoder)); | 426 NC_PRECOND(CondDecoderTester::ApplySanityChecks(inst, decoder)); |
427 | 427 |
428 // Check registers and flags used. | 428 // Check registers and flags used. |
429 EXPECT_TRUE(expected_decoder_.d.reg(inst).Equals(inst.Reg(15, 12))); | 429 EXPECT_TRUE(expected_decoder_.d.reg(inst).Equals(inst.Reg(15, 12))); |
430 EXPECT_EQ(expected_decoder_.lsb.value(inst), inst.Bits(11, 7)); | 430 EXPECT_EQ(expected_decoder_.lsb.value(inst), inst.Bits(11, 7)); |
431 EXPECT_EQ(expected_decoder_.msb.value(inst), inst.Bits(20, 16)); | 431 EXPECT_EQ(expected_decoder_.msb.value(inst), inst.Bits(20, 16)); |
432 EXPECT_FALSE(expected_decoder_.d.reg(inst).Equals(Register::Pc())) | 432 EXPECT_FALSE(expected_decoder_.d.reg(inst).Equals(Register::Pc())) |
433 << "Expected UNPREDICTABLE for " << InstContents(); | 433 << "Expected UNPREDICTABLE for " << InstContents(); |
434 | 434 |
435 EXPECT_FALSE(expected_decoder_.msb.value(inst) < | 435 EXPECT_FALSE(expected_decoder_.msb.value(inst) < |
436 expected_decoder_.lsb.value(inst)) | 436 expected_decoder_.lsb.value(inst)) |
437 << "Expected UNPREDICTABLE for " << InstContents(); | 437 << "Expected UNPREDICTABLE for " << InstContents(); |
438 | 438 |
439 return true; | 439 return true; |
440 } | 440 } |
441 | 441 |
442 // Binary2RegisterBitRangeMsbGeLsbTesterRegsNotPc | 442 // Binary2RegisterBitRangeMsbGeLsbTester |
443 Binary2RegisterBitRangeMsbGeLsbTesterRegsNotPc:: | 443 Binary2RegisterBitRangeMsbGeLsbTester:: |
444 Binary2RegisterBitRangeMsbGeLsbTesterRegsNotPc( | 444 Binary2RegisterBitRangeMsbGeLsbTester( |
445 const NamedClassDecoder& decoder) | 445 const NamedClassDecoder& decoder) |
446 : CondDecoderTester(decoder) {} | 446 : CondDecoderTester(decoder) {} |
447 | 447 |
448 bool Binary2RegisterBitRangeMsbGeLsbTesterRegsNotPc:: | 448 bool Binary2RegisterBitRangeMsbGeLsbTester:: |
449 ApplySanityChecks(Instruction inst, | 449 ApplySanityChecks(Instruction inst, |
450 const NamedClassDecoder& decoder) { | 450 const NamedClassDecoder& decoder) { |
451 // Check if expected class name found. | 451 // Check if expected class name found. |
452 NC_PRECOND(CondDecoderTester::ApplySanityChecks(inst, decoder)); | 452 NC_PRECOND(CondDecoderTester::ApplySanityChecks(inst, decoder)); |
453 | 453 |
454 // Check registers and flags used. | 454 // Check registers and flags used. |
455 EXPECT_TRUE(expected_decoder_.n.reg(inst).Equals(inst.Reg(3, 0))); | 455 EXPECT_TRUE(expected_decoder_.n.reg(inst).Equals(inst.Reg(3, 0))); |
456 EXPECT_TRUE(expected_decoder_.d.reg(inst).Equals(inst.Reg(15, 12))); | 456 EXPECT_TRUE(expected_decoder_.d.reg(inst).Equals(inst.Reg(15, 12))); |
457 EXPECT_EQ(expected_decoder_.lsb.value(inst), inst.Bits(11, 7)); | 457 EXPECT_EQ(expected_decoder_.lsb.value(inst), inst.Bits(11, 7)); |
458 EXPECT_EQ(expected_decoder_.msb.value(inst), inst.Bits(20, 16)); | 458 EXPECT_EQ(expected_decoder_.msb.value(inst), inst.Bits(20, 16)); |
459 EXPECT_FALSE(expected_decoder_.n.reg(inst).Equals(Register::Pc())) | 459 EXPECT_FALSE(expected_decoder_.n.reg(inst).Equals(Register::Pc())) |
460 << "Expected UNPREDICTABLE for " << InstContents(); | 460 << "Expected UNPREDICTABLE for " << InstContents(); |
461 EXPECT_FALSE(expected_decoder_.d.reg(inst).Equals(Register::Pc())) | 461 EXPECT_FALSE(expected_decoder_.d.reg(inst).Equals(Register::Pc())) |
462 << "Expected UNPREDICTABLE for " << InstContents(); | 462 << "Expected UNPREDICTABLE for " << InstContents(); |
463 | 463 |
464 EXPECT_FALSE(expected_decoder_.msb.value(inst) < | 464 EXPECT_FALSE(expected_decoder_.msb.value(inst) < |
465 expected_decoder_.lsb.value(inst)) | 465 expected_decoder_.lsb.value(inst)) |
466 << "Expected UNPREDICTABLE for " << InstContents(); | 466 << "Expected UNPREDICTABLE for " << InstContents(); |
467 | 467 |
468 return true; | 468 return true; |
469 } | 469 } |
470 | 470 |
471 // Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc | 471 // Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester |
472 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc:: | 472 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester:: |
473 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc( | 473 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester( |
474 const NamedClassDecoder& decoder) | 474 const NamedClassDecoder& decoder) |
475 : CondDecoderTester(decoder) {} | 475 : CondDecoderTester(decoder) {} |
476 | 476 |
477 bool Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc:: | 477 bool Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester:: |
478 ApplySanityChecks(Instruction inst, | 478 ApplySanityChecks(Instruction inst, |
479 const NamedClassDecoder& decoder) { | 479 const NamedClassDecoder& decoder) { |
480 NC_PRECOND(CondDecoderTester::ApplySanityChecks(inst, decoder)); | 480 NC_PRECOND(CondDecoderTester::ApplySanityChecks(inst, decoder)); |
481 | 481 |
482 EXPECT_FALSE(expected_decoder_.n.reg(inst).Equals(Register::Pc())) | 482 EXPECT_FALSE(expected_decoder_.n.reg(inst).Equals(Register::Pc())) |
483 << "Expected UNPREDICTABLE for " << InstContents(); | 483 << "Expected UNPREDICTABLE for " << InstContents(); |
484 EXPECT_FALSE(expected_decoder_.d.reg(inst).Equals(Register::Pc())) | 484 EXPECT_FALSE(expected_decoder_.d.reg(inst).Equals(Register::Pc())) |
485 << "Expected UNPREDICTABLE for " << InstContents(); | 485 << "Expected UNPREDICTABLE for " << InstContents(); |
486 EXPECT_FALSE(expected_decoder_.lsb.value(inst) + | 486 EXPECT_FALSE(expected_decoder_.lsb.value(inst) + |
487 expected_decoder_.widthm1.value(inst) > 31) | 487 expected_decoder_.widthm1.value(inst) > 31) |
(...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2613 // PermanentlyUndefinedTester | 2613 // PermanentlyUndefinedTester |
2614 bool PermanentlyUndefinedTester::ApplySanityChecks(Instruction inst, | 2614 bool PermanentlyUndefinedTester::ApplySanityChecks(Instruction inst, |
2615 const NamedClassDecoder& decoder) { | 2615 const NamedClassDecoder& decoder) { |
2616 // Check if expected class name found. | 2616 // Check if expected class name found. |
2617 NC_PRECOND(CondDecoderTester::ApplySanityChecks(inst, decoder)); | 2617 NC_PRECOND(CondDecoderTester::ApplySanityChecks(inst, decoder)); |
2618 | 2618 |
2619 return true; | 2619 return true; |
2620 } | 2620 } |
2621 | 2621 |
2622 } // namespace nacl_arm_test | 2622 } // namespace nacl_arm_test |
OLD | NEW |