| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_CONSTANTS_ARM_H_ | 5 #ifndef VM_CONSTANTS_ARM_H_ |
| 6 #define VM_CONSTANTS_ARM_H_ | 6 #define VM_CONSTANTS_ARM_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 | 10 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 enum Shift { | 332 enum Shift { |
| 333 kNoShift = -1, | 333 kNoShift = -1, |
| 334 LSL = 0, // Logical shift left | 334 LSL = 0, // Logical shift left |
| 335 LSR = 1, // Logical shift right | 335 LSR = 1, // Logical shift right |
| 336 ASR = 2, // Arithmetic shift right | 336 ASR = 2, // Arithmetic shift right |
| 337 ROR = 3, // Rotate right | 337 ROR = 3, // Rotate right |
| 338 kMaxShift = 4 | 338 kMaxShift = 4 |
| 339 }; | 339 }; |
| 340 | 340 |
| 341 | 341 |
| 342 // Special Supervisor Call 24-bit codes used in the presence of the ARM | |
| 343 // simulator for redirection, breakpoints, and stop messages. | |
| 344 // See /usr/include/asm/unistd.h | |
| 345 const uint32_t kRedirectionSvcCode = 0x90001f; // unused syscall, was sys_stty | |
| 346 const uint32_t kBreakpointSvcCode = 0x900020; // unused syscall, was sys_gtty | |
| 347 const uint32_t kStopMessageSvcCode = 0x9f0001; // __ARM_NR_breakpoint | |
| 348 | |
| 349 // Constants used for the decoding or encoding of the individual fields of | 342 // Constants used for the decoding or encoding of the individual fields of |
| 350 // instructions. Based on the "Figure 3-1 ARM instruction set summary". | 343 // instructions. Based on the "Figure 3-1 ARM instruction set summary". |
| 351 enum InstructionFields { | 344 enum InstructionFields { |
| 352 kConditionShift = 28, | 345 kConditionShift = 28, |
| 353 kConditionBits = 4, | 346 kConditionBits = 4, |
| 354 kTypeShift = 25, | 347 kTypeShift = 25, |
| 355 kTypeBits = 3, | 348 kTypeBits = 3, |
| 356 kLinkShift = 24, | 349 kLinkShift = 24, |
| 357 kLinkBits = 1, | 350 kLinkBits = 1, |
| 358 kUShift = 23, | 351 kUShift = 23, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 public: | 433 public: |
| 441 enum { | 434 enum { |
| 442 kInstrSize = 4, | 435 kInstrSize = 4, |
| 443 kInstrSizeLog2 = 2, | 436 kInstrSizeLog2 = 2, |
| 444 kPCReadOffset = 8 | 437 kPCReadOffset = 8 |
| 445 }; | 438 }; |
| 446 | 439 |
| 447 static const int32_t kNopInstruction = // nop | 440 static const int32_t kNopInstruction = // nop |
| 448 ((AL << kConditionShift) | (0x32 << 20) | (0xf << 12)); | 441 ((AL << kConditionShift) | (0x32 << 20) | (0xf << 12)); |
| 449 | 442 |
| 443 static const int32_t kBreakPointCode = 0xdeb0; // For breakpoint. |
| 444 static const int32_t kStopMessageCode = 0xdeb1; // For Stop(message). |
| 445 static const int32_t kSimulatorBreakCode = 0xdeb2; // For breakpoint in sim. |
| 446 static const int32_t kSimulatorRedirectCode = 0xca11; // For redirection. |
| 447 |
| 450 // Breakpoint instruction filling assembler code buffers in debug mode. | 448 // Breakpoint instruction filling assembler code buffers in debug mode. |
| 451 static const int32_t kBreakPointInstruction = // bkpt(0xdeb0) | 449 static const int32_t kBreakPointInstruction = // bkpt(0xdeb0) |
| 452 ((AL << kConditionShift) | (0x12 << 20) | (0xdeb << 8) | (0x7 << 4)); | 450 ((AL << kConditionShift) | (0x12 << 20) | (0xdeb << 8) | (0x7 << 4)); |
| 453 | 451 |
| 454 // Breakpoint instruction used by the simulator. | 452 // Breakpoint instruction used by the simulator. |
| 455 // Should be distinct from kBreakPointInstruction and from a typical user | 453 // Should be distinct from kBreakPointInstruction and from a typical user |
| 456 // breakpoint inserted in generated code for debugging, e.g. bkpt(0). | 454 // breakpoint inserted in generated code for debugging, e.g. bkpt(0). |
| 457 static const int32_t kSimulatorBreakpointInstruction = | 455 static const int32_t kSimulatorBreakpointInstruction = |
| 458 // svc #kBreakpointSvcCode | 456 // svc #kBreakpointSvcCode |
| 459 ((AL << kConditionShift) | (0xf << 24) | kBreakpointSvcCode); | 457 ((AL << kConditionShift) | (0xf << 24) | kSimulatorBreakCode); |
| 460 | 458 |
| 461 // Runtime call redirection instruction used by the simulator. | 459 // Runtime call redirection instruction used by the simulator. |
| 462 static const int32_t kSimulatorRedirectInstruction = | 460 static const int32_t kSimulatorRedirectInstruction = |
| 463 ((AL << kConditionShift) | (0xf << 24) | kRedirectionSvcCode); | 461 ((AL << kConditionShift) | (0xf << 24) | kSimulatorRedirectCode); |
| 464 | 462 |
| 465 // Get the raw instruction bits. | 463 // Get the raw instruction bits. |
| 466 inline int32_t InstructionBits() const { | 464 inline int32_t InstructionBits() const { |
| 467 return *reinterpret_cast<const int32_t*>(this); | 465 return *reinterpret_cast<const int32_t*>(this); |
| 468 } | 466 } |
| 469 | 467 |
| 470 // Set the raw instruction bits to value. | 468 // Set the raw instruction bits to value. |
| 471 inline void SetInstructionBits(int32_t value) { | 469 inline void SetInstructionBits(int32_t value) { |
| 472 *reinterpret_cast<int32_t*>(this) = value; | 470 *reinterpret_cast<int32_t*>(this) = value; |
| 473 } | 471 } |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 704 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 707 | 705 |
| 708 private: | 706 private: |
| 709 DISALLOW_ALLOCATION(); | 707 DISALLOW_ALLOCATION(); |
| 710 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 708 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 711 }; | 709 }; |
| 712 | 710 |
| 713 } // namespace dart | 711 } // namespace dart |
| 714 | 712 |
| 715 #endif // VM_CONSTANTS_ARM_H_ | 713 #endif // VM_CONSTANTS_ARM_H_ |
| OLD | NEW |