summaryrefslogtreecommitdiff
path: root/base/remote_gdb.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/remote_gdb.cc')
-rw-r--r--base/remote_gdb.cc39
1 files changed, 31 insertions, 8 deletions
diff --git a/base/remote_gdb.cc b/base/remote_gdb.cc
index f56ddf7cf..57a179719 100644
--- a/base/remote_gdb.cc
+++ b/base/remote_gdb.cc
@@ -424,12 +424,25 @@ void
RemoteGDB::getregs()
{
memset(gdbregs, 0, sizeof(gdbregs));
- memcpy(&gdbregs[KGDB_REG_V0], context->regs.intRegFile, 32 * sizeof(uint64_t));
+
+ gdbregs[KGDB_REG_PC] = context->readPC();
+
+ // @todo: Currently this is very Alpha specific.
+ if (AlphaISA::PcPAL(gdbregs[KGDB_REG_PC])) {
+ for (int i = 0; i < TheISA::NumIntArchRegs; ++i) {
+ gdbregs[i] = context->readIntReg(AlphaISA::reg_redir[i]);
+ }
+ } else {
+ for (int i = 0; i < TheISA::NumIntArchRegs; ++i) {
+ gdbregs[i] = context->readIntReg(i);
+ }
+ }
+
#ifdef KGDB_FP_REGS
- memcpy(&gdbregs[KGDB_REG_F0], context->regs.floatRegFile.q,
- 32 * sizeof(uint64_t));
+ for (int i = 0; i < TheISA::NumFloatArchRegs; ++i) {
+ gdbregs[i + KGDB_REG_F0] = context->readFloatRegInt(i);
+ }
#endif
- gdbregs[KGDB_REG_PC] = context->regs.pc;
}
///////////////////////////////////////////////////////////
@@ -441,11 +454,21 @@ RemoteGDB::getregs()
void
RemoteGDB::setregs()
{
- memcpy(context->regs.intRegFile, &gdbregs[KGDB_REG_V0],
- 32 * sizeof(uint64_t));
+ // @todo: Currently this is very Alpha specific.
+ if (AlphaISA::PcPAL(gdbregs[KGDB_REG_PC])) {
+ for (int i = 0; i < TheISA::NumIntArchRegs; ++i) {
+ context->setIntReg(AlphaISA::reg_redir[i], gdbregs[i]);
+ }
+ } else {
+ for (int i = 0; i < TheISA::NumIntArchRegs; ++i) {
+ context->setIntReg(i, gdbregs[i]);
+ }
+ }
+
#ifdef KGDB_FP_REGS
- memcpy(context->regs.floatRegFile.q, &gdbregs[KGDB_REG_F0],
- 32 * sizeof(uint64_t));
+ for (int i = 0; i < TheISA::NumFloatArchRegs; ++i) {
+ context->setFloatRegInt(i, gdbregs[i + KGDB_REG_F0]);
+ }
#endif
context->regs.pc = gdbregs[KGDB_REG_PC];
}