fastmodel: skip vector registers update in remote gdb

iris::ThreadContext doesn't implement the write interface for vector
registers. Skip that part in fastmodel remote_gdb to make updating
common registers work at least.

Change-Id: Ifa071f5dff4bdeee7361ae824b4b76e0b2805460
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69177
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Yu-hsin Wang
2022-11-02 17:23:42 +08:00
parent 2e1d24d048
commit daaccaa9ae
4 changed files with 64 additions and 16 deletions

View File

@@ -27,13 +27,42 @@
#include "arch/arm/fastmodel/remote_gdb.hh"
#include "arch/arm/fastmodel/iris/thread_context.hh"
#include "arch/arm/utility.hh"
#include "base/trace.hh"
#include "debug/GDBAcc.hh"
namespace gem5 {
using namespace ArmISA;
namespace fastmodel {
void
FastmodelRemoteGDB::AArch64GdbRegCache::setRegs(ThreadContext *context) const
{
DPRINTF(GDBAcc, "setRegs in remotegdb \n");
for (int i = 0; i < 31; ++i)
context->setReg(int_reg::x(i), r.x[i]);
auto pc_state = context->pcState().as<PCState>();
pc_state.set(r.pc);
context->pcState(pc_state);
context->setMiscRegNoEffect(MISCREG_CPSR, r.cpsr);
// Update the stack pointer. This should be done after
// updating CPSR/PSTATE since that might affect how SPX gets
// mapped.
context->setReg(int_reg::Spx, r.spx);
// Remove the vector registers update in FastmodelRemoteGDB since it's not
// implemented in iris::ThreadContext.
warn("Skip update vector registers in remotegdb\n");
context->setMiscRegNoEffect(MISCREG_FPSR, r.fpsr);
context->setMiscRegNoEffect(MISCREG_FPCR, r.fpcr);
}
FastmodelRemoteGDB::FastmodelRemoteGDB(System *_system, int port)
: gem5::ArmISA::RemoteGDB(_system, port)
: gem5::ArmISA::RemoteGDB(_system, port), regCache64(this)
{
}
@@ -57,5 +86,14 @@ FastmodelRemoteGDB::writeBlob(Addr vaddr, size_t size, const char *data)
return true;
}
BaseGdbRegCache*
FastmodelRemoteGDB::gdbRegs()
{
if (inAArch64(context()))
return &regCache64;
else
return &regCache32;
}
} // namespace fastmodel
} // namespace gem5

View File

@@ -36,14 +36,24 @@ namespace gem5
namespace fastmodel
{
class FastmodelRemoteGDB : public gem5::ArmISA::RemoteGDB
class FastmodelRemoteGDB : public ArmISA::RemoteGDB
{
public:
FastmodelRemoteGDB(System *_system, int port);
private:
protected:
class AArch64GdbRegCache : public ArmISA::RemoteGDB::AArch64GdbRegCache
{
using ArmISA::RemoteGDB::AArch64GdbRegCache::AArch64GdbRegCache;
public:
void setRegs(ThreadContext*) const override;
};
bool readBlob(Addr vaddr, size_t size, char *data) override;
bool writeBlob(Addr vaddr, size_t size, const char *data) override;
BaseGdbRegCache* gdbRegs() override;
AArch64GdbRegCache regCache64;
};
} // namespace fastmodel

View File

@@ -68,7 +68,7 @@ class RemoteGDB : public BaseRemoteGDB
class AArch32GdbRegCache : public BaseGdbRegCache
{
using BaseGdbRegCache::BaseGdbRegCache;
private:
protected:
struct GEM5_PACKED
{
uint32_t gpr[16];
@@ -77,12 +77,12 @@ class RemoteGDB : public BaseRemoteGDB
uint32_t fpscr;
} r;
public:
char *data() const { return (char *)&r; }
size_t size() const { return sizeof(r); }
void getRegs(ThreadContext*);
void setRegs(ThreadContext*) const;
char *data() const override { return (char *)&r; }
size_t size() const override { return sizeof(r); }
void getRegs(ThreadContext*) override;
void setRegs(ThreadContext*) const override;
const std::string
name() const
name() const override
{
return gdb->name() + ".AArch32GdbRegCache";
}
@@ -91,7 +91,7 @@ class RemoteGDB : public BaseRemoteGDB
class AArch64GdbRegCache : public BaseGdbRegCache
{
using BaseGdbRegCache::BaseGdbRegCache;
private:
protected:
struct GEM5_PACKED
{
uint64_t x[31];
@@ -103,12 +103,12 @@ class RemoteGDB : public BaseRemoteGDB
uint32_t fpcr;
} r;
public:
char *data() const { return (char *)&r; }
size_t size() const { return sizeof(r); }
void getRegs(ThreadContext*);
void setRegs(ThreadContext*) const;
char *data() const override { return (char *)&r; }
size_t size() const override { return sizeof(r); }
void getRegs(ThreadContext*) override;
void setRegs(ThreadContext*) const override;
const std::string
name() const
name() const override
{
return gdb->name() + ".AArch64GdbRegCache";
}

View File

@@ -188,7 +188,7 @@ class BaseRemoteGDB
return nullptr;
}
private:
protected:
/*
* Connection to the external GDB.
*/