diff -r 7a9eeecf2b52 -r d2998cc75aeb src/arch/arm/remote_gdb.hh --- a/src/arch/arm/remote_gdb.hh Thu Nov 05 09:40:12 2015 +0000 +++ b/src/arch/arm/remote_gdb.hh Thu Nov 12 08:42:54 2015 -0500 @@ -56,13 +56,16 @@ namespace ArmISA { -// AArch32 registers with vfpv3/neon +// Ideally, we want to serve gdb with a feature description. +// For now, assume gdb's default. + +// AArch32 registers (--target=arm-linux-gnueabihf) enum { GDB32_R0 = 0, - GDB32_CPSR = 16, - GDB32_F0 = 17, - GDB32_FPSCR = 81, - GDB32_NUMREGS = 82 + GDB32_F0 = 16, + GDB32_FPSCR = GDB32_F0 + 3*8, + GDB32_CPSR = GDB32_FPSCR + 1, + GDB32_NUMREGS = 42 }; // AArch64 registers @@ -76,9 +79,8 @@ GDB64_NUMREGS = 98 }; -const int GDB_REG_BYTES M5_VAR_USED = - std::max(GDB64_NUMREGS * sizeof(uint64_t), - GDB32_NUMREGS * sizeof(uint32_t)); +const int GDB64_REG_BYTES M5_VAR_USED = GDB64_NUMREGS * sizeof(uint64_t); +const int GDB32_REG_BYTES M5_VAR_USED = GDB32_NUMREGS * sizeof(uint32_t); class RemoteGDB : public BaseRemoteGDB { diff -r 7a9eeecf2b52 -r d2998cc75aeb src/arch/arm/remote_gdb.cc --- a/src/arch/arm/remote_gdb.cc Thu Nov 05 09:40:12 2015 +0000 +++ b/src/arch/arm/remote_gdb.cc Thu Nov 12 08:42:54 2015 -0500 @@ -162,7 +162,7 @@ using namespace ArmISA; RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc) - : BaseRemoteGDB(_system, tc, GDB_REG_BYTES) + : BaseRemoteGDB(_system, tc, std::max(GDB32_REG_BYTES, GDB64_REG_BYTES)) { } @@ -201,9 +201,10 @@ { DPRINTF(GDBAcc, "getregs in remotegdb \n"); - memset(gdbregs.regs, 0, gdbregs.bytes()); + if (inAArch64(context)) { // AArch64 + gdbregs.size = GDB64_REG_BYTES; + memset(gdbregs.regs, 0, gdbregs.bytes()); - if (inAArch64(context)) { // AArch64 // x0-x30 for (int i = 0; i < 31; ++i) gdbregs.regs64[GDB64_X0 + i] = context->readIntReg(INTREG_X0 + i); @@ -222,6 +223,9 @@ gdbregs.regs32[gdboff + 3] = context->readFloatRegBits(i + 1); } } else { // AArch32 + gdbregs.size = GDB32_REG_BYTES; + memset(gdbregs.regs, 0, gdbregs.bytes()); + // R0-R15 supervisor mode gdbregs.regs32[GDB32_R0 + 0] = context->readIntReg(INTREG_R0); gdbregs.regs32[GDB32_R0 + 1] = context->readIntReg(INTREG_R1); @@ -240,16 +244,19 @@ gdbregs.regs32[GDB32_R0 + 14] = context->readIntReg(INTREG_LR); gdbregs.regs32[GDB32_R0 + 15] = context->pcState().pc(); - // CPSR - gdbregs.regs32[GDB32_CPSR] = context->readMiscRegNoEffect(MISCREG_CPSR); - - // vfpv3/neon floating point registers (32 double or 64 float) - for (int i = 0; i < NumFloatV7ArchRegs; ++i) - gdbregs.regs32[GDB32_F0 + i] = context->readFloatRegBits(i); + // By default, gdb configured for arm-linux-gnueabihf will + // expect f0-f7 of IEEE Extended precision (96 bits) each. + // This does not fit in with the current 8/16/32/64 union + // story; for now, just transfer all zeros. Hopefully one + // day somebody will implement transfer of FPRs correctly. // FPSCR gdbregs.regs32[GDB32_FPSCR] = context->readMiscRegNoEffect(MISCREG_FPSCR); + + // CPSR + gdbregs.regs32[GDB32_CPSR] = + context->readMiscRegNoEffect(MISCREG_CPSR); } } @@ -301,17 +308,13 @@ context->setIntReg(INTREG_R12, gdbregs.regs32[GDB32_R0 + 12]); context->setIntReg(INTREG_SP, gdbregs.regs32[GDB32_R0 + 13]); context->setIntReg(INTREG_LR, gdbregs.regs32[GDB32_R0 + 14]); - context->pcState(gdbregs.regs32[GDB32_R0 + 7]); + context->pcState(gdbregs.regs32[GDB32_R0 + 15]); + + //FPSCR + context->setMiscReg(MISCREG_FPSCR, gdbregs.regs32[GDB32_FPSCR]); //CPSR context->setMiscRegNoEffect(MISCREG_CPSR, gdbregs.regs32[GDB32_CPSR]); - - //vfpv3/neon floating point registers (32 double or 64 float) - for (int i = 0; i < NumFloatV7ArchRegs; ++i) - context->setFloatRegBits(i, gdbregs.regs32[GDB32_F0 + i]); - - //FPSCR - context->setMiscReg(MISCREG_FPSCR, gdbregs.regs32[GDB32_FPSCR]); } }