| Index: src/trusted/validator_arm/validator_small_tests.cc
|
| diff --git a/src/trusted/validator_arm/validator_small_tests.cc b/src/trusted/validator_arm/validator_small_tests.cc
|
| index e58888ff2397f3a818f7afb2895d8d980d6b5f37..cbb6eb35f4a1c39c394c48a7807e1ee148884559 100644
|
| --- a/src/trusted/validator_arm/validator_small_tests.cc
|
| +++ b/src/trusted/validator_arm/validator_small_tests.cc
|
| @@ -520,23 +520,6 @@ TEST_F(ValidatorTests, ScaryUndefinedInstructions) {
|
| }
|
| }
|
|
|
| -TEST_F(ValidatorTests, LessScaryUndefinedInstructions) {
|
| - // These instructions are specified by ARM as *permanently* undefined, so we
|
| - // treat them as a reliable Illegal Instruction trap.
|
| -
|
| - static const AnnotatedInstruction perm_undefined[] = {
|
| - { 0xE7FFDEFE, "permanently undefined instruction produced by LLVM" },
|
| - };
|
| -
|
| - for (unsigned i = 0; i < NACL_ARRAY_SIZE(perm_undefined); i++) {
|
| - arm_inst program[] = { perm_undefined[i].inst };
|
| - validation_should_pass(program,
|
| - 1,
|
| - kDefaultBaseAddr,
|
| - perm_undefined[i].about);
|
| - }
|
| -}
|
| -
|
| TEST_F(ValidatorTests, PcRelativeFirstInst) {
|
| // Note: This tests the fix for issue 2771.
|
| static const arm_inst pcrel_boundary_tests[] = {
|
| @@ -1046,6 +1029,49 @@ TEST_F(ValidatorTests, LiteralPoolHeadIsBreakpoint) {
|
| "it needs to act as a roadblock");
|
| }
|
|
|
| +TEST_F(ValidatorTests, Breakpoint) {
|
| + EXPECT_EQ(nacl_arm_dec::kBreakpoint & 0xFFF000F0,
|
| + 0xE1200070) // BKPT #0
|
| + << ("the breakpoint instruction should be a breakpoint: "
|
| + "it needs to trap");
|
| +}
|
| +
|
| +TEST_F(ValidatorTests, HaltFill) {
|
| + EXPECT_EQ(nacl_arm_dec::kHaltFill & 0xFFF000F0,
|
| + 0xE7F000F0) // UDF #0
|
| + << ("the halt fill instruction should be UDF: "
|
| + "it needs to trap");
|
| +}
|
| +
|
| +TEST_F(ValidatorTests, AbortNow) {
|
| + EXPECT_EQ(nacl_arm_dec::kAbortNow & 0xFFF000F0,
|
| + 0xE7F000F0) // UDF #0
|
| + << ("the abort now instruction should be UDF: "
|
| + "it needs to trap");
|
| +}
|
| +
|
| +TEST_F(ValidatorTests, FailValidation) {
|
| + EXPECT_EQ(nacl_arm_dec::kFailValidation & 0xFFF000F0,
|
| + 0xE7F000F0) // UDF #0
|
| + << ("the fail validation instruction should be UDF: "
|
| + "it needs to trap");
|
| +}
|
| +
|
| +TEST_F(ValidatorTests, UDFAndBKPTValidateAsExpected) {
|
| + ProblemSpy spy;
|
| + for (uint32_t i = 0; i < 0xFFFF; ++i) {
|
| + arm_inst bkpt_inst = 0xE1200070 | ((i & 0xFFF0) << 4) | (i & 0xF);
|
| + arm_inst udf_inst = 0xE7F000F0 | ((i & 0xFFF0) << 4) | (i & 0xF);
|
| + EXPECT_EQ(validate(&bkpt_inst, 1, kDefaultBaseAddr, &spy),
|
| + ((bkpt_inst == nacl_arm_dec::kLiteralPoolHeadInstruction) ||
|
| + (bkpt_inst == nacl_arm_dec::kBreakpoint)));
|
| + EXPECT_EQ(validate(&udf_inst, 1, kDefaultBaseAddr, &spy),
|
| + ((udf_inst == nacl_arm_dec::kHaltFill) ||
|
| + (udf_inst == nacl_arm_dec::kAbortNow)));
|
| + // Tautological note: kFailValidation should fail validation.
|
| + }
|
| +}
|
| +
|
| TEST_F(ValidatorTests, LiteralPoolHeadInstruction) {
|
| // Make sure that literal pools are handled properly: they should be preceded
|
| // by a special breakpoint instruction at the start of the bundle, and can
|
|
|