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

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

Issue 10356115: Clean up code to clarify we are only tracking the condition flags of APSR. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 7 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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_BASELINE_CLASSES_H_ 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_BASELINE_CLASSES_H_
8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_BASELINE_CLASSES_H_ 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_BASELINE_CLASSES_H_
9 9
10 #include "native_client/src/trusted/validator_arm/inst_classes.h" 10 #include "native_client/src/trusted/validator_arm/inst_classes.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // NaCl disallows writing to PC to cause a jump. 44 // NaCl disallows writing to PC to cause a jump.
45 // 45 //
46 // Implements: 46 // Implements:
47 // MOV (immediate) A2 A8-194 47 // MOV (immediate) A2 A8-194
48 class Unary1RegisterImmediateOp : public ClassDecoder { 48 class Unary1RegisterImmediateOp : public ClassDecoder {
49 public: 49 public:
50 // Interfaces for components in the instruction. 50 // Interfaces for components in the instruction.
51 static const Imm12Bits0To11Interface imm12; 51 static const Imm12Bits0To11Interface imm12;
52 static const RegDBits12To15Interface d; 52 static const RegDBits12To15Interface d;
53 static const Imm4Bits16To19Interface imm4; 53 static const Imm4Bits16To19Interface imm4;
54 static const UpdatesFlagsRegisterBit20Interface flags; 54 static const UpdatesConditionsBit20Interface conditions;
55 static const ConditionBits28To31Interface cond; 55 static const ConditionBits28To31Interface cond;
56 56
57 // Methods for class. 57 // Methods for class.
58 inline Unary1RegisterImmediateOp() : ClassDecoder() {} 58 inline Unary1RegisterImmediateOp() : ClassDecoder() {}
59 virtual ~Unary1RegisterImmediateOp() {} 59 virtual ~Unary1RegisterImmediateOp() {}
60 virtual SafetyLevel safety(Instruction i) const; 60 virtual SafetyLevel safety(Instruction i) const;
61 virtual RegisterList defs(Instruction i) const; 61 virtual RegisterList defs(Instruction i) const;
62 62
63 // The immediate value stored in the instruction. 63 // The immediate value stored in the instruction.
64 inline uint32_t ImmediateValue(const Instruction& i) const { 64 inline uint32_t ImmediateValue(const Instruction& i) const {
(...skipping 16 matching lines...) Expand all
81 // Rn = The first operand register. 81 // Rn = The first operand register.
82 // const = The immediate value to be used as the second argument. 82 // const = The immediate value to be used as the second argument.
83 // 83 //
84 // NaCl disallows writing to PC to cause a jump. 84 // NaCl disallows writing to PC to cause a jump.
85 class Binary2RegisterImmediateOp : public ClassDecoder { 85 class Binary2RegisterImmediateOp : public ClassDecoder {
86 public: 86 public:
87 // Interfaces for components in the instruction. 87 // Interfaces for components in the instruction.
88 static const Imm12Bits0To11Interface imm; 88 static const Imm12Bits0To11Interface imm;
89 static const RegDBits12To15Interface d; 89 static const RegDBits12To15Interface d;
90 static const RegNBits16To19Interface n; 90 static const RegNBits16To19Interface n;
91 static const UpdatesFlagsRegisterBit20Interface flags; 91 static const UpdatesConditionsBit20Interface conditions;
92 static const ConditionBits28To31Interface cond; 92 static const ConditionBits28To31Interface cond;
93 93
94 // Methods for class. 94 // Methods for class.
95 inline Binary2RegisterImmediateOp() : ClassDecoder() {} 95 inline Binary2RegisterImmediateOp() : ClassDecoder() {}
96 virtual ~Binary2RegisterImmediateOp() {} 96 virtual ~Binary2RegisterImmediateOp() {}
97 virtual SafetyLevel safety(Instruction i) const; 97 virtual SafetyLevel safety(Instruction i) const;
98 virtual RegisterList defs(Instruction i) const; 98 virtual RegisterList defs(Instruction i) const;
99 99
100 private: 100 private:
101 NACL_DISALLOW_COPY_AND_ASSIGN(Binary2RegisterImmediateOp); 101 NACL_DISALLOW_COPY_AND_ASSIGN(Binary2RegisterImmediateOp);
(...skipping 29 matching lines...) Expand all
131 // Implements: 131 // Implements:
132 // CMN(immediate) A1 A8-74 132 // CMN(immediate) A1 A8-74
133 // CMP(immediate) A1 A8-80 133 // CMP(immediate) A1 A8-80
134 // TEQ(immediate) A1 A8-448 134 // TEQ(immediate) A1 A8-448
135 // TST(immediate) A1 A8-454 - Note: See class TestImmediate. 135 // TST(immediate) A1 A8-454 - Note: See class TestImmediate.
136 class BinaryRegisterImmediateTest : public ClassDecoder { 136 class BinaryRegisterImmediateTest : public ClassDecoder {
137 public: 137 public:
138 // Interfaces for components in the instruction. 138 // Interfaces for components in the instruction.
139 static const Imm12Bits0To11Interface imm; 139 static const Imm12Bits0To11Interface imm;
140 static const RegNBits16To19Interface n; 140 static const RegNBits16To19Interface n;
141 static const UpdatesFlagsRegisterBit20Interface flags; 141 static const UpdatesConditionsBit20Interface conditions;
142 static const ConditionBits28To31Interface cond; 142 static const ConditionBits28To31Interface cond;
143 143
144 // Methods for class. 144 // Methods for class.
145 inline BinaryRegisterImmediateTest() : ClassDecoder() {} 145 inline BinaryRegisterImmediateTest() : ClassDecoder() {}
146 virtual ~BinaryRegisterImmediateTest() {} 146 virtual ~BinaryRegisterImmediateTest() {}
147 virtual SafetyLevel safety(Instruction i) const; 147 virtual SafetyLevel safety(Instruction i) const;
148 virtual RegisterList defs(Instruction i) const; 148 virtual RegisterList defs(Instruction i) const;
149 149
150 private: 150 private:
151 NACL_DISALLOW_COPY_AND_ASSIGN(BinaryRegisterImmediateTest); 151 NACL_DISALLOW_COPY_AND_ASSIGN(BinaryRegisterImmediateTest);
(...skipping 27 matching lines...) Expand all
179 // NaCl disallows writing to PC to cause a jump. 179 // NaCl disallows writing to PC to cause a jump.
180 // 180 //
181 // Implements: 181 // Implements:
182 // MOV(register) A1 A8-196 - Shouldn't parse when Rd=15 and S=1; 182 // MOV(register) A1 A8-196 - Shouldn't parse when Rd=15 and S=1;
183 // RRX A1 A8-282 183 // RRX A1 A8-282
184 class Unary2RegisterOp : public ClassDecoder { 184 class Unary2RegisterOp : public ClassDecoder {
185 public: 185 public:
186 // Interfaces for components in the instruction. 186 // Interfaces for components in the instruction.
187 static const RegMBits0To3Interface m; 187 static const RegMBits0To3Interface m;
188 static const RegDBits12To15Interface d; 188 static const RegDBits12To15Interface d;
189 static const UpdatesFlagsRegisterBit20Interface flags; 189 static const UpdatesConditionsBit20Interface conditions;
190 static const ConditionBits28To31Interface cond; 190 static const ConditionBits28To31Interface cond;
191 191
192 // Methods for class. 192 // Methods for class.
193 inline Unary2RegisterOp() : ClassDecoder() {} 193 inline Unary2RegisterOp() : ClassDecoder() {}
194 virtual ~Unary2RegisterOp() {} 194 virtual ~Unary2RegisterOp() {}
195 virtual SafetyLevel safety(Instruction i) const; 195 virtual SafetyLevel safety(Instruction i) const;
196 virtual RegisterList defs(Instruction i) const; 196 virtual RegisterList defs(Instruction i) const;
197 197
198 private: 198 private:
199 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterOp); 199 NACL_DISALLOW_COPY_AND_ASSIGN(Unary2RegisterOp);
(...skipping 19 matching lines...) Expand all
219 // ASR(register) A1 A8-42 219 // ASR(register) A1 A8-42
220 // LSL(register) A1 A8-180 220 // LSL(register) A1 A8-180
221 // LSR(register) A1 A8-184 221 // LSR(register) A1 A8-184
222 // ROR(register) A1 A8-280 222 // ROR(register) A1 A8-280
223 class Binary3RegisterOp : public ClassDecoder { 223 class Binary3RegisterOp : public ClassDecoder {
224 public: 224 public:
225 // Interfaces for components in the instruction. 225 // Interfaces for components in the instruction.
226 static const RegNBits0To3Interface n; 226 static const RegNBits0To3Interface n;
227 static const RegMBits8To11Interface m; 227 static const RegMBits8To11Interface m;
228 static const RegDBits12To15Interface d; 228 static const RegDBits12To15Interface d;
229 static const UpdatesFlagsRegisterBit20Interface flags; 229 static const UpdatesConditionsBit20Interface conditions;
230 static const ConditionBits28To31Interface cond; 230 static const ConditionBits28To31Interface cond;
231 231
232 // Methods for class. 232 // Methods for class.
233 inline Binary3RegisterOp() : ClassDecoder() {} 233 inline Binary3RegisterOp() : ClassDecoder() {}
234 virtual ~Binary3RegisterOp() {} 234 virtual ~Binary3RegisterOp() {}
235 virtual SafetyLevel safety(Instruction i) const; 235 virtual SafetyLevel safety(Instruction i) const;
236 virtual RegisterList defs(Instruction i) const; 236 virtual RegisterList defs(Instruction i) const;
237 237
238 private: 238 private:
239 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterOp); 239 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterOp);
(...skipping 19 matching lines...) Expand all
259 // LSR(immediate) A1 A8-182 259 // LSR(immediate) A1 A8-182
260 // MVN(register) A8-216 -- Shouldn't parse when Rd=15 and S=1. 260 // MVN(register) A8-216 -- Shouldn't parse when Rd=15 and S=1.
261 // ROR(immediate) A1 A8-278 -- Shouldn't parse when imm5=0. 261 // ROR(immediate) A1 A8-278 -- Shouldn't parse when imm5=0.
262 class Unary2RegisterImmedShiftedOp : public ClassDecoder { 262 class Unary2RegisterImmedShiftedOp : public ClassDecoder {
263 public: 263 public:
264 // Interfaces for components in the instruction. 264 // Interfaces for components in the instruction.
265 static const RegMBits0To3Interface m; 265 static const RegMBits0To3Interface m;
266 static const ShiftTypeBits5To6Interface shift_type; 266 static const ShiftTypeBits5To6Interface shift_type;
267 static const Imm5Bits7To11Interface imm; 267 static const Imm5Bits7To11Interface imm;
268 static const RegDBits12To15Interface d; 268 static const RegDBits12To15Interface d;
269 static const UpdatesFlagsRegisterBit20Interface flags; 269 static const UpdatesConditionsBit20Interface conditions;
270 static const ConditionBits28To31Interface cond; 270 static const ConditionBits28To31Interface cond;
271 271
272 // Methods for class. 272 // Methods for class.
273 inline Unary2RegisterImmedShiftedOp() : ClassDecoder() {} 273 inline Unary2RegisterImmedShiftedOp() : ClassDecoder() {}
274 virtual ~Unary2RegisterImmedShiftedOp() {} 274 virtual ~Unary2RegisterImmedShiftedOp() {}
275 virtual SafetyLevel safety(Instruction i) const; 275 virtual SafetyLevel safety(Instruction i) const;
276 virtual RegisterList defs(Instruction i) const; 276 virtual RegisterList defs(Instruction i) const;
277 277
278 // The immediate value stored in the instruction. 278 // The immediate value stored in the instruction.
279 inline uint32_t ImmediateValue(const Instruction& i) const { 279 inline uint32_t ImmediateValue(const Instruction& i) const {
(...skipping 23 matching lines...) Expand all
303 // 303 //
304 // Implements: 304 // Implements:
305 // MVN(register-shifted) A1 A8-218 305 // MVN(register-shifted) A1 A8-218
306 class Unary3RegisterShiftedOp : public ClassDecoder { 306 class Unary3RegisterShiftedOp : public ClassDecoder {
307 public: 307 public:
308 // Interfaces for components in the instruction. 308 // Interfaces for components in the instruction.
309 static const RegMBits0To3Interface m; 309 static const RegMBits0To3Interface m;
310 static const ShiftTypeBits5To6Interface shift_type; 310 static const ShiftTypeBits5To6Interface shift_type;
311 static const RegSBits8To11Interface s; 311 static const RegSBits8To11Interface s;
312 static const RegDBits12To15Interface d; 312 static const RegDBits12To15Interface d;
313 static const UpdatesFlagsRegisterBit20Interface flags; 313 static const UpdatesConditionsBit20Interface conditions;
314 static const ConditionBits28To31Interface cond; 314 static const ConditionBits28To31Interface cond;
315 315
316 // Methods for class. 316 // Methods for class.
317 inline Unary3RegisterShiftedOp() : ClassDecoder() {} 317 inline Unary3RegisterShiftedOp() : ClassDecoder() {}
318 virtual ~Unary3RegisterShiftedOp() {} 318 virtual ~Unary3RegisterShiftedOp() {}
319 virtual SafetyLevel safety(Instruction i) const; 319 virtual SafetyLevel safety(Instruction i) const;
320 virtual RegisterList defs(Instruction i) const; 320 virtual RegisterList defs(Instruction i) const;
321 321
322 private: 322 private:
323 NACL_DISALLOW_COPY_AND_ASSIGN(Unary3RegisterShiftedOp); 323 NACL_DISALLOW_COPY_AND_ASSIGN(Unary3RegisterShiftedOp);
(...skipping 26 matching lines...) Expand all
350 // SBC(register) A1 A8-304 -- Shouldn't parse when Rd=15 and S=1. 350 // SBC(register) A1 A8-304 -- Shouldn't parse when Rd=15 and S=1.
351 // SUB(register) A1 A8-422 -- Shouldn't parse when Rd=15 and S=1, or Rn=13. 351 // SUB(register) A1 A8-422 -- Shouldn't parse when Rd=15 and S=1, or Rn=13.
352 class Binary3RegisterImmedShiftedOp : public ClassDecoder { 352 class Binary3RegisterImmedShiftedOp : public ClassDecoder {
353 public: 353 public:
354 // Interfaces for components in the instruction. 354 // Interfaces for components in the instruction.
355 static const RegMBits0To3Interface m; 355 static const RegMBits0To3Interface m;
356 static const ShiftTypeBits5To6Interface shift_type; 356 static const ShiftTypeBits5To6Interface shift_type;
357 static const Imm5Bits7To11Interface imm; 357 static const Imm5Bits7To11Interface imm;
358 static const RegDBits12To15Interface d; 358 static const RegDBits12To15Interface d;
359 static const RegNBits16To19Interface n; 359 static const RegNBits16To19Interface n;
360 static const UpdatesFlagsRegisterBit20Interface flags; 360 static const UpdatesConditionsBit20Interface conditions;
361 static const ConditionBits28To31Interface cond; 361 static const ConditionBits28To31Interface cond;
362 362
363 // Methods for class. 363 // Methods for class.
364 inline Binary3RegisterImmedShiftedOp() : ClassDecoder() {} 364 inline Binary3RegisterImmedShiftedOp() : ClassDecoder() {}
365 virtual ~Binary3RegisterImmedShiftedOp() {} 365 virtual ~Binary3RegisterImmedShiftedOp() {}
366 virtual SafetyLevel safety(Instruction i) const; 366 virtual SafetyLevel safety(Instruction i) const;
367 virtual RegisterList defs(Instruction i) const; 367 virtual RegisterList defs(Instruction i) const;
368 // The shift value to use. 368 // The shift value to use.
369 inline uint32_t ShiftValue(const Instruction& i) const { 369 inline uint32_t ShiftValue(const Instruction& i) const {
370 return shift_type.DecodeImmShift(i, imm.value(i)); 370 return shift_type.DecodeImmShift(i, imm.value(i));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // RSC(register-shifted) A1 A8-294 402 // RSC(register-shifted) A1 A8-294
403 // SBC(register-shifted) A1 A8-306 403 // SBC(register-shifted) A1 A8-306
404 // SUB(register-shifted) A1 A8-424 404 // SUB(register-shifted) A1 A8-424
405 class Binary4RegisterShiftedOp : public ClassDecoder { 405 class Binary4RegisterShiftedOp : public ClassDecoder {
406 public: 406 public:
407 // Interfaces for components in the instruction. 407 // Interfaces for components in the instruction.
408 static const RegMBits0To3Interface m; 408 static const RegMBits0To3Interface m;
409 static const RegSBits8To11Interface s; 409 static const RegSBits8To11Interface s;
410 static const RegDBits12To15Interface d; 410 static const RegDBits12To15Interface d;
411 static const RegNBits16To19Interface n; 411 static const RegNBits16To19Interface n;
412 static const UpdatesFlagsRegisterBit20Interface flags; 412 static const UpdatesConditionsBit20Interface conditions;
413 static const ConditionBits28To31Interface cond; 413 static const ConditionBits28To31Interface cond;
414 414
415 // Methods for class. 415 // Methods for class.
416 inline Binary4RegisterShiftedOp() : ClassDecoder() {} 416 inline Binary4RegisterShiftedOp() : ClassDecoder() {}
417 virtual ~Binary4RegisterShiftedOp() {} 417 virtual ~Binary4RegisterShiftedOp() {}
418 virtual SafetyLevel safety(Instruction i) const; 418 virtual SafetyLevel safety(Instruction i) const;
419 virtual RegisterList defs(Instruction i) const; 419 virtual RegisterList defs(Instruction i) const;
420 420
421 private: 421 private:
422 NACL_DISALLOW_COPY_AND_ASSIGN(Binary4RegisterShiftedOp); 422 NACL_DISALLOW_COPY_AND_ASSIGN(Binary4RegisterShiftedOp);
(...skipping 16 matching lines...) Expand all
439 // CMP(register) A1 A8-82 439 // CMP(register) A1 A8-82
440 // TEQ(register) A1 A8-450 440 // TEQ(register) A1 A8-450
441 // TST(register) A1 A8-456 441 // TST(register) A1 A8-456
442 class Binary2RegisterImmedShiftedTest : public ClassDecoder { 442 class Binary2RegisterImmedShiftedTest : public ClassDecoder {
443 public: 443 public:
444 // Interfaces for components in the instruction. 444 // Interfaces for components in the instruction.
445 static const RegMBits0To3Interface m; 445 static const RegMBits0To3Interface m;
446 static const ShiftTypeBits5To6Interface shift_type; 446 static const ShiftTypeBits5To6Interface shift_type;
447 static const Imm5Bits7To11Interface imm; 447 static const Imm5Bits7To11Interface imm;
448 static const RegNBits16To19Interface n; 448 static const RegNBits16To19Interface n;
449 static const UpdatesFlagsRegisterBit20Interface flags; 449 static const UpdatesConditionsBit20Interface conditions;
450 static const ConditionBits28To31Interface cond; 450 static const ConditionBits28To31Interface cond;
451 451
452 // Methods for class. 452 // Methods for class.
453 inline Binary2RegisterImmedShiftedTest() : ClassDecoder() {} 453 inline Binary2RegisterImmedShiftedTest() : ClassDecoder() {}
454 virtual ~Binary2RegisterImmedShiftedTest() {} 454 virtual ~Binary2RegisterImmedShiftedTest() {}
455 virtual SafetyLevel safety(Instruction i) const; 455 virtual SafetyLevel safety(Instruction i) const;
456 virtual RegisterList defs(Instruction i) const; 456 virtual RegisterList defs(Instruction i) const;
457 // The shift value to use. 457 // The shift value to use.
458 inline uint32_t ShiftValue(const Instruction& i) const { 458 inline uint32_t ShiftValue(const Instruction& i) const {
459 return shift_type.DecodeImmShift(i, imm.value(i)); 459 return shift_type.DecodeImmShift(i, imm.value(i));
(...skipping 24 matching lines...) Expand all
484 // CMP(register-shifted) A1 A8-84 484 // CMP(register-shifted) A1 A8-84
485 // TEQ(register-shifted) A1 A8-452 485 // TEQ(register-shifted) A1 A8-452
486 // TST(register-shifted) A1 A8-458 486 // TST(register-shifted) A1 A8-458
487 class Binary3RegisterShiftedTest : public ClassDecoder { 487 class Binary3RegisterShiftedTest : public ClassDecoder {
488 public: 488 public:
489 // Interfaces for components in the instruction. 489 // Interfaces for components in the instruction.
490 static const RegMBits0To3Interface m; 490 static const RegMBits0To3Interface m;
491 static const ShiftTypeBits5To6Interface shift_type; 491 static const ShiftTypeBits5To6Interface shift_type;
492 static const RegSBits8To11Interface s; 492 static const RegSBits8To11Interface s;
493 static const RegNBits16To19Interface n; 493 static const RegNBits16To19Interface n;
494 static const UpdatesFlagsRegisterBit20Interface flags; 494 static const UpdatesConditionsBit20Interface conditions;
495 static const ConditionBits28To31Interface cond; 495 static const ConditionBits28To31Interface cond;
496 496
497 // Methods for class. 497 // Methods for class.
498 inline Binary3RegisterShiftedTest() : ClassDecoder() {} 498 inline Binary3RegisterShiftedTest() : ClassDecoder() {}
499 virtual ~Binary3RegisterShiftedTest() {} 499 virtual ~Binary3RegisterShiftedTest() {}
500 virtual SafetyLevel safety(Instruction i) const; 500 virtual SafetyLevel safety(Instruction i) const;
501 virtual RegisterList defs(Instruction i) const; 501 virtual RegisterList defs(Instruction i) const;
502 502
503 private: 503 private:
504 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTest); 504 NACL_DISALLOW_COPY_AND_ASSIGN(Binary3RegisterShiftedTest);
505 }; 505 };
506 506
507 } // namespace 507 } // namespace
508 508
509 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_BASELINE_CLASSES_H_ 509 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_BASELINE_CLASSES_H_
OLDNEW
« no previous file with comments | « src/trusted/validator_arm/actual_classes_statics.cc ('k') | src/trusted/validator_arm/baseline_classes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698