| 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 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_MODEL_H | 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_MODEL_H |
| 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_MODEL_H | 8 #define NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_MODEL_H |
| 9 | 9 |
| 10 /* | 10 /* |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 RegisterList& operator=(const RegisterList& r); // Disallow assignment. | 249 RegisterList& operator=(const RegisterList& r); // Disallow assignment. |
| 250 }; | 250 }; |
| 251 | 251 |
| 252 | 252 |
| 253 // The number of bits in an ARM instruction. | 253 // The number of bits in an ARM instruction. |
| 254 static const int kArm32InstSize = 32; | 254 static const int kArm32InstSize = 32; |
| 255 | 255 |
| 256 // The number of bits in a word of a THUMB instruction. | 256 // The number of bits in a word of a THUMB instruction. |
| 257 static const int kThumbWordSize = 16; | 257 static const int kThumbWordSize = 16; |
| 258 | 258 |
| 259 // BKPT #0x7777 is used as literal pool head. | 259 // Specially chosen BKPT and UDF instructions that also correspond to |
| 260 static const uint32_t kLiteralPoolHeadInstruction = 0xE1277777; | 260 // BKPT and UDF when decoded as Thumb instructions. |
| 261 // - BKPT #0x5BE0 is used as literal pool head. |
| 262 // - BKPT #0x5BEF is used as our generic breakpoint. |
| 263 // - UDF #0xEDEF is used as halt-fill. |
| 264 // - UDF #0xEDE0 is used as abort-now (such as __builtin_trap). |
| 265 // - UDF #0xEDE1 is used to always fail validation. |
| 266 // All other values are disallowed by the validator out of paranoia. |
| 267 static const uint32_t kLiteralPoolHeadInstruction = 0xE125BE70; |
| 268 static const uint32_t kBreakpoint = 0xE125BE7F; |
| 269 static const uint32_t kHaltFill = 0xE7FEDEFF; |
| 270 static const uint32_t kAbortNow = 0xE7FEDEF0; |
| 271 static const uint32_t kFailValidation = 0xE7FEDEF1; |
| 261 | 272 |
| 262 // Models an instruction, either a 32-bit ARM instruction of unspecified type, | 273 // Models an instruction, either a 32-bit ARM instruction of unspecified type, |
| 263 // or one word (16-bit) and two word (32-bit) THUMB instructions. | 274 // or one word (16-bit) and two word (32-bit) THUMB instructions. |
| 264 // | 275 // |
| 265 // This class is designed for efficiency: | 276 // This class is designed for efficiency: |
| 266 // - Its public methods for bitfield extraction are short and inline. | 277 // - Its public methods for bitfield extraction are short and inline. |
| 267 // - It has no vtable, so on 32-bit platforms it's exactly the size of the | 278 // - It has no vtable, so on 32-bit platforms it's exactly the size of the |
| 268 // instruction it models. | 279 // instruction it models. |
| 269 // - API's exist for accessing both ARM (32-bit) instructions and | 280 // - API's exist for accessing both ARM (32-bit) instructions and |
| 270 // THUMB instructions (which are 1 or two (16-bit) words). | 281 // THUMB instructions (which are 1 or two (16-bit) words). |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 501 } |
| 491 | 502 |
| 492 private: | 503 private: |
| 493 uint32_t bits_; | 504 uint32_t bits_; |
| 494 Instruction& operator=(const Instruction& insn); // Disallow assignment. | 505 Instruction& operator=(const Instruction& insn); // Disallow assignment. |
| 495 }; | 506 }; |
| 496 | 507 |
| 497 } // namespace nacl_arm_dec | 508 } // namespace nacl_arm_dec |
| 498 | 509 |
| 499 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_MODEL_H | 510 #endif // NATIVE_CLIENT_SRC_TRUSTED_VALIDATOR_ARM_V2_MODEL_H |
| OLD | NEW |