gem5
v21.1.0.1
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
o
p
q
r
s
t
v
x
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
:
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
a
b
c
e
f
g
h
i
l
m
n
o
p
s
t
v
Variables
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
v
w
Typedefs
a
b
c
d
h
i
m
p
s
t
u
w
Enumerations
b
h
i
o
p
Enumerator
h
i
o
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
cpu
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
"
35
#include "
mem/se_translating_port_proxy.hh
"
36
#include "
mem/translating_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
44
ThreadState::ThreadState
(
BaseCPU
*cpu,
ThreadID
_tid,
Process
*_process)
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
53
ThreadState::~ThreadState
()
54
{
55
if
(
virtProxy
!= NULL)
56
delete
virtProxy
;
57
}
58
59
void
60
ThreadState::serialize
(
CheckpointOut
&cp)
const
61
{
62
SERIALIZE_ENUM
(
_status
);
63
}
64
65
void
66
ThreadState::unserialize
(
CheckpointIn
&cp)
67
{
68
UNSERIALIZE_ENUM
(
_status
);
69
}
70
71
void
72
ThreadState::initMemProxies
(
ThreadContext
*tc)
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
) {
80
virtProxy
=
new
TranslatingPortProxy
(tc);
81
}
else
{
82
virtProxy
=
new
SETranslatingPortProxy
(
83
tc,
SETranslatingPortProxy::NextPage
);
84
}
85
}
86
87
PortProxy
&
88
ThreadState::getVirtProxy
()
89
{
90
assert(
virtProxy
!= NULL);
91
return
*
virtProxy
;
92
}
93
94
ThreadState::ThreadStateStats::ThreadStateStats
(
BaseCPU
*cpu,
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 7 2021 14:53:44 for gem5 by
doxygen
1.8.17