thread_state.hh revision 2292
1
2#ifndef __CPU_THREAD_STATE_HH__
3#define __CPU_THREAD_STATE_HH__
4
5#include "cpu/exec_context.hh"
6
7#if FULL_SYSTEM
8class EndQuiesceEvent;
9class FunctionProfile;
10class ProfileNode;
11#else
12class Process;
13class FunctionalMemory;
14#endif
15
16struct ThreadState {
17#if FULL_SYSTEM
18    ThreadState(int _cpuId, int _tid, FunctionalMemory *_mem)
19        : cpuId(_cpuId), tid(_tid), mem(_mem), lastActivate(0), lastSuspend(0),
20          profile(NULL), profileNode(NULL), profilePC(0), quiesceEvent(NULL)
21#else
22    ThreadState(int _cpuId, int _tid, FunctionalMemory *_mem,
23                Process *_process, short _asid)
24        : cpuId(_cpuId), tid(_tid), mem(_mem), process(_process), asid(_asid)
25#endif
26    {
27        funcExeInst = 0;
28        storeCondFailures = 0;
29    }
30
31    ExecContext::Status status;
32
33    int cpuId;
34
35    // Index of hardware thread context on the CPU that this represents.
36    int tid;
37
38    Counter numInst;
39    Stats::Scalar<> numInsts;
40    Stats::Scalar<> numMemRefs;
41
42    // number of simulated loads
43    Counter numLoad;
44    Counter startNumLoad;
45
46    FunctionalMemory *mem;	// functional storage for process address space
47
48#if FULL_SYSTEM
49    Tick lastActivate;
50    Tick lastSuspend;
51
52    FunctionProfile *profile;
53    ProfileNode *profileNode;
54    Addr profilePC;
55
56    EndQuiesceEvent *quiesceEvent;
57
58#else
59    Process *process;
60
61    // Address space ID.  Note that this is used for TIMING cache
62    // simulation only; all functional memory accesses should use
63    // one of the FunctionalMemory pointers above.
64    short asid;
65
66#endif
67
68    /**
69     * Temporary storage to pass the source address from copy_load to
70     * copy_store.
71     * @todo Remove this temporary when we have a better way to do it.
72     */
73    Addr copySrcAddr;
74    /**
75     * Temp storage for the physical source address of a copy.
76     * @todo Remove this temporary when we have a better way to do it.
77     */
78    Addr copySrcPhysAddr;
79
80    /*
81     * number of executed instructions, for matching with syscall trace
82     * points in EIO files.
83     */
84    Counter funcExeInst;
85
86    //
87    // Count failed store conditionals so we can warn of apparent
88    // application deadlock situations.
89    unsigned storeCondFailures;
90};
91
92#endif // __CPU_THREAD_STATE_HH__
93