1a2
> * Copyright 2015 LabWare
152c153
< : BaseRemoteGDB(_system, tc, GDB_REG_BYTES)
---
> : BaseRemoteGDB(_system, tc)
174,185d174
< /*
< * Translate the kernel debugger register format into the GDB register
< * format.
< *
< * The PowerPC ISA is quite flexible in what register sets may be present
< * depending on the features implemented by the particular CPU;
< * GDB addresses this by describing the format of how register contents
< * are transferred on the wire, in XML files such as 'power-core.xml'.
< * Ideally, we should be reading these files instead of hardcoding this
< * information, but for now the following implementation is enough to
< * serve as the RSP backend for the out-of-the-box, default GDB.
< */
187c176
< RemoteGDB::getregs()
---
> RemoteGDB::PowerGdbRegCache::getRegs(ThreadContext *context)
189,190c178
< DPRINTF(GDBAcc, "getregs in remotegdb \n");
< memset(gdbregs.regs, 0, gdbregs.bytes());
---
> DPRINTF(GDBAcc, "getRegs in remotegdb \n");
196d183
< // INTREG: R0~R31
198c185
< gdbregs.regs32[GdbFirstGPRIndex + i] = htobe((uint32_t)context->readIntReg(i));
---
> r.gpr[i] = htobe((uint32_t)context->readIntReg(i));
200d186
< // FLOATREG: F0~F31
202c188
< gdbregs.regs32[GdbFirstFPRIndex + i] = context->readFloatRegBits(i);
---
> r.fpr[i] = context->readFloatRegBits(i);
204,210c190,195
< // PC, MSR, CR, LR, CTR, XER
< gdbregs.regs32[GdbPCIndex] = htobe((uint32_t)context->pcState().pc());
< gdbregs.regs32[GdbMSRIndex] = 0; // Is MSR modeled?
< gdbregs.regs32[GdbCRIndex] = htobe((uint32_t)context->readIntReg(INTREG_CR));
< gdbregs.regs32[GdbLRIndex] = htobe((uint32_t)context->readIntReg(INTREG_LR));
< gdbregs.regs32[GdbCTRIndex] = htobe((uint32_t)context->readIntReg(INTREG_CTR));
< gdbregs.regs32[GdbXERIndex] = htobe((uint32_t)context->readIntReg(INTREG_XER));
---
> r.pc = htobe((uint32_t)context->pcState().pc());
> r.msr = 0; // Is MSR modeled?
> r.cr = htobe((uint32_t)context->readIntReg(INTREG_CR));
> r.lr = htobe((uint32_t)context->readIntReg(INTREG_LR));
> r.ctr = htobe((uint32_t)context->readIntReg(INTREG_CTR));
> r.xer = htobe((uint32_t)context->readIntReg(INTREG_XER));
213,216d197
< /*
< * Translate the GDB register format into the kernel debugger register
< * format.
< */
218c199
< RemoteGDB::setregs()
---
> RemoteGDB::PowerGdbRegCache::setRegs(ThreadContext *context) const
220c201
< DPRINTF(GDBAcc, "setregs in remotegdb \n");
---
> DPRINTF(GDBAcc, "setRegs in remotegdb \n");
222d202
< // INTREG: R0~R31
224c204
< context->setIntReg(i, betoh(gdbregs.regs32[GdbFirstGPRIndex + i]));
---
> context->setIntReg(i, betoh(r.gpr[i]));
226d205
< // FLOATREG: F0~F31
228c207
< context->setFloatRegBits(i, gdbregs.regs64[GdbFirstFPRIndex + i]);
---
> context->setFloatRegBits(i, r.fpr[i]);
230,231c209
< // PC, MSR, CR, LR, CTR, XER
< context->pcState(betoh(gdbregs.regs32[GdbPCIndex]));
---
> context->pcState(betoh(r.pc));
233,236c211,214
< context->setIntReg(INTREG_CR, betoh(gdbregs.regs32[GdbCRIndex]));
< context->setIntReg(INTREG_LR, betoh(gdbregs.regs32[GdbLRIndex]));
< context->setIntReg(INTREG_CTR, betoh(gdbregs.regs32[GdbCTRIndex]));
< context->setIntReg(INTREG_XER, betoh(gdbregs.regs32[GdbXERIndex]));
---
> context->setIntReg(INTREG_CR, betoh(r.cr));
> context->setIntReg(INTREG_LR, betoh(r.lr));
> context->setIntReg(INTREG_CTR, betoh(r.ctr));
> context->setIntReg(INTREG_XER, betoh(r.xer));
237a216,221
>
> RemoteGDB::BaseGdbRegCache*
> RemoteGDB::gdbRegs() {
> return new PowerGdbRegCache(this);
> }
>