1/*
2 * Copyright (c) 2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

76SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
77 Process *_process, BaseTLB *_itb,
78 BaseTLB *_dtb, TheISA::ISA *_isa)
79 : ThreadState(_cpu, _thread_num, _process), isa(_isa),
80 predicate(false), system(_sys),
81 itb(_itb), dtb(_dtb), decoder(TheISA::Decoder(_isa))
82{
83 clearArchRegs();
84 tc = new ProxyThreadContext<SimpleThread>(this);
85 quiesceEvent = new EndQuiesceEvent(tc);
84 quiesceEvent = new EndQuiesceEvent(this);
85}
86
87SimpleThread::SimpleThread(BaseCPU *_cpu, int _thread_num, System *_sys,
88 BaseTLB *_itb, BaseTLB *_dtb,
89 TheISA::ISA *_isa, bool use_kernel_stats)
90 : ThreadState(_cpu, _thread_num, NULL), isa(_isa), system(_sys), itb(_itb),
91 dtb(_dtb), decoder(TheISA::Decoder(_isa))
92{
94 tc = new ProxyThreadContext<SimpleThread>(this);
93 quiesceEvent = new EndQuiesceEvent(this);
94
96 quiesceEvent = new EndQuiesceEvent(tc);
97
95 clearArchRegs();
96
97 if (baseCpu->params()->profile) {
98 profile = new FunctionProfile(system->kernelSymtab);
99 Callback *cb =
100 new MakeCallback<SimpleThread,
101 &SimpleThread::dumpFuncProfile>(this);
102 registerExitCallback(cb);

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

107 static ProfileNode dummyNode;
108 profileNode = &dummyNode;
109 profilePC = 3;
110
111 if (use_kernel_stats)
112 kernelStats = new TheISA::Kernel::Statistics();
113}
114
118SimpleThread::~SimpleThread()
119{
120 delete tc;
121}
122
115void
116SimpleThread::takeOverFrom(ThreadContext *oldContext)
117{
126 ::takeOverFrom(*tc, *oldContext);
118 ::takeOverFrom(*this, *oldContext);
119 decoder.takeOverFrom(oldContext->getDecoderPtr());
120
121 kernelStats = oldContext->getKernelStats();
122 funcExeInst = oldContext->readFuncExeInst();
123 storeCondFailures = 0;
124}
125
126void

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

135 _threadId = oldContext->threadId();
136 _contextId = oldContext->contextId();
137}
138
139void
140SimpleThread::serialize(CheckpointOut &cp) const
141{
142 ThreadState::serialize(cp);
151 ::serialize(*tc, cp);
143 ::serialize(*this, cp);
144}
145
146
147void
148SimpleThread::unserialize(CheckpointIn &cp)
149{
150 ThreadState::unserialize(cp);
159 ::unserialize(*tc, cp);
151 ::unserialize(*this, cp);
152}
153
154void
155SimpleThread::startup()
156{
165 isa->startup(tc);
157 isa->startup(this);
158}
159
160void
161SimpleThread::dumpFuncProfile()
162{
163 OutputStream *os(simout.create(csprintf("profile.%s.dat", baseCpu->name())));
172 profile->dump(tc, *os->stream());
164 profile->dump(this, *os->stream());
165 simout.close(os);
166}
167
168void
169SimpleThread::activate()
170{
171 if (status() == ThreadContext::Active)
172 return;

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

205{
206 if (FullSystem && kernelStats)
207 kernelStats->regStats(name + ".kern");
208}
209
210void
211SimpleThread::copyArchRegs(ThreadContext *src_tc)
212{
221 TheISA::copyRegs(src_tc, tc);
213 TheISA::copyRegs(src_tc, this);
214}
215
216// The following methods are defined in src/arch/alpha/ev5.cc for
217// Alpha.
218#if THE_ISA != ALPHA_ISA
219Fault
220SimpleThread::hwrei()
221{
222 return NoFault;
223}
224
225bool
226SimpleThread::simPalCheck(int palFunc)
227{
228 return true;
229}
230#endif