gem5  v21.1.0.2
thread_state.cc
Go to the documentation of this file.
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;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include "cpu/thread_state.hh"
30 
31 #include "base/output.hh"
32 #include "cpu/base.hh"
33 #include "mem/port.hh"
34 #include "mem/port_proxy.hh"
37 #include "sim/full_system.hh"
38 #include "sim/serialize.hh"
39 #include "sim/system.hh"
40 
41 namespace gem5
42 {
43 
45  : numInst(0), numOp(0), threadStats(cpu, _tid),
46  numLoad(0), startNumLoad(0),
47  _status(ThreadContext::Halted), baseCpu(cpu),
48  _contextId(0), _threadId(_tid), lastActivate(0), lastSuspend(0),
49  process(_process), virtProxy(NULL), storeCondFailures(0)
50 {
51 }
52 
54 {
55  if (virtProxy != NULL)
56  delete virtProxy;
57 }
58 
59 void
61 {
63 }
64 
65 void
67 {
69 }
70 
71 void
73 {
74  // The port proxies only refer to the data port on the CPU side
75  // and can safely be done at init() time even if the CPU is not
76  // connected, i.e. when restoring from a checkpoint and later
77  // switching the CPU in.
78  assert(virtProxy == NULL);
79  if (FullSystem) {
81  } else {
84  }
85 }
86 
87 PortProxy &
89 {
90  assert(virtProxy != NULL);
91  return *virtProxy;
92 }
93 
95  const ThreadID& tid)
96  : statistics::Group(cpu, csprintf("thread_%i", tid).c_str()),
97  ADD_STAT(numInsts, statistics::units::Count::get(),
98  "Number of Instructions committed"),
99  ADD_STAT(numOps, statistics::units::Count::get(),
100  "Number of Ops committed"),
101  ADD_STAT(numMemRefs, statistics::units::Count::get(),
102  "Number of Memory References")
103 {
104 
105 }
106 
107 } // namespace gem5
gem5::ThreadState::~ThreadState
virtual ~ThreadState()
Definition: thread_state.cc:53
gem5::SETranslatingPortProxy
Definition: se_translating_port_proxy.hh:49
gem5::ThreadState::initMemProxies
void initMemProxies(ThreadContext *tc)
Initialise the physical and virtual port proxies and tie them to the data port of the CPU.
Definition: thread_state.cc:72
thread_state.hh
gem5::ThreadState::ThreadStateStats::ThreadStateStats
ThreadStateStats(BaseCPU *cpu, const ThreadID &thread)
Definition: thread_state.cc:94
system.hh
serialize.hh
gem5::SETranslatingPortProxy::NextPage
@ NextPage
Definition: se_translating_port_proxy.hh:57
gem5::CheckpointIn
Definition: serialize.hh:68
translating_port_proxy.hh
gem5::ThreadState::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: thread_state.cc:66
gem5::ThreadState::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: thread_state.cc:60
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
output.hh
gem5::ThreadState::getVirtProxy
PortProxy & getVirtProxy()
Definition: thread_state.cc:88
gem5::TranslatingPortProxy
This proxy attempts to translate virtual addresses using the TLBs.
Definition: translating_port_proxy.hh:58
SERIALIZE_ENUM
#define SERIALIZE_ENUM(scalar)
Definition: serialize.hh:591
gem5::ThreadState::virtProxy
PortProxy * virtProxy
A translating port proxy, outgoing only, for functional accesse to virtual addresses.
Definition: thread_state.hh:145
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition: thread_context.hh:93
ADD_STAT
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition: group.hh:75
port_proxy.hh
gem5::PortProxy
This object is a proxy for a port or other object which implements the functional response protocol,...
Definition: port_proxy.hh:86
port.hh
gem5::BaseCPU
Definition: base.hh:107
full_system.hh
gem5::Process
Definition: process.hh:67
gem5::FullSystem
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:223
base.hh
gem5::ThreadState::_status
ThreadContext::Status _status
Definition: thread_state.hh:122
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:66
UNSERIALIZE_ENUM
#define UNSERIALIZE_ENUM(scalar)
Definition: serialize.hh:598
se_translating_port_proxy.hh
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ThreadState::ThreadState
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
Definition: thread_state.cc:44
gem5::ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:242

Generated on Tue Sep 21 2021 12:25:05 for gem5 by doxygen 1.8.17