Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: runtime/vm/simulator_mips.h

Issue 12431016: Copies Simulator Debugger from ARM to MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Declares a Simulator for MIPS instructions if we are not generating a native 5 // Declares a Simulator for MIPS instructions if we are not generating a native
6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation
7 // on regular desktop machines. 7 // on regular desktop machines.
8 // Dart calls into generated code by "calling" the InvokeDartCode stub, 8 // Dart calls into generated code by "calling" the InvokeDartCode stub,
9 // which will start execution in the Simulator or forwards to the real entry 9 // which will start execution in the Simulator or forwards to the real entry
10 // on a MIPS HW platform. 10 // on a MIPS HW platform.
(...skipping 17 matching lines...) Expand all
28 ~Simulator(); 28 ~Simulator();
29 29
30 // The currently executing Simulator instance, which is associated to the 30 // The currently executing Simulator instance, which is associated to the
31 // current isolate 31 // current isolate
32 static Simulator* Current(); 32 static Simulator* Current();
33 33
34 // Accessors for register state. 34 // Accessors for register state.
35 void set_register(Register reg, int32_t value); 35 void set_register(Register reg, int32_t value);
36 int32_t get_register(Register reg) const; 36 int32_t get_register(Register reg) const;
37 37
38 // Accessors for floating point register state.
39 void set_fregister(FRegister freg, double value);
40 double get_fregister(FRegister) const;
41
42 // Accessor for the pc.
43 int32_t get_pc() const { return pc_; }
44
38 // Accessors for hi, lo registers. 45 // Accessors for hi, lo registers.
39 void set_hi_register(int32_t value) { hi_reg_ = value; } 46 void set_hi_register(int32_t value) { hi_reg_ = value; }
40 void set_lo_register(int32_t value) { lo_reg_ = value; } 47 void set_lo_register(int32_t value) { lo_reg_ = value; }
41 int32_t get_hi_register() const { return hi_reg_; } 48 int32_t get_hi_register() const { return hi_reg_; }
42 int32_t get_lo_register() const { return lo_reg_; } 49 int32_t get_lo_register() const { return lo_reg_; }
43 50
44 // Accessor to the internal simulator stack top. 51 // Accessor to the internal simulator stack top.
45 uword StackTop() const; 52 uword StackTop() const;
46 53
47 // Call on program start. 54 // Call on program start.
(...skipping 13 matching lines...) Expand all
61 // the ra is set to this value on transition from native C code to 68 // the ra is set to this value on transition from native C code to
62 // simulated execution, so that the simulator can "return" to the native 69 // simulated execution, so that the simulator can "return" to the native
63 // C code. 70 // C code.
64 static const uword kEndSimulatingPC = -1; 71 static const uword kEndSimulatingPC = -1;
65 72
66 // Special registers for the results of div, divu. 73 // Special registers for the results of div, divu.
67 int32_t hi_reg_; 74 int32_t hi_reg_;
68 int32_t lo_reg_; 75 int32_t lo_reg_;
69 76
70 int32_t registers_[kNumberOfCpuRegisters]; 77 int32_t registers_[kNumberOfCpuRegisters];
78 double fregisters_[kNumberOfFRegisters];
71 uword pc_; 79 uword pc_;
72 80
73 // Simulator support. 81 // Simulator support.
74 char* stack_; 82 char* stack_;
75 int icount_; 83 int icount_;
76 bool delay_slot_; 84 bool delay_slot_;
77 85
86 // Registered breakpoints.
87 Instr* break_pc_;
88 int32_t break_instr_;
89
78 // Illegal memory access support. 90 // Illegal memory access support.
79 static bool IsIllegalAddress(uword addr) { 91 static bool IsIllegalAddress(uword addr) {
80 return addr < 64*1024; 92 return addr < 64*1024;
81 } 93 }
94 void HandleIllegalAccess(uword addr, Instr* instr);
95
96 // Read and write memory.
97 void UnalignedAccess(const char* msg, uword addr, Instr* instr);
82 98
83 bool OverflowFrom(int32_t alu_out, 99 bool OverflowFrom(int32_t alu_out,
84 int32_t left, 100 int32_t left,
85 int32_t right, 101 int32_t right,
86 bool addition); 102 bool addition);
87 103
88 void set_pc(uword value) { pc_ = value; } 104 void set_pc(uword value) { pc_ = value; }
89 105
90 void Format(Instr* instr, const char* format); 106 void Format(Instr* instr, const char* format);
91 107
92 inline int8_t ReadB(uword addr); 108 inline int8_t ReadB(uword addr);
93 inline uint8_t ReadBU(uword addr); 109 inline uint8_t ReadBU(uword addr);
94 inline int16_t ReadH(uword addr, Instr* instr); 110 inline int16_t ReadH(uword addr, Instr* instr);
95 inline uint16_t ReadHU(uword addr, Instr *instr); 111 inline uint16_t ReadHU(uword addr, Instr *instr);
96 inline int ReadW(uword addr, Instr* instr); 112 inline int ReadW(uword addr, Instr* instr);
97 113
98 inline void WriteB(uword addr, uint8_t value); 114 inline void WriteB(uword addr, uint8_t value);
99 inline void WriteH(uword addr, uint16_t value, Instr* isntr); 115 inline void WriteH(uword addr, uint16_t value, Instr* isntr);
100 inline void WriteW(uword addr, int value, Instr* instr); 116 inline void WriteW(uword addr, int value, Instr* instr);
101 117
102 void DecodeSpecial(Instr* instr); 118 void DecodeSpecial(Instr* instr);
103 void DecodeSpecial2(Instr* instr); 119 void DecodeSpecial2(Instr* instr);
104 void DecodeSpecial3(Instr *instr);
105 void InstructionDecode(Instr* instr); 120 void InstructionDecode(Instr* instr);
106 121
107 void Execute(); 122 void Execute();
108 void ExecuteDelaySlot(); 123 void ExecuteDelaySlot();
124
125 friend class SimulatorDebugger;
109 }; 126 };
110 127
111 } // namespace dart 128 } // namespace dart
112 129
113 #endif // VM_SIMULATOR_MIPS_H_ 130 #endif // VM_SIMULATOR_MIPS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698