| 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 14 matching lines...) Expand all Loading... |
| 25 // +--------+--------------+--+--------+--------+------------------------+ | 25 // +--------+--------------+--+--------+--------+------------------------+ |
| 26 // | cond | | S| imm4 | Rd | imm12 | | 26 // | cond | | S| imm4 | Rd | imm12 | |
| 27 // +--------+--------------+--+--------+--------+------------------------+ | 27 // +--------+--------------+--+--------+--------+------------------------+ |
| 28 // Definitions: | 28 // Definitions: |
| 29 // Rd = The destination register. | 29 // Rd = The destination register. |
| 30 // const = ZeroExtend(imm4:imm12, 32) | 30 // const = ZeroExtend(imm4:imm12, 32) |
| 31 class Unary1RegisterImmediateOpTester : public Arm32DecoderTester { | 31 class Unary1RegisterImmediateOpTester : public Arm32DecoderTester { |
| 32 public: | 32 public: |
| 33 explicit Unary1RegisterImmediateOpTester( | 33 explicit Unary1RegisterImmediateOpTester( |
| 34 const NamedClassDecoder& decoder); | 34 const NamedClassDecoder& decoder); |
| 35 virtual void ApplySanityChecks(nacl_arm_dec::Instruction inst, | 35 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst, |
| 36 const NamedClassDecoder& decoder); | 36 const NamedClassDecoder& decoder); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 NACL_DISALLOW_COPY_AND_ASSIGN(Unary1RegisterImmediateOpTester); | 39 NACL_DISALLOW_COPY_AND_ASSIGN(Unary1RegisterImmediateOpTester); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // Implements a decoder tester for decoder Unary1RegisterImmediateOp | 42 // Implements a decoder tester for decoder Unary1RegisterImmediateOp |
| 43 // with a constraint that if Rd is R15, the instruction is unpredictable. | 43 // with a constraint that if Rd is R15, the instruction is unpredictable. |
| 44 class Unary1RegisterImmediateOpTesterRegsNotPc | 44 class Unary1RegisterImmediateOpTesterRegsNotPc |
| 45 : public Unary1RegisterImmediateOpTester { | 45 : public Unary1RegisterImmediateOpTester { |
| 46 public: | 46 public: |
| 47 explicit Unary1RegisterImmediateOpTesterRegsNotPc( | 47 explicit Unary1RegisterImmediateOpTesterRegsNotPc( |
| 48 const NamedClassDecoder& decoder); | 48 const NamedClassDecoder& decoder); |
| 49 virtual void ApplySanityChecks( | 49 virtual bool ApplySanityChecks( |
| 50 nacl_arm_dec::Instruction inst, | 50 nacl_arm_dec::Instruction inst, |
| 51 const NamedClassDecoder& decoder); | 51 const NamedClassDecoder& decoder); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 NACL_DISALLOW_COPY_AND_ASSIGN(Unary1RegisterImmediateOpTesterRegsNotPc); | 54 NACL_DISALLOW_COPY_AND_ASSIGN(Unary1RegisterImmediateOpTesterRegsNotPc); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // Implements a decoder tester for decoder BinaryRegisterImmediateTest | 57 // Implements a decoder tester for decoder BinaryRegisterImmediateTest |
| 58 // Op(S)<c> Rn, #<const> | 58 // Op(S)<c> Rn, #<const> |
| 59 // +--------+--------------+--+--------+--------+------------------------+ | 59 // +--------+--------------+--+--------+--------+------------------------+ |
| 60 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7 6 5 4 3 2 1 0| | 60 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7 6 5 4 3 2 1 0| |
| 61 // +--------+--------------+--+--------+--------+------------------------+ | 61 // +--------+--------------+--+--------+--------+------------------------+ |
| 62 // | cond | | S| Rn | | imm12 | | 62 // | cond | | S| Rn | | imm12 | |
| 63 // +--------+--------------+--+--------+--------+------------------------+ | 63 // +--------+--------------+--+--------+--------+------------------------+ |
| 64 // Definitions: | 64 // Definitions: |
| 65 // Rn 0 The operand register. | 65 // Rn 0 The operand register. |
| 66 // const = ARMExpandImm_C(imm12, ASPR.C) | 66 // const = ARMExpandImm_C(imm12, ASPR.C) |
| 67 class BinaryRegisterImmediateTestTester : public Arm32DecoderTester { | 67 class BinaryRegisterImmediateTestTester : public Arm32DecoderTester { |
| 68 public: | 68 public: |
| 69 explicit BinaryRegisterImmediateTestTester( | 69 explicit BinaryRegisterImmediateTestTester( |
| 70 const NamedClassDecoder& decoder); | 70 const NamedClassDecoder& decoder); |
| 71 virtual void ApplySanityChecks(nacl_arm_dec::Instruction inst, | 71 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst, |
| 72 const NamedClassDecoder& decoder); | 72 const NamedClassDecoder& decoder); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 NACL_DISALLOW_COPY_AND_ASSIGN(BinaryRegisterImmediateTestTester); | 75 NACL_DISALLOW_COPY_AND_ASSIGN(BinaryRegisterImmediateTestTester); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 // Implements a decoder tester for decoder Unary2RegisterOp. | 78 // Implements a decoder tester for decoder Unary2RegisterOp. |
| 79 // Op(S)<c> <Rd>, <Rm> | 79 // Op(S)<c> <Rd>, <Rm> |
| 80 // +--------+--------------+--+--------+--------+----------------+--------+ | 80 // +--------+--------------+--+--------+--------+----------------+--------+ |
| 81 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7 6 5 4| 3 2 1 0| | 81 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7 6 5 4| 3 2 1 0| |
| 82 // +--------+--------------+--+--------+--------+----------------+--------+ | 82 // +--------+--------------+--+--------+--------+----------------+--------+ |
| 83 // | cond | | S| | Rd | | Rm | | 83 // | cond | | S| | Rd | | Rm | |
| 84 // +--------+--------------+--+--------+--------+----------------+--------+ | 84 // +--------+--------------+--+--------+--------+----------------+--------+ |
| 85 // Note: NaCl disallows writing to PC to cause a jump. | 85 // Note: NaCl disallows writing to PC to cause a jump. |
| 86 // Definitions: | 86 // Definitions: |
| 87 // Rd - The destination register. | 87 // Rd - The destination register. |
| 88 // Rm - The source register. | 88 // Rm - The source register. |
| 89 class Unary2RegisterOpTester : public Arm32DecoderTester { | 89 class Unary2RegisterOpTester : public Arm32DecoderTester { |
| 90 public: | 90 public: |
| 91 explicit Unary2RegisterOpTester( | 91 explicit Unary2RegisterOpTester( |
| 92 const NamedClassDecoder& decoder); | 92 const NamedClassDecoder& decoder); |
| 93 virtual void ApplySanityChecks( | 93 virtual bool ApplySanityChecks( |
| 94 nacl_arm_dec::Instruction inst, | 94 nacl_arm_dec::Instruction inst, |
| 95 const NamedClassDecoder& decoder); | 95 const NamedClassDecoder& decoder); |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterOpTester); | 98 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterOpTester); |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // Implements a decoder tester for decoder Unary2RegisterOp, and | 101 // Implements a decoder tester for decoder Unary2RegisterOp, and |
| 102 // should not parse when Rd=15 and S=1. | 102 // should not parse when Rd=15 and S=1. |
| 103 class Unary2RegisterOpTesterNotRdIsPcAndS : public Unary2RegisterOpTester { | 103 class Unary2RegisterOpTesterNotRdIsPcAndS : public Unary2RegisterOpTester { |
| 104 public: | 104 public: |
| 105 explicit Unary2RegisterOpTesterNotRdIsPcAndS( | 105 explicit Unary2RegisterOpTesterNotRdIsPcAndS( |
| 106 const NamedClassDecoder& decoder); | 106 const NamedClassDecoder& decoder); |
| 107 virtual void ApplySanityChecks( | 107 virtual bool ApplySanityChecks( |
| 108 nacl_arm_dec::Instruction inst, | 108 nacl_arm_dec::Instruction inst, |
| 109 const NamedClassDecoder& decoder); | 109 const NamedClassDecoder& decoder); |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterOpTesterNotRdIsPcAndS); | 112 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterOpTesterNotRdIsPcAndS); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 // Implements a decoder tester for decoder Binary2RegisterImmediateOp. | 115 // Implements a decoder tester for decoder Binary2RegisterImmediateOp. |
| 116 // Op(S)<c> <Rd>, <Rn>, #<const> | 116 // Op(S)<c> <Rd>, <Rn>, #<const> |
| 117 // +--------+--------------+--+--------+--------+------------------------+ | 117 // +--------+--------------+--+--------+--------+------------------------+ |
| 118 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7 6 5 4 3 2 1 0| | 118 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7 6 5 4 3 2 1 0| |
| 119 // +--------+--------------+--+--------+--------+------------------------+ | 119 // +--------+--------------+--+--------+--------+------------------------+ |
| 120 // | cond | | S| Rn | Rd | imm12 | | 120 // | cond | | S| Rn | Rd | imm12 | |
| 121 // +--------+--------------+--+--------+--------+------------------------+ | 121 // +--------+--------------+--+--------+--------+------------------------+ |
| 122 // Definitions: | 122 // Definitions: |
| 123 // Rd = The destination register. | 123 // Rd = The destination register. |
| 124 // Rn = The first operand register. | 124 // Rn = The first operand register. |
| 125 // const = The immediate value to be used as the second argument. | 125 // const = The immediate value to be used as the second argument. |
| 126 class Binary2RegisterImmediateOpTester : public Arm32DecoderTester { | 126 class Binary2RegisterImmediateOpTester : public Arm32DecoderTester { |
| 127 public: | 127 public: |
| 128 explicit Binary2RegisterImmediateOpTester( | 128 explicit Binary2RegisterImmediateOpTester( |
| 129 const NamedClassDecoder& decoder); | 129 const NamedClassDecoder& decoder); |
| 130 virtual void ApplySanityChecks( | 130 virtual bool ApplySanityChecks( |
| 131 nacl_arm_dec::Instruction inst, | 131 nacl_arm_dec::Instruction inst, |
| 132 const NamedClassDecoder& decoder); | 132 const NamedClassDecoder& decoder); |
| 133 | 133 |
| 134 protected: | 134 protected: |
| 135 // If true, the Rd=15 Nacl Check is applied. | 135 // If true, the Rd=15 Nacl Check is applied. |
| 136 bool apply_rd_is_pc_check_; | 136 bool apply_rd_is_pc_check_; |
| 137 | 137 |
| 138 private: | 138 private: |
| 139 NACL_DISALLOW_COPY_AND_ASSIGN(Binary2RegisterImmediateOpTester); | 139 NACL_DISALLOW_COPY_AND_ASSIGN(Binary2RegisterImmediateOpTester); |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // Implements a decoder tester for decoder Binary2RegisterImmediateOp, | 142 // Implements a decoder tester for decoder Binary2RegisterImmediateOp, |
| 143 // and should not parse when Rd=15 and S=1. | 143 // and should not parse when Rd=15 and S=1. |
| 144 class Binary2RegisterImmediateOpTesterNotRdIsPcAndS | 144 class Binary2RegisterImmediateOpTesterNotRdIsPcAndS |
| 145 : public Binary2RegisterImmediateOpTester { | 145 : public Binary2RegisterImmediateOpTester { |
| 146 public: | 146 public: |
| 147 Binary2RegisterImmediateOpTesterNotRdIsPcAndS( | 147 Binary2RegisterImmediateOpTesterNotRdIsPcAndS( |
| 148 const NamedClassDecoder& decoder); | 148 const NamedClassDecoder& decoder); |
| 149 virtual void ApplySanityChecks(nacl_arm_dec::Instruction inst, | 149 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst, |
| 150 const NamedClassDecoder& decoder); | 150 const NamedClassDecoder& decoder); |
| 151 | 151 |
| 152 private: | 152 private: |
| 153 NACL_DISALLOW_COPY_AND_ASSIGN(Binary2RegisterImmediateOpTesterNotRdIsPcAndS); | 153 NACL_DISALLOW_COPY_AND_ASSIGN(Binary2RegisterImmediateOpTesterNotRdIsPcAndS); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 // Implements a decoder tester for decoder Binary2RegisterImmediateOp, | 156 // Implements a decoder tester for decoder Binary2RegisterImmediateOp, |
| 157 // where Rd can be Pc (overriding default NaCl assumptions), | 157 // where Rd can be Pc (overriding default NaCl assumptions), |
| 158 // and should not parse when Rd=15 and S=1. | 158 // and should not parse when Rd=15 and S=1. |
| 159 class Binary2RegisterImmediateOpTesterRdCanBePcAndNotRdIsPcAndS | 159 class Binary2RegisterImmediateOpTesterRdCanBePcAndNotRdIsPcAndS |
| (...skipping 16 matching lines...) Expand all Loading... |
| 176 // +--------+--------------+--+--------+--------+--------+--------+--------+ | 176 // +--------+--------------+--+--------+--------+--------+--------+--------+ |
| 177 // Definitions: | 177 // Definitions: |
| 178 // Rd - The destination register. | 178 // Rd - The destination register. |
| 179 // Rn - The first operand register. | 179 // Rn - The first operand register. |
| 180 // Rm - The second operand register. | 180 // Rm - The second operand register. |
| 181 // S - Defines if the flags regsiter is updated. | 181 // S - Defines if the flags regsiter is updated. |
| 182 class Binary3RegisterOpTester : public Arm32DecoderTester { | 182 class Binary3RegisterOpTester : public Arm32DecoderTester { |
| 183 public: | 183 public: |
| 184 explicit Binary3RegisterOpTester( | 184 explicit Binary3RegisterOpTester( |
| 185 const NamedClassDecoder& decoder); | 185 const NamedClassDecoder& decoder); |
| 186 virtual void ApplySanityChecks( | 186 virtual bool ApplySanityChecks( |
| 187 nacl_arm_dec::Instruction inst, | 187 nacl_arm_dec::Instruction inst, |
| 188 const NamedClassDecoder& decoder); | 188 const NamedClassDecoder& decoder); |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterOpTester); | 191 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterOpTester); |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 // Implements a decoder tester for Binary3RegisterOp with a constraint | 194 // Implements a decoder tester for Binary3RegisterOp with a constraint |
| 195 // that if Rd, Rm, or Rn is R15, the instruction is unpredictable. | 195 // that if Rd, Rm, or Rn is R15, the instruction is unpredictable. |
| 196 class Binary3RegisterOpTesterRegsNotPc | 196 class Binary3RegisterOpTesterRegsNotPc |
| 197 : public Binary3RegisterOpTester { | 197 : public Binary3RegisterOpTester { |
| 198 public: | 198 public: |
| 199 explicit Binary3RegisterOpTesterRegsNotPc( | 199 explicit Binary3RegisterOpTesterRegsNotPc( |
| 200 const NamedClassDecoder& decoder); | 200 const NamedClassDecoder& decoder); |
| 201 virtual void ApplySanityChecks( | 201 virtual bool ApplySanityChecks( |
| 202 nacl_arm_dec::Instruction inst, | 202 nacl_arm_dec::Instruction inst, |
| 203 const NamedClassDecoder& decoder); | 203 const NamedClassDecoder& decoder); |
| 204 | 204 |
| 205 private: | 205 private: |
| 206 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterOpTesterRegsNotPc); | 206 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterOpTesterRegsNotPc); |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp. | 209 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp. |
| 210 // Op(S)<c> <Rd>, <Rm> {,<shift>} | 210 // Op(S)<c> <Rd>, <Rm> {,<shift>} |
| 211 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 211 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 212 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| | 212 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| |
| 213 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 213 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 214 // | cond | | S| | Rd | imm5 |type| | Rm | | 214 // | cond | | S| | Rd | imm5 |type| | Rm | |
| 215 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 215 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 216 // Definitions: | 216 // Definitions: |
| 217 // Rd - The destination register. | 217 // Rd - The destination register. |
| 218 // Rm - The source operand that is (optionally) shifted. | 218 // Rm - The source operand that is (optionally) shifted. |
| 219 // shift = DecodeImmShift(type, imm5) is the amount to shift. | 219 // shift = DecodeImmShift(type, imm5) is the amount to shift. |
| 220 class Unary2RegisterImmedShiftedOpTester : public Arm32DecoderTester { | 220 class Unary2RegisterImmedShiftedOpTester : public Arm32DecoderTester { |
| 221 public: | 221 public: |
| 222 explicit Unary2RegisterImmedShiftedOpTester( | 222 explicit Unary2RegisterImmedShiftedOpTester( |
| 223 const NamedClassDecoder& decoder); | 223 const NamedClassDecoder& decoder); |
| 224 virtual void ApplySanityChecks( | 224 virtual bool ApplySanityChecks( |
| 225 nacl_arm_dec::Instruction inst, | 225 nacl_arm_dec::Instruction inst, |
| 226 const NamedClassDecoder& decoder); | 226 const NamedClassDecoder& decoder); |
| 227 | 227 |
| 228 private: | 228 private: |
| 229 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterImmedShiftedOpTester); | 229 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterImmedShiftedOpTester); |
| 230 }; | 230 }; |
| 231 | 231 |
| 232 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp, and | 232 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp, and |
| 233 // should not parse when imm5=0 | 233 // should not parse when imm5=0 |
| 234 class Unary2RegisterImmedShiftedOpTesterImm5NotZero | 234 class Unary2RegisterImmedShiftedOpTesterImm5NotZero |
| 235 : public Unary2RegisterImmedShiftedOpTester { | 235 : public Unary2RegisterImmedShiftedOpTester { |
| 236 public: | 236 public: |
| 237 explicit Unary2RegisterImmedShiftedOpTesterImm5NotZero( | 237 explicit Unary2RegisterImmedShiftedOpTesterImm5NotZero( |
| 238 const NamedClassDecoder& decoder); | 238 const NamedClassDecoder& decoder); |
| 239 virtual void ApplySanityChecks( | 239 virtual bool ApplySanityChecks( |
| 240 nacl_arm_dec::Instruction inst, | 240 nacl_arm_dec::Instruction inst, |
| 241 const NamedClassDecoder& decoder); | 241 const NamedClassDecoder& decoder); |
| 242 | 242 |
| 243 private: | 243 private: |
| 244 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterImmedShiftedOpTesterImm5NotZero); | 244 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterImmedShiftedOpTesterImm5NotZero); |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp, and | 247 // Implements a decoder tester for decoder Unary2RegisterImmedShiftedOp, and |
| 248 // should not parse when Rd=1111 and S=1 | 248 // should not parse when Rd=1111 and S=1 |
| 249 class Unary2RegisterImmedShiftedOpTesterNotRdIsPcAndS | 249 class Unary2RegisterImmedShiftedOpTesterNotRdIsPcAndS |
| 250 : public Unary2RegisterImmedShiftedOpTester { | 250 : public Unary2RegisterImmedShiftedOpTester { |
| 251 public: | 251 public: |
| 252 explicit Unary2RegisterImmedShiftedOpTesterNotRdIsPcAndS( | 252 explicit Unary2RegisterImmedShiftedOpTesterNotRdIsPcAndS( |
| 253 const NamedClassDecoder& decoder); | 253 const NamedClassDecoder& decoder); |
| 254 virtual void ApplySanityChecks( | 254 virtual bool ApplySanityChecks( |
| 255 nacl_arm_dec::Instruction inst, | 255 nacl_arm_dec::Instruction inst, |
| 256 const NamedClassDecoder& decoder); | 256 const NamedClassDecoder& decoder); |
| 257 | 257 |
| 258 private: | 258 private: |
| 259 NACL_DISALLOW_COPY_AND_ASSIGN( | 259 NACL_DISALLOW_COPY_AND_ASSIGN( |
| 260 Unary2RegisterImmedShiftedOpTesterNotRdIsPcAndS); | 260 Unary2RegisterImmedShiftedOpTesterNotRdIsPcAndS); |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 // Implements a decoder tester for decoder Unary3RegisterShiftedOp. | 263 // Implements a decoder tester for decoder Unary3RegisterShiftedOp. |
| 264 // Op(S)<c> <Rd>, <Rm>, <type> <Rs> | 264 // Op(S)<c> <Rd>, <Rm>, <type> <Rs> |
| 265 // Definitions: | 265 // Definitions: |
| 266 // Rd - The destination register. | 266 // Rd - The destination register. |
| 267 // Rm - The register that is shifted and used as the operand. | 267 // Rm - The register that is shifted and used as the operand. |
| 268 // Rs - The regsiter whose bottom byte contains the amount to shift by. | 268 // Rs - The regsiter whose bottom byte contains the amount to shift by. |
| 269 // type - The type of shift to apply (not modeled). | 269 // type - The type of shift to apply (not modeled). |
| 270 // S - Defines if the flags regsiter is updated. | 270 // S - Defines if the flags regsiter is updated. |
| 271 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 271 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 272 // |31302928|27262524232221|20|19181716|15141312|1110 9 8| 7| 6 5| 4| 3 2 1 0| | 272 // |31302928|27262524232221|20|19181716|15141312|1110 9 8| 7| 6 5| 4| 3 2 1 0| |
| 273 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 273 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 274 // | cond | | S| | Rd | Rs | |type| | Rm | | 274 // | cond | | S| | Rd | Rs | |type| | Rm | |
| 275 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 275 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 276 class Unary3RegisterShiftedOpTester : public Arm32DecoderTester { | 276 class Unary3RegisterShiftedOpTester : public Arm32DecoderTester { |
| 277 public: | 277 public: |
| 278 explicit Unary3RegisterShiftedOpTester( | 278 explicit Unary3RegisterShiftedOpTester( |
| 279 const NamedClassDecoder& decoder); | 279 const NamedClassDecoder& decoder); |
| 280 virtual void ApplySanityChecks( | 280 virtual bool ApplySanityChecks( |
| 281 nacl_arm_dec::Instruction inst, | 281 nacl_arm_dec::Instruction inst, |
| 282 const NamedClassDecoder& decoder); | 282 const NamedClassDecoder& decoder); |
| 283 | 283 |
| 284 private: | 284 private: |
| 285 NACL_DISALLOW_COPY_AND_ASSIGN(Unary3RegisterShiftedOpTester); | 285 NACL_DISALLOW_COPY_AND_ASSIGN(Unary3RegisterShiftedOpTester); |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 // Implements a decoder tester for decoder Unary3RegisterShiftedOp with | 288 // Implements a decoder tester for decoder Unary3RegisterShiftedOp with |
| 289 // a constraint that if Rd, Rs, or Rm is R15, the instruction is unpredictable. | 289 // a constraint that if Rd, Rs, or Rm is R15, the instruction is unpredictable. |
| 290 class Unary3RegisterShiftedOpTesterRegsNotPc | 290 class Unary3RegisterShiftedOpTesterRegsNotPc |
| 291 : public Unary3RegisterShiftedOpTester { | 291 : public Unary3RegisterShiftedOpTester { |
| 292 public: | 292 public: |
| 293 explicit Unary3RegisterShiftedOpTesterRegsNotPc( | 293 explicit Unary3RegisterShiftedOpTesterRegsNotPc( |
| 294 const NamedClassDecoder& decoder); | 294 const NamedClassDecoder& decoder); |
| 295 virtual void ApplySanityChecks( | 295 virtual bool ApplySanityChecks( |
| 296 nacl_arm_dec::Instruction inst, | 296 nacl_arm_dec::Instruction inst, |
| 297 const NamedClassDecoder& decoder); | 297 const NamedClassDecoder& decoder); |
| 298 | 298 |
| 299 private: | 299 private: |
| 300 NACL_DISALLOW_COPY_AND_ASSIGN(Unary3RegisterShiftedOpTesterRegsNotPc); | 300 NACL_DISALLOW_COPY_AND_ASSIGN(Unary3RegisterShiftedOpTesterRegsNotPc); |
| 301 }; | 301 }; |
| 302 | 302 |
| 303 // Implements a decoder tester for decoder Binary3RegisterImmedShiftedOp. | 303 // Implements a decoder tester for decoder Binary3RegisterImmedShiftedOp. |
| 304 // Op(S)<c> <Rd>, <Rn>, <Rm> {,<shift>} | 304 // Op(S)<c> <Rd>, <Rn>, <Rm> {,<shift>} |
| 305 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 305 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 306 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| | 306 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| |
| 307 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 307 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 308 // | cond | | S| Rn | Rd | imm5 |type| | Rm | | 308 // | cond | | S| Rn | Rd | imm5 |type| | Rm | |
| 309 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 309 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 310 // Definitions: | 310 // Definitions: |
| 311 // Rd - The destination register. | 311 // Rd - The destination register. |
| 312 // Rn - The first operand register. | 312 // Rn - The first operand register. |
| 313 // Rm - The second operand that is (optionally) shifted. | 313 // Rm - The second operand that is (optionally) shifted. |
| 314 // shift = DecodeImmShift(type, imm5) is the amount to shift. | 314 // shift = DecodeImmShift(type, imm5) is the amount to shift. |
| 315 class Binary3RegisterImmedShiftedOpTester : public Arm32DecoderTester { | 315 class Binary3RegisterImmedShiftedOpTester : public Arm32DecoderTester { |
| 316 public: | 316 public: |
| 317 explicit Binary3RegisterImmedShiftedOpTester( | 317 explicit Binary3RegisterImmedShiftedOpTester( |
| 318 const NamedClassDecoder& decoder); | 318 const NamedClassDecoder& decoder); |
| 319 virtual void ApplySanityChecks( | 319 virtual bool ApplySanityChecks( |
| 320 nacl_arm_dec::Instruction inst, | 320 nacl_arm_dec::Instruction inst, |
| 321 const NamedClassDecoder& decoder); | 321 const NamedClassDecoder& decoder); |
| 322 | 322 |
| 323 private: | 323 private: |
| 324 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterImmedShiftedOpTester); | 324 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterImmedShiftedOpTester); |
| 325 }; | 325 }; |
| 326 | 326 |
| 327 // Implements a decoder tester for decoder Binary3RegisterImmedShiftedOp, and | 327 // Implements a decoder tester for decoder Binary3RegisterImmedShiftedOp, and |
| 328 // should not parse when Rd=15 and S=1. | 328 // should not parse when Rd=15 and S=1. |
| 329 class Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndS | 329 class Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndS |
| 330 : public Binary3RegisterImmedShiftedOpTester { | 330 : public Binary3RegisterImmedShiftedOpTester { |
| 331 public: | 331 public: |
| 332 explicit Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndS( | 332 explicit Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndS( |
| 333 const NamedClassDecoder& decoder); | 333 const NamedClassDecoder& decoder); |
| 334 virtual void ApplySanityChecks( | 334 virtual bool ApplySanityChecks( |
| 335 nacl_arm_dec::Instruction inst, | 335 nacl_arm_dec::Instruction inst, |
| 336 const NamedClassDecoder& decoder); | 336 const NamedClassDecoder& decoder); |
| 337 | 337 |
| 338 private: | 338 private: |
| 339 NACL_DISALLOW_COPY_AND_ASSIGN( | 339 NACL_DISALLOW_COPY_AND_ASSIGN( |
| 340 Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndS); | 340 Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndS); |
| 341 }; | 341 }; |
| 342 | 342 |
| 343 // Implements a decoder tester for decoder Binary3RegisterImmedShiftedOp, and | 343 // Implements a decoder tester for decoder Binary3RegisterImmedShiftedOp, and |
| 344 // should not parse when Rd=15 and S=1, or Rn=13 | 344 // should not parse when Rd=15 and S=1, or Rn=13 |
| 345 class Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndSOrRnIsSp | 345 class Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndSOrRnIsSp |
| 346 : public Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndS { | 346 : public Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndS { |
| 347 public: | 347 public: |
| 348 explicit Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndSOrRnIsSp( | 348 explicit Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndSOrRnIsSp( |
| 349 const NamedClassDecoder& decoder); | 349 const NamedClassDecoder& decoder); |
| 350 virtual void ApplySanityChecks( | 350 virtual bool ApplySanityChecks( |
| 351 nacl_arm_dec::Instruction inst, | 351 nacl_arm_dec::Instruction inst, |
| 352 const NamedClassDecoder& decoder); | 352 const NamedClassDecoder& decoder); |
| 353 | 353 |
| 354 private: | 354 private: |
| 355 NACL_DISALLOW_COPY_AND_ASSIGN( | 355 NACL_DISALLOW_COPY_AND_ASSIGN( |
| 356 Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndSOrRnIsSp); | 356 Binary3RegisterImmedShiftedOpTesterNotRdIsPcAndSOrRnIsSp); |
| 357 }; | 357 }; |
| 358 | 358 |
| 359 // Implements a decoder tester for decoder Binary4RegisterShiftedOp. | 359 // Implements a decoder tester for decoder Binary4RegisterShiftedOp. |
| 360 // Op(S)<c> <Rd>, <Rn>, <Rm>, <type> <Rs> | 360 // Op(S)<c> <Rd>, <Rn>, <Rm>, <type> <Rs> |
| 361 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 361 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 362 // |31302928|27262524232221|20|19181716|15141312|1110 9 8| 7| 6 5| 4| 3 2 1 0| | 362 // |31302928|27262524232221|20|19181716|15141312|1110 9 8| 7| 6 5| 4| 3 2 1 0| |
| 363 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 363 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 364 // | cond | | S| Rn | Rd | Rs | |type| | Rm | | 364 // | cond | | S| Rn | Rd | Rs | |type| | Rm | |
| 365 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 365 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 366 // Definitions: | 366 // Definitions: |
| 367 // Rd - The destination register. | 367 // Rd - The destination register. |
| 368 // Rn - The first operand register. | 368 // Rn - The first operand register. |
| 369 // Rm - The register that is shifted and used as the second operand. | 369 // Rm - The register that is shifted and used as the second operand. |
| 370 // Rs - The regsiter whose bottom byte contains the amount to shift by. | 370 // Rs - The regsiter whose bottom byte contains the amount to shift by. |
| 371 // type - The type of shift to apply (not modeled). | 371 // type - The type of shift to apply (not modeled). |
| 372 // S - Defines if the flags regsiter is updated. | 372 // S - Defines if the flags regsiter is updated. |
| 373 class Binary4RegisterShiftedOpTester : public Arm32DecoderTester { | 373 class Binary4RegisterShiftedOpTester : public Arm32DecoderTester { |
| 374 public: | 374 public: |
| 375 explicit Binary4RegisterShiftedOpTester( | 375 explicit Binary4RegisterShiftedOpTester( |
| 376 const NamedClassDecoder &decoder); | 376 const NamedClassDecoder &decoder); |
| 377 virtual void ApplySanityChecks( | 377 virtual bool ApplySanityChecks( |
| 378 nacl_arm_dec::Instruction inst, | 378 nacl_arm_dec::Instruction inst, |
| 379 const NamedClassDecoder& decoder); | 379 const NamedClassDecoder& decoder); |
| 380 | 380 |
| 381 private: | 381 private: |
| 382 NACL_DISALLOW_COPY_AND_ASSIGN(Binary4RegisterShiftedOpTester); | 382 NACL_DISALLOW_COPY_AND_ASSIGN(Binary4RegisterShiftedOpTester); |
| 383 }; | 383 }; |
| 384 | 384 |
| 385 // Implements a decoder tester for decoder Binary4RegisterShiftedOp | 385 // Implements a decoder tester for decoder Binary4RegisterShiftedOp |
| 386 // with the constraint that if Rn, Rd, Rs, or Rm is R15, the instruction | 386 // with the constraint that if Rn, Rd, Rs, or Rm is R15, the instruction |
| 387 // is unpredictable. | 387 // is unpredictable. |
| 388 class Binary4RegisterShiftedOpTesterRegsNotPc | 388 class Binary4RegisterShiftedOpTesterRegsNotPc |
| 389 : public Binary4RegisterShiftedOpTester { | 389 : public Binary4RegisterShiftedOpTester { |
| 390 public: | 390 public: |
| 391 explicit Binary4RegisterShiftedOpTesterRegsNotPc( | 391 explicit Binary4RegisterShiftedOpTesterRegsNotPc( |
| 392 const NamedClassDecoder &decoder); | 392 const NamedClassDecoder &decoder); |
| 393 virtual void ApplySanityChecks( | 393 virtual bool ApplySanityChecks( |
| 394 nacl_arm_dec::Instruction inst, | 394 nacl_arm_dec::Instruction inst, |
| 395 const NamedClassDecoder& decoder); | 395 const NamedClassDecoder& decoder); |
| 396 | 396 |
| 397 private: | 397 private: |
| 398 NACL_DISALLOW_COPY_AND_ASSIGN(Binary4RegisterShiftedOpTesterRegsNotPc); | 398 NACL_DISALLOW_COPY_AND_ASSIGN(Binary4RegisterShiftedOpTesterRegsNotPc); |
| 399 }; | 399 }; |
| 400 | 400 |
| 401 // Implements a decoder tester for decoder Binary2RegisterImmedShiftedTest. | 401 // Implements a decoder tester for decoder Binary2RegisterImmedShiftedTest. |
| 402 // Op(S)<c. Rn, Rm {,<shift>} | 402 // Op(S)<c. Rn, Rm {,<shift>} |
| 403 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 403 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 404 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| | 404 // |31302928|27262524232221|20|19181716|15141312|1110 9 8 7| 6 5| 4| 3 2 1 0| |
| 405 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 405 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 406 // | cond | | S| Rn | | imm5 |type| | Rm | | 406 // | cond | | S| Rn | | imm5 |type| | Rm | |
| 407 // +--------+--------------+--+--------+--------+----------+----+--+--------+ | 407 // +--------+--------------+--+--------+--------+----------+----+--+--------+ |
| 408 // Definitions: | 408 // Definitions: |
| 409 // Rn - The first operand register. | 409 // Rn - The first operand register. |
| 410 // Rm - The second operand that is (optionally) shifted. | 410 // Rm - The second operand that is (optionally) shifted. |
| 411 // shift = DecodeImmShift(type, imm5) is the amount to shift. | 411 // shift = DecodeImmShift(type, imm5) is the amount to shift. |
| 412 class Binary2RegisterImmedShiftedTestTester : public Arm32DecoderTester { | 412 class Binary2RegisterImmedShiftedTestTester : public Arm32DecoderTester { |
| 413 public: | 413 public: |
| 414 explicit Binary2RegisterImmedShiftedTestTester( | 414 explicit Binary2RegisterImmedShiftedTestTester( |
| 415 const NamedClassDecoder& decoder); | 415 const NamedClassDecoder& decoder); |
| 416 virtual void ApplySanityChecks( | 416 virtual bool ApplySanityChecks( |
| 417 nacl_arm_dec::Instruction inst, | 417 nacl_arm_dec::Instruction inst, |
| 418 const NamedClassDecoder& decoder); | 418 const NamedClassDecoder& decoder); |
| 419 | 419 |
| 420 private: | 420 private: |
| 421 NACL_DISALLOW_COPY_AND_ASSIGN(Binary2RegisterImmedShiftedTestTester); | 421 NACL_DISALLOW_COPY_AND_ASSIGN(Binary2RegisterImmedShiftedTestTester); |
| 422 }; | 422 }; |
| 423 | 423 |
| 424 // Implements a decoder tester for decoder Binary3RegisterShiftedTest. | 424 // Implements a decoder tester for decoder Binary3RegisterShiftedTest. |
| 425 // OpS<c> <Rn>, <Rm>, <type> <Rs> | 425 // OpS<c> <Rn>, <Rm>, <type> <Rs> |
| 426 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 426 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 427 // |31302928|27262524232221|20|19181716|15141312|1110 9 8| 7| 6 5| 4| 3 2 1 0| | 427 // |31302928|27262524232221|20|19181716|15141312|1110 9 8| 7| 6 5| 4| 3 2 1 0| |
| 428 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 428 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 429 // | cond | | S| Rn | | Rs | |type| | Rm | | 429 // | cond | | S| Rn | | Rs | |type| | Rm | |
| 430 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ | 430 // +--------+--------------+--+--------+--------+--------+--+----+--+--------+ |
| 431 // Definitions: | 431 // Definitions: |
| 432 // Rn - The first operand register. | 432 // Rn - The first operand register. |
| 433 // Rm - The register that is shifted and used as the second operand. | 433 // Rm - The register that is shifted and used as the second operand. |
| 434 // Rs - The regsiter whose bottom byte contains the amount to shift by. | 434 // Rs - The regsiter whose bottom byte contains the amount to shift by. |
| 435 // type - The type of shift to apply (not modeled). | 435 // type - The type of shift to apply (not modeled). |
| 436 // S - Defines if the flags regsiter is updated. | 436 // S - Defines if the flags regsiter is updated. |
| 437 class Binary3RegisterShiftedTestTester : public Arm32DecoderTester { | 437 class Binary3RegisterShiftedTestTester : public Arm32DecoderTester { |
| 438 public: | 438 public: |
| 439 explicit Binary3RegisterShiftedTestTester( | 439 explicit Binary3RegisterShiftedTestTester( |
| 440 const NamedClassDecoder& decoder); | 440 const NamedClassDecoder& decoder); |
| 441 virtual void ApplySanityChecks( | 441 virtual bool ApplySanityChecks( |
| 442 nacl_arm_dec::Instruction inst, | 442 nacl_arm_dec::Instruction inst, |
| 443 const NamedClassDecoder& decoder); | 443 const NamedClassDecoder& decoder); |
| 444 | 444 |
| 445 private: | 445 private: |
| 446 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTestTester); | 446 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTestTester); |
| 447 }; | 447 }; |
| 448 | 448 |
| 449 // Implements a decoder tester for decoder Binary3RegisterShiftedTest, and | 449 // Implements a decoder tester for decoder Binary3RegisterShiftedTest, and |
| 450 // should not parse when Rn, Rm, or Rs is 15. | 450 // should not parse when Rn, Rm, or Rs is 15. |
| 451 class Binary3RegisterShiftedTestTesterRegsNotPc | 451 class Binary3RegisterShiftedTestTesterRegsNotPc |
| 452 : public Binary3RegisterShiftedTestTester { | 452 : public Binary3RegisterShiftedTestTester { |
| 453 public: | 453 public: |
| 454 explicit Binary3RegisterShiftedTestTesterRegsNotPc( | 454 explicit Binary3RegisterShiftedTestTesterRegsNotPc( |
| 455 const NamedClassDecoder& decoder); | 455 const NamedClassDecoder& decoder); |
| 456 virtual void ApplySanityChecks( | 456 virtual bool ApplySanityChecks( |
| 457 nacl_arm_dec::Instruction inst, | 457 nacl_arm_dec::Instruction inst, |
| 458 const NamedClassDecoder& decoder); | 458 const NamedClassDecoder& decoder); |
| 459 | 459 |
| 460 private: | 460 private: |
| 461 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTestTesterRegsNotPc); | 461 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTestTesterRegsNotPc); |
| 462 }; | 462 }; |
| 463 | 463 |
| 464 } // namespace | 464 } // namespace |
| 465 | 465 |
| 466 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ | 466 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_INST_CLASSES_TESTERS_H_ |
| OLD | NEW |