diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2009-07-27 00:54:30 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2009-07-27 00:54:30 -0700 |
commit | 52b4a7c36ffbfcf48f6360ace5b69c18adddfa7a (patch) | |
tree | 424eaa26a4d69bef98a0825655f5ce516e3c3d8b /util/statetrace/arch | |
parent | 90d3d3535b206fa011ab86ffc278c8851fe997a6 (diff) | |
download | gem5-52b4a7c36ffbfcf48f6360ace5b69c18adddfa7a.tar.xz |
ARM: Only send information that changed between statetrace and M5.
Diffstat (limited to 'util/statetrace/arch')
-rw-r--r-- | util/statetrace/arch/tracechild_arm.cc | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/util/statetrace/arch/tracechild_arm.cc b/util/statetrace/arch/tracechild_arm.cc index fc2eb3e24..4687b46f0 100644 --- a/util/statetrace/arch/tracechild_arm.cc +++ b/util/statetrace/arch/tracechild_arm.cc @@ -46,23 +46,38 @@ const char* ARMTraceChild::regNames[numregs] = { ARMTraceChild::ARMTraceChild() { - for (int x = 0; x < numregs; x++) + for (int x = 0; x < numregs; x++) { + memset(®s, 0, sizeof(regs)); + memset(&oldregs, 0, sizeof(regs)); regDiffSinceUpdate[x] = false; + } } bool ARMTraceChild::sendState(int socket) { uint32_t regVal = 0; - for(int x = 0; x < numregs; x++) - { - regVal = getRegVal(x); - if(write(socket, ®Val, sizeof(regVal)) == -1) - { + uint32_t message[numregs + 1]; + int pos = 1; + message[0] = 0; + for (int x = 0; x < numregs; x++) { + if (regDiffSinceUpdate[x]) { + message[0] = message[0] | (1 << x); + message[pos++] = getRegVal(x); + } + } + + size_t sent = 0; + size_t toSend = pos * sizeof(message[0]); + uint8_t *messagePtr = (uint8_t *)message; + while (toSend != 0) { + sent = write(socket, messagePtr, toSend); + if (sent == -1) { cerr << "Write failed! " << strerror(errno) << endl; tracing = false; return false; } - + toSend -= sent; + messagePtr += sent; } return true; |