| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 342 // Special Supervisor Call 24-bit codes used in the presence of the ARM |
| 343 // simulator for redirection, breakpoints, stop messages, and spill markers. | 343 // simulator for redirection, breakpoints, and stop messages. |
| 344 // See /usr/include/asm/unistd.h | 344 // See /usr/include/asm/unistd.h |
| 345 const uint32_t kRedirectionSvcCode = 0x90001f; // unused syscall, was sys_stty | 345 const uint32_t kRedirectionSvcCode = 0x90001f; // unused syscall, was sys_stty |
| 346 const uint32_t kBreakpointSvcCode = 0x900020; // unused syscall, was sys_gtty | 346 const uint32_t kBreakpointSvcCode = 0x900020; // unused syscall, was sys_gtty |
| 347 const uint32_t kStopMessageSvcCode = 0x9f0001; // __ARM_NR_breakpoint | 347 const uint32_t kStopMessageSvcCode = 0x9f0001; // __ARM_NR_breakpoint |
| 348 const uint32_t kSpillMarkerSvcBase = 0x9f0100; // unused ARM private syscall | |
| 349 const uint32_t kWordSpillMarkerSvcCode = kSpillMarkerSvcBase + 1; | |
| 350 const uint32_t kDWordSpillMarkerSvcCode = kSpillMarkerSvcBase + 2; | |
| 351 | |
| 352 | 348 |
| 353 // Constants used for the decoding or encoding of the individual fields of | 349 // Constants used for the decoding or encoding of the individual fields of |
| 354 // instructions. Based on the "Figure 3-1 ARM instruction set summary". | 350 // instructions. Based on the "Figure 3-1 ARM instruction set summary". |
| 355 enum InstructionFields { | 351 enum InstructionFields { |
| 356 kConditionShift = 28, | 352 kConditionShift = 28, |
| 357 kConditionBits = 4, | 353 kConditionBits = 4, |
| 358 kTypeShift = 25, | 354 kTypeShift = 25, |
| 359 kTypeBits = 3, | 355 kTypeBits = 3, |
| 360 kLinkShift = 24, | 356 kLinkShift = 24, |
| 361 kLinkBits = 1, | 357 kLinkBits = 1, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 class Instr { | 439 class Instr { |
| 444 public: | 440 public: |
| 445 enum { | 441 enum { |
| 446 kInstrSize = 4, | 442 kInstrSize = 4, |
| 447 kInstrSizeLog2 = 2, | 443 kInstrSizeLog2 = 2, |
| 448 kPCReadOffset = 8 | 444 kPCReadOffset = 8 |
| 449 }; | 445 }; |
| 450 | 446 |
| 451 static const int32_t kNopInstruction = // nop | 447 static const int32_t kNopInstruction = // nop |
| 452 ((AL << kConditionShift) | (0x32 << 20) | (0xf << 12)); | 448 ((AL << kConditionShift) | (0x32 << 20) | (0xf << 12)); |
| 453 static const int32_t kBreakPointInstruction = // svc #kBreakpointSvcCode | 449 |
| 450 // Breakpoint instruction filling assembler code buffers in debug mode. |
| 451 static const int32_t kBreakPointInstruction = // bkpt(0xdeb0) |
| 452 ((AL << kConditionShift) | (0x12 << 20) | (0xdeb << 8) | (0x7 << 4)); |
| 453 |
| 454 // Breakpoint instruction used by the simulator. |
| 455 // Should be distinct from kBreakPointInstruction and from a typical user |
| 456 // breakpoint inserted in generated code for debugging, e.g. bkpt(0). |
| 457 static const int32_t kSimulatorBreakpointInstruction = |
| 458 // svc #kBreakpointSvcCode |
| 454 ((AL << kConditionShift) | (0xf << 24) | kBreakpointSvcCode); | 459 ((AL << kConditionShift) | (0xf << 24) | kBreakpointSvcCode); |
| 455 static const int kBreakPointInstructionSize = kInstrSize; | 460 |
| 456 bool IsBreakPoint() { | 461 // Runtime call redirection instruction used by the simulator. |
| 457 return IsBkpt(); | 462 static const int32_t kSimulatorRedirectInstruction = |
| 458 } | 463 ((AL << kConditionShift) | (0xf << 24) | kRedirectionSvcCode); |
| 459 | 464 |
| 460 // Get the raw instruction bits. | 465 // Get the raw instruction bits. |
| 461 inline int32_t InstructionBits() const { | 466 inline int32_t InstructionBits() const { |
| 462 return *reinterpret_cast<const int32_t*>(this); | 467 return *reinterpret_cast<const int32_t*>(this); |
| 463 } | 468 } |
| 464 | 469 |
| 465 // Set the raw instruction bits to value. | 470 // Set the raw instruction bits to value. |
| 466 inline void SetInstructionBits(int32_t value) { | 471 inline void SetInstructionBits(int32_t value) { |
| 467 *reinterpret_cast<int32_t*>(this) = value; | 472 *reinterpret_cast<int32_t*>(this) = value; |
| 468 } | 473 } |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 706 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 702 | 707 |
| 703 private: | 708 private: |
| 704 DISALLOW_ALLOCATION(); | 709 DISALLOW_ALLOCATION(); |
| 705 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 710 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 706 }; | 711 }; |
| 707 | 712 |
| 708 } // namespace dart | 713 } // namespace dart |
| 709 | 714 |
| 710 #endif // VM_CONSTANTS_ARM_H_ | 715 #endif // VM_CONSTANTS_ARM_H_ |
| OLD | NEW |