| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Number coprocessor registers. | 86 // Number coprocessor registers. |
| 87 static const int kNumFPURegisters = 32; | 87 static const int kNumFPURegisters = 32; |
| 88 static const int kInvalidFPURegister = -1; | 88 static const int kInvalidFPURegister = -1; |
| 89 | 89 |
| 90 // FPU (coprocessor 1) control registers. Currently only FCSR is implemented. | 90 // FPU (coprocessor 1) control registers. Currently only FCSR is implemented. |
| 91 static const int kFCSRRegister = 31; | 91 static const int kFCSRRegister = 31; |
| 92 static const int kInvalidFPUControlRegister = -1; | 92 static const int kInvalidFPUControlRegister = -1; |
| 93 static const uint32_t kFPUInvalidResult = (uint32_t) (1 << 31) - 1; | 93 static const uint32_t kFPUInvalidResult = (uint32_t) (1 << 31) - 1; |
| 94 | 94 |
| 95 // FCSR constants. | 95 // FCSR constants. |
| 96 static const uint32_t kFCSRFlagMask = (1 << 6) - 1; | 96 static const uint32_t kFCSRInexactFlagBit = 2; |
| 97 static const uint32_t kFCSRFlagShift = 2; | 97 static const uint32_t kFCSRUnderflowFlagBit = 3; |
| 98 static const uint32_t kFCSRInexactFlagBit = 1 << 0; | 98 static const uint32_t kFCSROverflowFlagBit = 4; |
| 99 static const uint32_t kFCSRUnderflowFlagBit = 1 << 1; | 99 static const uint32_t kFCSRDivideByZeroFlagBit = 5; |
| 100 static const uint32_t kFCSROverflowFlagBit = 1 << 2; | 100 static const uint32_t kFCSRInvalidOpFlagBit = 6; |
| 101 static const uint32_t kFCSRDivideByZeroFlagBit = 1 << 3; | 101 |
| 102 static const uint32_t kFCSRInvalidOpFlagBit = 1 << 4; | 102 static const uint32_t kFCSRInexactFlagMask = 1 << kFCSRInexactFlagBit; |
| 103 static const uint32_t kFCSRUnderflowFlagMask = 1 << kFCSRUnderflowFlagBit; |
| 104 static const uint32_t kFCSROverflowFlagMask = 1 << kFCSROverflowFlagBit; |
| 105 static const uint32_t kFCSRDivideByZeroFlagMask = 1 << kFCSRDivideByZeroFlagBit; |
| 106 static const uint32_t kFCSRInvalidOpFlagMask = 1 << kFCSRInvalidOpFlagBit; |
| 107 |
| 108 static const uint32_t kFCSRFlagMask = |
| 109 kFCSRInexactFlagMask | |
| 110 kFCSRUnderflowFlagMask | |
| 111 kFCSROverflowFlagMask | |
| 112 kFCSRDivideByZeroFlagMask | |
| 113 kFCSRInvalidOpFlagMask; |
| 114 |
| 115 static const uint32_t kFCSRExceptionFlagMask = |
| 116 kFCSRFlagMask ^ kFCSRInexactFlagMask; |
| 103 | 117 |
| 104 // Helper functions for converting between register numbers and names. | 118 // Helper functions for converting between register numbers and names. |
| 105 class Registers { | 119 class Registers { |
| 106 public: | 120 public: |
| 107 // Return the name of the register. | 121 // Return the name of the register. |
| 108 static const char* Name(int reg); | 122 static const char* Name(int reg); |
| 109 | 123 |
| 110 // Lookup the register number for the name provided. | 124 // Lookup the register number for the name provided. |
| 111 static int Number(const char* name); | 125 static int Number(const char* name); |
| 112 | 126 |
| 113 struct RegisterAlias { | 127 struct RegisterAlias { |
| 114 int reg; | 128 int reg; |
| 115 const char *name; | 129 const char *name; |
| 116 }; | 130 }; |
| 117 | 131 |
| 118 static const int32_t kMaxValue = 0x7fffffff; | 132 static const int32_t kMaxValue = 0x7fffffff; |
| 119 static const int32_t kMinValue = 0x80000000; | 133 static const int32_t kMinValue = 0x80000000; |
| 120 | 134 |
| 121 private: | 135 private: |
| 122 | |
| 123 static const char* names_[kNumSimuRegisters]; | 136 static const char* names_[kNumSimuRegisters]; |
| 124 static const RegisterAlias aliases_[]; | 137 static const RegisterAlias aliases_[]; |
| 125 }; | 138 }; |
| 126 | 139 |
| 127 // Helper functions for converting between register numbers and names. | 140 // Helper functions for converting between register numbers and names. |
| 128 class FPURegisters { | 141 class FPURegisters { |
| 129 public: | 142 public: |
| 130 // Return the name of the register. | 143 // Return the name of the register. |
| 131 static const char* Name(int reg); | 144 static const char* Name(int reg); |
| 132 | 145 |
| 133 // Lookup the register number for the name provided. | 146 // Lookup the register number for the name provided. |
| 134 static int Number(const char* name); | 147 static int Number(const char* name); |
| 135 | 148 |
| 136 struct RegisterAlias { | 149 struct RegisterAlias { |
| 137 int creg; | 150 int creg; |
| 138 const char *name; | 151 const char *name; |
| 139 }; | 152 }; |
| 140 | 153 |
| 141 private: | 154 private: |
| 142 | |
| 143 static const char* names_[kNumFPURegisters]; | 155 static const char* names_[kNumFPURegisters]; |
| 144 static const RegisterAlias aliases_[]; | 156 static const RegisterAlias aliases_[]; |
| 145 }; | 157 }; |
| 146 | 158 |
| 147 | 159 |
| 148 // ----------------------------------------------------------------------------- | 160 // ----------------------------------------------------------------------------- |
| 149 // Instructions encoding constants. | 161 // Instructions encoding constants. |
| 150 | 162 |
| 151 // On MIPS all instructions are 32 bits. | 163 // On MIPS all instructions are 32 bits. |
| 152 typedef int32_t Instr; | 164 typedef int32_t Instr; |
| 153 | 165 |
| 154 // Special Software Interrupt codes when used in the presence of the MIPS | 166 // Special Software Interrupt codes when used in the presence of the MIPS |
| 155 // simulator. | 167 // simulator. |
| 156 enum SoftwareInterruptCodes { | 168 enum SoftwareInterruptCodes { |
| 157 // Transition to C code. | 169 // Transition to C code. |
| 158 call_rt_redirected = 0xfffff | 170 call_rt_redirected = 0xfffff |
| 159 }; | 171 }; |
| 160 | 172 |
| 173 // On MIPS Simulator breakpoints can have different codes: |
| 174 // - Breaks between 0 and kMaxWatchpointCode are treated as simple watchpoints, |
| 175 // the simulator will run through them and print the registers. |
| 176 // - Breaks between kMaxWatchpointCode and kMaxStopCode are treated as stop() |
| 177 // instructions (see Assembler::stop()). |
| 178 // - Breaks larger than kMaxStopCode are simple breaks, dropping you into the |
| 179 // debugger. |
| 180 static const uint32_t kMaxWatchpointCode = 31; |
| 181 static const uint32_t kMaxStopCode = 127; |
| 182 STATIC_ASSERT(kMaxWatchpointCode < kMaxStopCode); |
| 183 |
| 184 |
| 161 // ----- Fields offset and length. | 185 // ----- Fields offset and length. |
| 162 static const int kOpcodeShift = 26; | 186 static const int kOpcodeShift = 26; |
| 163 static const int kOpcodeBits = 6; | 187 static const int kOpcodeBits = 6; |
| 164 static const int kRsShift = 21; | 188 static const int kRsShift = 21; |
| 165 static const int kRsBits = 5; | 189 static const int kRsBits = 5; |
| 166 static const int kRtShift = 16; | 190 static const int kRtShift = 16; |
| 167 static const int kRtBits = 5; | 191 static const int kRtBits = 5; |
| 168 static const int kRdShift = 11; | 192 static const int kRdShift = 11; |
| 169 static const int kRdBits = 5; | 193 static const int kRdBits = 5; |
| 170 static const int kSaShift = 6; | 194 static const int kSaShift = 6; |
| 171 static const int kSaBits = 5; | 195 static const int kSaBits = 5; |
| 172 static const int kFunctionShift = 0; | 196 static const int kFunctionShift = 0; |
| 173 static const int kFunctionBits = 6; | 197 static const int kFunctionBits = 6; |
| 174 static const int kLuiShift = 16; | 198 static const int kLuiShift = 16; |
| 175 | 199 |
| 176 static const int kImm16Shift = 0; | 200 static const int kImm16Shift = 0; |
| 177 static const int kImm16Bits = 16; | 201 static const int kImm16Bits = 16; |
| 178 static const int kImm26Shift = 0; | 202 static const int kImm26Shift = 0; |
| 179 static const int kImm26Bits = 26; | 203 static const int kImm26Bits = 26; |
| 204 static const int kImm28Shift = 0; |
| 205 static const int kImm28Bits = 28; |
| 180 | 206 |
| 181 static const int kFsShift = 11; | 207 static const int kFsShift = 11; |
| 182 static const int kFsBits = 5; | 208 static const int kFsBits = 5; |
| 183 static const int kFtShift = 16; | 209 static const int kFtShift = 16; |
| 184 static const int kFtBits = 5; | 210 static const int kFtBits = 5; |
| 185 static const int kFdShift = 6; | 211 static const int kFdShift = 6; |
| 186 static const int kFdBits = 5; | 212 static const int kFdBits = 5; |
| 187 static const int kFCccShift = 8; | 213 static const int kFCccShift = 8; |
| 188 static const int kFCccBits = 3; | 214 static const int kFCccBits = 3; |
| 189 static const int kFBccShift = 18; | 215 static const int kFBccShift = 18; |
| 190 static const int kFBccBits = 3; | 216 static const int kFBccBits = 3; |
| 191 static const int kFBtrueShift = 16; | 217 static const int kFBtrueShift = 16; |
| 192 static const int kFBtrueBits = 1; | 218 static const int kFBtrueBits = 1; |
| 193 | 219 |
| 194 // ----- Miscellaneous useful masks. | 220 // ----- Miscellaneous useful masks. |
| 195 // Instruction bit masks. | 221 // Instruction bit masks. |
| 196 static const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift; | 222 static const int kOpcodeMask = ((1 << kOpcodeBits) - 1) << kOpcodeShift; |
| 197 static const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift; | 223 static const int kImm16Mask = ((1 << kImm16Bits) - 1) << kImm16Shift; |
| 198 static const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift; | 224 static const int kImm26Mask = ((1 << kImm26Bits) - 1) << kImm26Shift; |
| 225 static const int kImm28Mask = ((1 << kImm28Bits) - 1) << kImm28Shift; |
| 199 static const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; | 226 static const int kRsFieldMask = ((1 << kRsBits) - 1) << kRsShift; |
| 200 static const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; | 227 static const int kRtFieldMask = ((1 << kRtBits) - 1) << kRtShift; |
| 201 static const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; | 228 static const int kRdFieldMask = ((1 << kRdBits) - 1) << kRdShift; |
| 202 static const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; | 229 static const int kSaFieldMask = ((1 << kSaBits) - 1) << kSaShift; |
| 203 static const int kFunctionFieldMask = | 230 static const int kFunctionFieldMask = |
| 204 ((1 << kFunctionBits) - 1) << kFunctionShift; | 231 ((1 << kFunctionBits) - 1) << kFunctionShift; |
| 205 // Misc masks. | 232 // Misc masks. |
| 206 static const int kHiMask = 0xffff << 16; | 233 static const int kHiMask = 0xffff << 16; |
| 207 static const int kLoMask = 0xffff; | 234 static const int kLoMask = 0xffff; |
| 208 static const int kSignMask = 0x80000000; | 235 static const int kSignMask = 0x80000000; |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 static const int kBranchReturnOffset = 2 * Instruction::kInstrSize; | 756 static const int kBranchReturnOffset = 2 * Instruction::kInstrSize; |
| 730 | 757 |
| 731 static const int kDoubleAlignmentBits = 3; | 758 static const int kDoubleAlignmentBits = 3; |
| 732 static const int kDoubleAlignment = (1 << kDoubleAlignmentBits); | 759 static const int kDoubleAlignment = (1 << kDoubleAlignmentBits); |
| 733 static const int kDoubleAlignmentMask = kDoubleAlignment - 1; | 760 static const int kDoubleAlignmentMask = kDoubleAlignment - 1; |
| 734 | 761 |
| 735 | 762 |
| 736 } } // namespace v8::internal | 763 } } // namespace v8::internal |
| 737 | 764 |
| 738 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 765 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
| 739 | |
| OLD | NEW |