thread_state.hh (2680:246e7104f744) thread_state.hh (2683:d6b72bb2ed97)
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
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
61 private:
62 /** Pointer to the CPU. */
63 FullCPU *cpu;
64 public:
65 /** Whether or not the thread is currently in syscall mode, and
66 * thus able to be externally updated without squashing.
67 */
68 bool inSyscall;
69
70 /** Whether or not the thread is currently waiting on a trap, and
71 * thus able to be externally updated without squashing.
72 */
73 bool trapPending;
74
75#if FULL_SYSTEM
84 O3ThreadState(FullCPU *_cpu, int _thread_num, FunctionalMemory *_mem)
85 : ThreadState(-1, _thread_num, _mem),
76 O3ThreadState(FullCPU *_cpu, int _thread_num, )
77 : ThreadState(-1, _thread_num),
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
78 inSyscall(0), trapPending(0)
79 { }
80#else
81 O3ThreadState(FullCPU *_cpu, int _thread_num, Process *_process, int _asid,
82 MemObject *mem)
83 : ThreadState(-1, _thread_num, mem, _process, _asid),
84 cpu(_cpu), inSyscall(0), trapPending(0)
85 { }
86#endif
87
88 /** Pointer to the ThreadContext of this thread. */
89 ThreadContext *tc;
90
91 /** Returns a pointer to the TC of this thread. */
92 ThreadContext *getTC() { return tc; }
93
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__
94#if !FULL_SYSTEM
95 /** Handles the syscall. */
96 void syscall(int64_t callnum) { process->syscall(callnum, tc); }
97#endif
98};
99
100#endif // __CPU_O3_THREAD_STATE_HH__