48 #include "debug/ExecRegDelta.hh"
49 #include "params/ArmNativeTrace.hh"
55 static const char *regNames[] = {
56 "r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
57 "r8",
"r9",
"r10",
"fp",
"r12",
"sp",
"lr",
"pc",
58 "cpsr",
"f0",
"f1",
"f2",
"f3",
"f4",
"f5",
"f6",
59 "f7",
"f8",
"f9",
"f10",
"f11",
"f12",
"f13",
"f14",
60 "f15",
"f16",
"f17",
"f18",
"f19",
"f20",
"f21",
"f22",
61 "f23",
"f24",
"f25",
"f26",
"f27",
"f28",
"f29",
"f30",
69 oldState = state[current];
70 current = (current + 1) % 2;
71 newState = state[current];
73 memcpy(newState, oldState,
sizeof(state[0]));
76 parent->
read(&diffVector,
sizeof(diffVector));
80 for (
int i = 0;
i < STATE_NUMVALS;
i++) {
81 if (diffVector & 0x1) {
90 uint64_t values[changes];
91 parent->
read(values,
sizeof(values));
93 for (
int i = 0;
i < STATE_NUMVALS;
i++) {
96 changed[
i] = (newState[
i] != oldState[
i]);
104 oldState = state[current];
105 current = (current + 1) % 2;
106 newState = state[current];
109 for (
int i = 0;
i < 15;
i++) {
111 changed[
i] = (oldState[
i] != newState[
i]);
115 newState[STATE_PC] = tc->
pcState().npc();
116 changed[STATE_PC] = (newState[STATE_PC] != oldState[STATE_PC]);
125 newState[STATE_CPSR] = cpsr;
126 changed[STATE_CPSR] = (newState[STATE_CPSR] != oldState[STATE_CPSR]);
129 newState[STATE_F0 + (
i >> 1)] =
149 if ((mState.oldState[STATE_PC] == nState.oldState[STATE_PC]) &&
150 (mState.newState[STATE_PC] - 4 == nState.newState[STATE_PC])) {
151 DPRINTF(ExecRegDelta,
"Advancing to match PCs after syscall\n");
156 bool errorFound =
false;
158 for (
int i = 0;
i < STATE_NUMVALS;
i++) {
159 if (nState.changed[
i] || mState.changed[
i]) {
160 bool oldMatch = (mState.oldState[
i] == nState.oldState[
i]);
161 bool newMatch = (mState.newState[
i] == nState.newState[
i]);
162 if (oldMatch && newMatch) {
170 const char *vergence =
" ";
171 if (oldMatch && !newMatch) {
173 }
else if (!oldMatch && newMatch) {
177 if (!nState.changed[
i]) {
178 DPRINTF(ExecRegDelta,
"%s [%5s] "\
180 "M5: %#010x => %#010x\n",
181 vergence, regNames[
i],
183 mState.oldState[i], mState.newState[i]);
184 }
else if (!mState.changed[
i]) {
185 DPRINTF(ExecRegDelta,
"%s [%5s] "\
186 "Native: %#010x => %#010x "\
188 vergence, regNames[
i],
189 nState.oldState[i], nState.newState[i],
192 DPRINTF(ExecRegDelta,
"%s [%5s] "\
193 "Native: %#010x => %#010x "\
194 "M5: %#010x => %#010x\n",
195 vergence, regNames[
i],
196 nState.oldState[i], nState.newState[i],
197 mState.oldState[i], mState.newState[i]);
213 bool pcError = (mState.newState[STATE_PC] !=
214 nState.newState[STATE_PC]);
215 if (stopOnPCError && pcError)
216 panic(
"Native trace detected an error in control flow!");
227 ArmNativeTraceParams::create()
virtual CCReg readCCReg(int reg_idx)=0
StaticInstPtr getMacroStaticInst() const
virtual MiscReg readMiscRegNoEffect(int misc_reg) const =0
virtual FloatRegBits readFloatRegBits(int reg_idx)=0
virtual TheISA::PCState pcState()=0
ThreadContext is the external interface to all thread state for anything outside of the CPU...
virtual uint64_t readIntReg(int reg_idx)=0
StaticInstPtr getStaticInst() const
ThreadContext * getThread() const
virtual Addr nextInstAddr()=0
virtual MiscReg readMiscReg(int misc_reg)=0
void traceInst(const StaticInstPtr &inst, bool ran)
void read(void *ptr, size_t size)
void update(NativeTrace *parent)
void check(NativeTraceRecord *record)
const int NumFloatV7ArchRegs