gem5
v24.0.0.0
Loading...
Searching...
No Matches
arch
sparc
nativetrace.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 "
arch/sparc/nativetrace.hh
"
30
31
#include "
arch/sparc/pcstate.hh
"
32
#include "
arch/sparc/regs/int.hh
"
33
#include "
cpu/thread_context.hh
"
34
#include "params/SparcNativeTrace.hh"
35
#include "
sim/byteswap.hh
"
36
37
namespace
gem5
38
{
39
40
namespace
trace {
41
42
static
const
char
*
intRegNames
[
SparcISA::int_reg::NumArchRegs
] = {
43
// Global registers
44
"g0"
,
"g1"
,
"g2"
,
"g3"
,
"g4"
,
"g5"
,
"g6"
,
"g7"
,
45
// Output registers
46
"o0"
,
"o1"
,
"o2"
,
"o3"
,
"o4"
,
"o5"
,
"o6"
,
"o7"
,
47
// Local registers
48
"l0"
,
"l1"
,
"l2"
,
"l3"
,
"l4"
,
"l5"
,
"l6"
,
"l7"
,
49
// Input registers
50
"i0"
,
"i1"
,
"i2"
,
"i3"
,
"i4"
,
"i5"
,
"i6"
,
"i7"
,
51
};
52
53
void
54
SparcNativeTrace::check
(
NativeTraceRecord
*record)
55
{
56
ThreadContext
*tc = record->
getThread
();
57
58
uint64_t regVal, realRegVal;
59
60
// Integer registers
61
62
// I doubt a real SPARC will describe more integer registers than this.
63
assert(
SparcISA::int_reg::NumArchRegs
== 32);
64
const
char
**regName =
intRegNames
;
65
for
(
int
i
= 0;
i
<
SparcISA::int_reg::NumArchRegs
;
i
++) {
66
regVal = tc->
getReg
(
SparcISA::intRegClass
[
i
]);
67
read
(&realRegVal,
sizeof
(realRegVal));
68
realRegVal =
betoh
(realRegVal);
69
checkReg
(*(regName++), regVal, realRegVal);
70
}
71
72
auto
&
pc
= tc->
pcState
().
as
<
SparcISA::PCState
>();
73
// PC
74
read
(&realRegVal,
sizeof
(realRegVal));
75
realRegVal =
betoh
(realRegVal);
76
regVal =
pc
.npc();
77
checkReg
(
"pc"
, regVal, realRegVal);
78
79
// NPC
80
read
(&realRegVal,
sizeof
(realRegVal));
81
realRegVal =
betoh
(realRegVal);
82
regVal =
pc
.nnpc();
83
checkReg
(
"npc"
, regVal, realRegVal);
84
85
// CCR
86
read
(&realRegVal,
sizeof
(realRegVal));
87
realRegVal =
betoh
(realRegVal);
88
regVal = tc->
getReg
(
SparcISA::int_reg::Ccr
);
89
checkReg
(
"ccr"
, regVal, realRegVal);
90
}
91
92
}
// namespace trace
93
}
// namespace gem5
nativetrace.hh
byteswap.hh
gem5::GenericISA::DelaySlotUPCState
Definition
pcstate.hh:547
gem5::PCStateBase::as
Target & as()
Definition
pcstate.hh:73
gem5::ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition
guest_abi.test.cc:41
gem5::ThreadContext::getReg
virtual RegVal getReg(const RegId ®) const
Definition
thread_context.cc:180
gem5::ThreadContext::pcState
virtual const PCStateBase & pcState() const =0
gem5::trace::InstRecord::getThread
ThreadContext * getThread() const
Definition
insttracer.hh:291
gem5::trace::NativeTraceRecord
Definition
nativetrace.hh:64
gem5::trace::NativeTrace::checkReg
bool checkReg(const char *regName, T &val, T &realVal)
Definition
nativetrace.hh:100
gem5::trace::NativeTrace::read
void read(void *ptr, size_t size)
Definition
nativetrace.hh:112
gem5::trace::SparcNativeTrace::check
void check(NativeTraceRecord *record)
Definition
nativetrace.cc:54
thread_context.hh
gem5::ArmISA::i
Bitfield< 7 > i
Definition
misc_types.hh:67
gem5::MipsISA::pc
Bitfield< 4 > pc
Definition
pra_constants.hh:243
gem5::SparcISA::int_reg::NumArchRegs
@ NumArchRegs
Definition
int.hh:52
gem5::SparcISA::int_reg::Ccr
constexpr RegId Ccr
Definition
int.hh:132
gem5::SparcISA::intRegClass
constexpr RegClass intRegClass
Definition
int.hh:78
gem5::trace::intRegNames
static const char * intRegNames[SparcISA::int_reg::NumArchRegs]
Definition
nativetrace.cc:42
gem5
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition
binary32.hh:36
gem5::betoh
T betoh(T value)
Definition
byteswap.hh:175
pcstate.hh
int.hh
Generated on Tue Jun 18 2024 16:24:01 for gem5 by
doxygen
1.11.0