From 18fff9739c6e5c5500619923e39c329b1d46dcd7 Mon Sep 17 00:00:00 2001 From: Boris Shingarov Date: Sun, 19 Jul 2020 08:22:04 -0400 Subject: [PATCH] arch-mips: Implement GDB XML target description for MIPS Change-Id: Icff3b2c3e60d5989978de854247232afbb3b0dae Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31574 Maintainer: Jason Lowe-Power Tested-by: kokoro Reviewed-by: Gabe Black Reviewed-by: Jason Lowe-Power --- ext/gdb-xml/mips.xml | 94 +++++++++++++++++++++++++++++++++++++ src/arch/mips/SConscript | 3 ++ src/arch/mips/remote_gdb.cc | 20 +++++++- src/arch/mips/remote_gdb.hh | 8 +++- 4 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 ext/gdb-xml/mips.xml diff --git a/ext/gdb-xml/mips.xml b/ext/gdb-xml/mips.xml new file mode 100644 index 000000000..23133d7e3 --- /dev/null +++ b/ext/gdb-xml/mips.xml @@ -0,0 +1,94 @@ + + + + + + mips + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/arch/mips/SConscript b/src/arch/mips/SConscript index cac589f8e..d8771de8c 100644 --- a/src/arch/mips/SConscript +++ b/src/arch/mips/SConscript @@ -1,6 +1,7 @@ # -*- mode:python -*- # Copyright (c) 2004-2006 The Regents of The University of Michigan +# Copyright (c) 2020 LabWare # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -50,3 +51,5 @@ if env['TARGET_ISA'] == 'mips': DebugFlag('MipsPRA') ISADesc('isa/main.isa') + + GdbXml('mips.xml', 'gdb_xml_mips') diff --git a/src/arch/mips/remote_gdb.cc b/src/arch/mips/remote_gdb.cc index 48138eec7..bd9a40f68 100644 --- a/src/arch/mips/remote_gdb.cc +++ b/src/arch/mips/remote_gdb.cc @@ -1,5 +1,5 @@ /* - * Copyright 2015 LabWare + * Copyright 2015-2020 LabWare * Copyright 2014 Google, Inc. * Copyright (c) 2010 ARM Limited * All rights reserved @@ -136,6 +136,7 @@ #include #include "arch/mips/decoder.hh" +#include "blobs/gdb_xml_mips.hh" #include "cpu/thread_state.hh" #include "debug/GDBAcc.hh" #include "debug/GDBMisc.hh" @@ -201,3 +202,20 @@ RemoteGDB::gdbRegs() { return ®Cache; } + +bool +RemoteGDB::getXferFeaturesRead(const std::string &annex, std::string &output) +{ +#define GDB_XML(x, s) \ + { x, std::string(reinterpret_cast(Blobs::s), \ + Blobs::s ## _len) } + static const std::map annexMap { + GDB_XML("target.xml", gdb_xml_mips), + }; +#undef GDB_XML + auto it = annexMap.find(annex); + if (it == annexMap.end()) + return false; + output = it->second; + return true; +} diff --git a/src/arch/mips/remote_gdb.hh b/src/arch/mips/remote_gdb.hh index 407a5574f..2119d8e1d 100644 --- a/src/arch/mips/remote_gdb.hh +++ b/src/arch/mips/remote_gdb.hh @@ -1,5 +1,5 @@ /* - * Copyright 2015 LabWare + * Copyright 2015-2020 LabWare * Copyright 2014 Google, Inc. * Copyright (c) 2007 The Regents of The University of Michigan * All rights reserved. @@ -79,6 +79,12 @@ class RemoteGDB : public BaseRemoteGDB public: RemoteGDB(System *_system, ThreadContext *tc, int _port); BaseGdbRegCache *gdbRegs(); + std::vector + availableFeatures() const + { + return {"qXfer:features:read+"}; + }; + bool getXferFeaturesRead(const std::string &annex, std::string &output); }; } // namespace MipsISA -- 2.30.2