diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-03-15 06:10:50 -0400 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-03-15 06:10:50 -0400 |
commit | b33f4623abeb82acf87714ada95682ceb0993d31 (patch) | |
tree | 80144e7e7717352d5627e5ca2eb5e2eb9da9a30c /util/statetrace/arch | |
parent | ff90b8c1aa99711eeb55c5eba29519f77cbc041c (diff) | |
download | gem5-b33f4623abeb82acf87714ada95682ceb0993d31.tar.xz |
Update to statetrace. This will break it, but I want to make sure it gets into mercurial.
--HG--
extra : convert_revision : 6960d2f728c85e99e32bf9b752e45b3cb5e30e3e
Diffstat (limited to 'util/statetrace/arch')
-rw-r--r-- | util/statetrace/arch/tracechild_sparc.cc | 58 | ||||
-rw-r--r-- | util/statetrace/arch/tracechild_sparc.hh | 10 |
2 files changed, 56 insertions, 12 deletions
diff --git a/util/statetrace/arch/tracechild_sparc.cc b/util/statetrace/arch/tracechild_sparc.cc index 2f42330e4..f60f9916b 100644 --- a/util/statetrace/arch/tracechild_sparc.cc +++ b/util/statetrace/arch/tracechild_sparc.cc @@ -54,8 +54,45 @@ string SparcTraceChild::regNames[numregs] = { //Miscelaneous "fsr", "fprs", "pc", "npc", "y", "cwp", "pstate", "asi", "ccr"}; +bool SparcTraceChild::sendState(int socket) +{ + uint64_t regVal = 0; + for(int x = 0; x <= I7; x++) + { + regVal = getRegVal(x); + if(write(socket, ®Val, sizeof(regVal)) == -1) + { + cerr << "Write failed! " << strerror(errno) << endl; + tracing = false; + return false; + } + } + regVal = getRegVal(PC); + if(write(socket, ®Val, sizeof(regVal)) == -1) + { + cerr << "Write failed! " << strerror(errno) << endl; + tracing = false; + return false; + } + regVal = getRegVal(NPC); + if(write(socket, ®Val, sizeof(regVal)) == -1) + { + cerr << "Write failed! " << strerror(errno) << endl; + tracing = false; + return false; + } + regVal = getRegVal(CCR); + if(write(socket, ®Val, sizeof(regVal)) == -1) + { + cerr << "Write failed! " << strerror(errno) << endl; + tracing = false; + return false; + } + return true; +} + int64_t getRegs(regs & myregs, fpu & myfpu, - int64_t * locals, int64_t * inputs, int num) + uint64_t * locals, uint64_t * inputs, int num) { assert(num < SparcTraceChild::numregs && num >= 0); switch(num) @@ -160,14 +197,19 @@ bool SparcTraceChild::update(int pid) cerr << "Update failed" << endl; return false; } - uint64_t StackPointer = getSP(); - const int stackBias = (StackPointer % 1) ? 2047 : 0; + uint64_t stackPointer = getSP(); + uint64_t stackBias = 2047; + bool v9 = stackPointer % 2; for(unsigned int x = 0; x < 8; x++) { - locals[x] = ptrace(PTRACE_PEEKTEXT, pid, - StackPointer + stackBias + x * 8, 0); - inputs[x] = ptrace(PTRACE_PEEKTEXT, pid, - StackPointer + stackBias + x * 8 + (8 * 8), 0); + uint64_t localAddr = stackPointer + + (v9 ? (stackBias + x * 8) : (x * 4)); + locals[x] = ptrace(PTRACE_PEEKTEXT, pid, localAddr, 0); + if(!v9) locals[x] >>= 32; + uint64_t inputAddr = stackPointer + + (v9 ? (stackBias + x * 8 + (8 * 8)) : (x * 4 + 8 * 4)); + inputs[x] = ptrace(PTRACE_PEEKTEXT, pid, inputAddr, 0); + if(!v9) inputs[x] >>= 32; } if(ptrace(PTRACE_GETFPREGS, pid, &thefpregs, 0) != 0) return false; @@ -366,7 +408,7 @@ ostream & SparcTraceChild::outputStartState(ostream & os) { bool v8 = false; uint64_t sp = getSP(); - if(sp % 1) + if(sp % 2) { os << "Detected a 64 bit executable.\n"; v8 = false; diff --git a/util/statetrace/arch/tracechild_sparc.hh b/util/statetrace/arch/tracechild_sparc.hh index 8b4ff9aae..0284fb82e 100644 --- a/util/statetrace/arch/tracechild_sparc.hh +++ b/util/statetrace/arch/tracechild_sparc.hh @@ -72,10 +72,10 @@ private: regs oldregs; fpu thefpregs; fpu oldfpregs; - int64_t locals[8]; - int64_t oldLocals[8]; - int64_t inputs[8]; - int64_t oldInputs[8]; + uint64_t locals[8]; + uint64_t oldLocals[8]; + uint64_t inputs[8]; + uint64_t oldInputs[8]; bool regDiffSinceUpdate[numregs]; //This calculates where the pc might go after the current instruction. @@ -90,6 +90,8 @@ protected: public: SparcTraceChild(); + bool sendState(int socket); + int getNumRegs() { return numregs; |