| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64_H_ | 5 #ifndef VM_CONSTANTS_ARM64_H_ |
| 6 #define VM_CONSTANTS_ARM64_H_ | 6 #define VM_CONSTANTS_ARM64_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 kExtendTypeBits = 3, | 746 kExtendTypeBits = 3, |
| 747 | 747 |
| 748 // Hint Fields. | 748 // Hint Fields. |
| 749 kHintCRmShift = 8, | 749 kHintCRmShift = 8, |
| 750 kHintCRmBits = 4, | 750 kHintCRmBits = 4, |
| 751 kHintOp2Shift = 5, | 751 kHintOp2Shift = 5, |
| 752 kHintOp2Bits = 3, | 752 kHintOp2Bits = 3, |
| 753 }; | 753 }; |
| 754 | 754 |
| 755 | 755 |
| 756 const uint32_t kImmExceptionIsRedirectedCall = 0xca11; | |
| 757 const uint32_t kImmExceptionIsUnreachable = 0xdebf; | |
| 758 const uint32_t kImmExceptionIsDebug = 0xdeb0; | |
| 759 const uint32_t kImmExceptionIsPrintf = 0xdeb1; | |
| 760 | |
| 761 // Helper functions for decoding logical immediates. | 756 // Helper functions for decoding logical immediates. |
| 762 static inline uint64_t RotateRight( | 757 static inline uint64_t RotateRight( |
| 763 uint64_t value, uint8_t rotate, uint8_t width) { | 758 uint64_t value, uint8_t rotate, uint8_t width) { |
| 764 ASSERT(width <= 64); | 759 ASSERT(width <= 64); |
| 765 rotate &= 63; | 760 rotate &= 63; |
| 766 return ((value & ((1UL << rotate) - 1UL)) << (width - rotate)) | | 761 return ((value & ((1UL << rotate) - 1UL)) << (width - rotate)) | |
| 767 (value >> rotate); | 762 (value >> rotate); |
| 768 } | 763 } |
| 769 | 764 |
| 770 static inline uint64_t RepeatBitsAcrossReg( | 765 static inline uint64_t RepeatBitsAcrossReg( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 792 // | 787 // |
| 793 class Instr { | 788 class Instr { |
| 794 public: | 789 public: |
| 795 enum { | 790 enum { |
| 796 kInstrSize = 4, | 791 kInstrSize = 4, |
| 797 kInstrSizeLog2 = 2, | 792 kInstrSizeLog2 = 2, |
| 798 kPCReadOffset = 8 | 793 kPCReadOffset = 8 |
| 799 }; | 794 }; |
| 800 | 795 |
| 801 static const int32_t kNopInstruction = HINT; // hint #0 === nop. | 796 static const int32_t kNopInstruction = HINT; // hint #0 === nop. |
| 802 static const int32_t kBreakPointInstruction = // hlt #kImmExceptionIsDebug. | 797 |
| 803 HLT | (kImmExceptionIsDebug << kImm16Shift); | 798 // Reserved brk and hlt instruction codes. |
| 804 static const int kBreakPointInstructionSize = kInstrSize; | 799 static const int32_t kBreakPointCode = 0xdeb0; // For breakpoint. |
| 800 static const int32_t kStopMessageCode = 0xdeb1; // For Stop(message). |
| 801 static const int32_t kSimulatorMessageCode = 0xdeb2; // For trace msg in sim. |
| 802 static const int32_t kSimulatorBreakCode = 0xdeb3; // For breakpoint in sim. |
| 803 static const int32_t kSimulatorRedirectCode = 0xca11; // For redirection. |
| 804 |
| 805 // Breakpoint instruction filling assembler code buffers in debug mode. |
| 806 static const int32_t kBreakPointInstruction = // brk(0xdeb0). |
| 807 BRK | (kBreakPointCode << kImm16Shift); |
| 808 |
| 809 // Breakpoint instruction used by the simulator. |
| 810 // Should be distinct from kBreakPointInstruction and from a typical user |
| 811 // breakpoint inserted in generated code for debugging, e.g. brk(0). |
| 812 static const int32_t kSimulatorBreakpointInstruction = |
| 813 HLT | (kSimulatorBreakCode << kImm16Shift); |
| 814 |
| 815 // Runtime call redirection instruction used by the simulator. |
| 805 static const int32_t kRedirectInstruction = | 816 static const int32_t kRedirectInstruction = |
| 806 HLT | (kImmExceptionIsRedirectedCall << kImm16Shift); | 817 HLT | (kSimulatorRedirectCode << kImm16Shift); |
| 807 | 818 |
| 808 // Read one particular bit out of the instruction bits. | 819 // Read one particular bit out of the instruction bits. |
| 809 inline int Bit(int nr) const { | 820 inline int Bit(int nr) const { |
| 810 return (InstructionBits() >> nr) & 1; | 821 return (InstructionBits() >> nr) & 1; |
| 811 } | 822 } |
| 812 | 823 |
| 813 // Read a bit field out of the instruction bits. | 824 // Read a bit field out of the instruction bits. |
| 814 inline int Bits(int shift, int count) const { | 825 inline int Bits(int shift, int count) const { |
| 815 return (InstructionBits() >> shift) & ((1 << count) - 1); | 826 return (InstructionBits() >> shift) & ((1 << count) - 1); |
| 816 } | 827 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } | 1058 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } |
| 1048 | 1059 |
| 1049 private: | 1060 private: |
| 1050 DISALLOW_ALLOCATION(); | 1061 DISALLOW_ALLOCATION(); |
| 1051 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 1062 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
| 1052 }; | 1063 }; |
| 1053 | 1064 |
| 1054 } // namespace dart | 1065 } // namespace dart |
| 1055 | 1066 |
| 1056 #endif // VM_CONSTANTS_ARM64_H_ | 1067 #endif // VM_CONSTANTS_ARM64_H_ |
| OLD | NEW |