1/*
2 * Copyright (c) 2004-2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 68 unchanged lines hidden (view full) ---

77
78 /** Reads this CPU's ID. */
79 virtual int cpuId() { return cpu->cpuId(); }
80
81 virtual int contextId() { return thread->contextId(); }
82
83 virtual void setContextId(int id) { thread->setContextId(id); }
84
85 /** Returns this thread's ID number. */
86 virtual int threadId() { return thread->threadId(); }
87 virtual void setThreadId(int id) { return thread->setThreadId(id); }
88
89#if FULL_SYSTEM
90 /** Returns a pointer to the system. */
91 virtual System *getSystemPtr() { return cpu->system; }
92
93 /** Returns a pointer to physical memory. */
94 virtual PhysicalMemory *getPhysMemPtr() { return cpu->physmem; }
95
96 /** Returns a pointer to this thread's kernel statistics. */

--- 54 unchanged lines hidden (view full) ---

151 /** Reads the last tick that this thread was suspended on. */
152 virtual Tick readLastSuspend();
153
154 /** Clears the function profiling information. */
155 virtual void profileClear();
156 /** Samples the function profiling information. */
157 virtual void profileSample();
158#endif
155 /** Returns this thread's ID number. */
156 virtual int getThreadNum() { return thread->readTid(); }
157
159 /** Returns the instruction this thread is currently committing.
160 * Only used when an instruction faults.
161 */
162 virtual TheISA::MachInst getInst();
163
164 /** Copies the architectural registers from another TC into this TC. */
165 virtual void copyArchRegs(ThreadContext *tc);
166

--- 19 unchanged lines hidden (view full) ---

186 virtual void setFloatReg(int reg_idx, FloatReg val);
187
188 virtual void setFloatRegBits(int reg_idx, FloatRegBits val, int width);
189
190 virtual void setFloatRegBits(int reg_idx, FloatRegBits val);
191
192 /** Reads this thread's PC. */
193 virtual uint64_t readPC()
193 { return cpu->readPC(thread->readTid()); }
194 { return cpu->readPC(thread->threadId()); }
195
196 /** Sets this thread's PC. */
197 virtual void setPC(uint64_t val);
198
199 /** Reads this thread's next PC. */
200 virtual uint64_t readNextPC()
200 { return cpu->readNextPC(thread->readTid()); }
201 { return cpu->readNextPC(thread->threadId()); }
202
203 /** Sets this thread's next PC. */
204 virtual void setNextPC(uint64_t val);
205
206 virtual uint64_t readMicroPC()
206 { return cpu->readMicroPC(thread->readTid()); }
207 { return cpu->readMicroPC(thread->threadId()); }
208
209 virtual void setMicroPC(uint64_t val);
210
211 virtual uint64_t readNextMicroPC()
211 { return cpu->readNextMicroPC(thread->readTid()); }
212 { return cpu->readNextMicroPC(thread->threadId()); }
213
214 virtual void setNextMicroPC(uint64_t val);
215
216 /** Reads a miscellaneous register. */
217 virtual MiscReg readMiscRegNoEffect(int misc_reg)
217 { return cpu->readMiscRegNoEffect(misc_reg, thread->readTid()); }
218 { return cpu->readMiscRegNoEffect(misc_reg, thread->threadId()); }
219
220 /** Reads a misc. register, including any side-effects the
221 * read might have as defined by the architecture. */
222 virtual MiscReg readMiscReg(int misc_reg)
222 { return cpu->readMiscReg(misc_reg, thread->readTid()); }
223 { return cpu->readMiscReg(misc_reg, thread->threadId()); }
224
225 /** Sets a misc. register. */
226 virtual void setMiscRegNoEffect(int misc_reg, const MiscReg &val);
227
228 /** Sets a misc. register, including any side-effects the
229 * write might have as defined by the architecture. */
230 virtual void setMiscReg(int misc_reg, const MiscReg &val);
231

--- 21 unchanged lines hidden (view full) ---

253 /** Sets a syscall argument. */
254 virtual void setSyscallArg(int i, IntReg val);
255
256 /** Sets the syscall return value. */
257 virtual void setSyscallReturn(SyscallReturn return_value);
258
259 /** Executes a syscall in SE mode. */
260 virtual void syscall(int64_t callnum)
260 { return cpu->syscall(callnum, thread->readTid()); }
261 { return cpu->syscall(callnum, thread->threadId()); }
262
263 /** Reads the funcExeInst counter. */
264 virtual Counter readFuncExeInst() { return thread->funcExeInst; }
265#else
266 /** Returns pointer to the quiesce event. */
267 virtual EndQuiesceEvent *getQuiesceEvent()
268 {
269 return this->thread->quiesceEvent;
270 }
271#endif
272
273 virtual uint64_t readNextNPC()
274 {
274 return this->cpu->readNextNPC(this->thread->readTid());
275 return this->cpu->readNextNPC(this->thread->threadId());
276 }
277
278 virtual void setNextNPC(uint64_t val)
279 {
280#if THE_ISA == ALPHA_ISA
281 panic("Not supported on Alpha!");
282#endif
282 this->cpu->setNextNPC(val, this->thread->readTid());
283 this->cpu->setNextNPC(val, this->thread->threadId());
284 }
285
286 /** This function exits the thread context in the CPU and returns
287 * 1 if the CPU has no more active threads (meaning it's OK to exit);
288 * Used in syscall-emulation mode when a thread executes the 'exit'
289 * syscall.
290 */
291 virtual int exit()

--- 12 unchanged lines hidden ---