OLD | NEW |
---|---|
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 | 45 |
46 // Simulator should support ARM5 instructions. | 46 // Simulator should support ARM5 instructions. |
47 #if !defined(__arm__) | 47 #if !defined(__arm__) |
48 # define __ARM_ARCH_5__ 1 | 48 # define __ARM_ARCH_5__ 1 |
49 # define __ARM_ARCH_5T__ 1 | 49 # define __ARM_ARCH_5T__ 1 |
50 #endif | 50 #endif |
51 | 51 |
52 namespace assembler { | 52 namespace assembler { |
53 namespace arm { | 53 namespace arm { |
54 | 54 |
55 // Number of registers in normal ARM mode. | |
56 static const int kNumRegisters = 16; | |
57 | |
58 // PC is register 15. | |
59 static const int kPCRegister = 15; | |
60 static const int kNoRegister = -1; | |
61 | |
55 // Defines constants and accessor classes to assemble, disassemble and | 62 // Defines constants and accessor classes to assemble, disassemble and |
56 // simulate ARM instructions. | 63 // simulate ARM instructions. |
57 // | 64 // |
58 // Section references in the code refer to the "ARM Architecture Reference | 65 // Section references in the code refer to the "ARM Architecture Reference |
59 // Manual" from July 2005 (available at http://www.arm.com/miscPDFs/14128.pdf) | 66 // Manual" from July 2005 (available at http://www.arm.com/miscPDFs/14128.pdf) |
60 // | 67 // |
61 // Constants for specific fields are defined in their respective named enums. | 68 // Constants for specific fields are defined in their respective named enums. |
62 // General constants are in an anonymous enum in class Instr. | 69 // General constants are in an anonymous enum in class Instr. |
63 | 70 |
64 typedef unsigned char byte; | 71 typedef unsigned char byte; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 // to allocate or create instances of class Instr. | 269 // to allocate or create instances of class Instr. |
263 // Use the At(pc) function to create references to Instr. | 270 // Use the At(pc) function to create references to Instr. |
264 static Instr* At(byte* pc) { return reinterpret_cast<Instr*>(pc); } | 271 static Instr* At(byte* pc) { return reinterpret_cast<Instr*>(pc); } |
265 | 272 |
266 private: | 273 private: |
267 // We need to prevent the creation of instances of class Instr. | 274 // We need to prevent the creation of instances of class Instr. |
268 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); | 275 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); |
269 }; | 276 }; |
270 | 277 |
271 | 278 |
279 // Helper functions for converting between register numbers and names. | |
280 class Registers { | |
281 public: | |
282 | |
iposva
2009/09/08 21:59:57
Please drop this extra empty line.
Søren Thygesen Gjesse
2009/09/09 07:01:12
Done.
| |
283 // Return the name of the register. | |
284 static const char* Name(int reg); | |
285 | |
286 // Lookup the register number for the name provided. | |
287 static int Number(const char* name); | |
288 | |
289 struct RegisterAlias { | |
290 int reg; | |
291 const char *name; | |
292 }; | |
293 | |
294 private: | |
295 static const char* names_[kNumRegisters]; | |
296 static const RegisterAlias aliases_[]; | |
297 }; | |
298 | |
299 | |
300 | |
272 } } // namespace assembler::arm | 301 } } // namespace assembler::arm |
273 | 302 |
274 #endif // V8_ARM_CONSTANTS_ARM_H_ | 303 #endif // V8_ARM_CONSTANTS_ARM_H_ |
OLD | NEW |