Deleted Added
sdiff udiff text old ( 2680:246e7104f744 ) new ( 2683:d6b72bb2ed97 )
full compact
1/*
2 * Copyright (c) 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;

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

53 * pointer, etc. It also handles anything related to a specific
54 * thread's process, such as syscalls and checking valid addresses.
55 */
56template <class Impl>
57struct O3ThreadState : public ThreadState {
58 typedef ThreadContext::Status Status;
59 typedef typename Impl::FullCPU FullCPU;
60
61 /** Current status of the thread. */
62 Status _status;
63
64 /** Current instruction the thread is committing. Only set and
65 * used for DTB faults currently.
66 */
67 TheISA::MachInst inst;
68
69 private:
70 /** Pointer to the CPU. */
71 FullCPU *cpu;
72 public:
73 /** Whether or not the thread is currently in syscall mode, and
74 * thus able to be externally updated without squashing.
75 */
76 bool inSyscall;
77
78 /** Whether or not the thread is currently waiting on a trap, and
79 * thus able to be externally updated without squashing.
80 */
81 bool trapPending;
82
83#if FULL_SYSTEM
84 O3ThreadState(FullCPU *_cpu, int _thread_num, FunctionalMemory *_mem)
85 : ThreadState(-1, _thread_num, _mem),
86 inSyscall(0), trapPending(0)
87 { }
88#else
89 O3ThreadState(FullCPU *_cpu, int _thread_num, Process *_process, int _asid,
90 MemObject *mem)
91 : ThreadState(-1, _thread_num, mem, _process, _asid),
92 cpu(_cpu), inSyscall(0), trapPending(0)
93 { }
94#endif
95
96 /** Pointer to the ThreadContext of this thread. */
97 ThreadContext *tc;
98
99 /** Returns a pointer to the TC of this thread. */
100 ThreadContext *getTC() { return tc; }
101
102 /** Returns the status of this thread. */
103 Status status() const { return _status; }
104
105 /** Sets the status of this thread. */
106 void setStatus(Status new_status) { _status = new_status; }
107
108 /** Sets the current instruction being committed. */
109 void setInst(TheISA::MachInst _inst) { inst = _inst; }
110
111 /** Reads the number of instructions functionally executed and
112 * committed.
113 */
114 Counter readFuncExeInst() { return funcExeInst; }
115
116 /** Sets the total number of instructions functionally executed
117 * and committed.
118 */
119 void setFuncExeInst(Counter new_val) { funcExeInst = new_val; }
120
121#if !FULL_SYSTEM
122 /** Handles the syscall. */
123 void syscall(int64_t callnum) { process->syscall(callnum, tc); }
124#endif
125};
126
127#endif // __CPU_O3_THREAD_STATE_HH__